Class Notebook
Der Name: Aspose.Note Zusammensetzung: Aspose.Note.dll (25.4.0)
Es handelt sich um ein Aspose.Note Notebook.
public class Notebook : INotebookChildNode, IEnumerable<inotebookchildnode>, IEnumerable
{
public void Add(inotebookchildnode childNode)
{
_children.Add(childNode);
}
public void Remove(inotebookchildnode childNode)
{
_children.Remove(childNode);
}
public bool Contains(inotebookchildnode childNode)
{
return _children.Contains(childNode);
}
IEnumerator IEnumerable.GetEnumerator()
{
foreach (var child in _children)
yield return child;
}
IEnumerator<inotebookchildnode> IEnumerable<inotebookchildnode>.GetEnumerator()
{
foreach (var child in _children)
yield return child;
}
private List<inotebookchildnode> _children = new List<inotebookchildnode>();
}
Inheritance
Implements
INotebookChildNode
,
IEnumerable
Vererbte Mitglieder
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
Sie zeigen, wie man ein Notebook speichert.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook();
dataDir += "test_out.onetoc2";
notebook.Save(dataDir);
Zeigt, wie man das Notebook in PDF-Format speichert.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook(dataDir + "Notizbuch Öffnen.onetoc2");
dataDir += "ConvertToPDF_out.pdf";
notebook.Save(dataDir);
Zeigt, wie man das Notebook als Bild speichert.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook(dataDir + "Notizbuch Öffnen.onetoc2");
dataDir += "ConvertToImage_out.png";
notebook.Save(dataDir);
Zeigt, wie man alle Texte aus einem Notebook erhält.
string inputFile = "notebook.onetoc2";
string dataDir = RunExamples.GetDataDir_NoteBook();
Notebook rootNotebook = new Notebook(dataDir + inputFile);
IList<RichText> allRichTextNodes = rootNotebook.GetChildNodes<RichText>();
foreach (RichText richTextNode in allRichTextNodes)
{
Console.WriteLine(richTextNode.Text);
}
Zeigt, wie man ein flattenter Notebook in PDF-Format speichert.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook(dataDir + "Notizbuch Öffnen.onetoc2");
dataDir += "ConvertToPDFAsFlattened_out.pdf";
notebook.Save(
dataDir,
new NotebookPdfSaveOptions
{
Flatten = true
});
Zeigt, wie man durch Dokumente eines Notebooks iteriert, die sie leicht laden.
string inputFile = "Notizbuch öffnen.onetoc2";
string dataDir = RunExamples.GetDataDir_NoteBook();
Notebook notebook = new Notebook(dataDir + inputFile);
foreach (var notebookChildNode in notebook.OfType<Document>())
{
}
Zeigt, wie man einen neuen Abschnitt zu einem Notebook hinzufügt.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook(dataDir + "Notizbuch Öffnen.onetoc2");
notebook.AppendChild(new Document(dataDir + "Neuer Abschnitt 1.one"));
dataDir += @"\AddChildNode_out.onetoc2";
notebook.Save(dataDir);
Zeigt, wie man das Notebook aus einem Stream laden kann.
string dataDir = RunExamples.GetDataDir_NoteBook();
FileStream stream = new FileStream(dataDir + "Notizbuch öffnen.onetoc2", FileMode.Open);
var notebook = new Notebook(stream);
using (FileStream childStream = new FileStream(dataDir + "Aspose.one", FileMode.Open))
{
notebook.LoadChildDocument(childStream);
}
notebook.LoadChildDocument(dataDir + "Sample1.one");
Zeigt, wie man ein verschlüsseltes Notebook macht.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook(dataDir + "test.onetoc2", new NotebookLoadOptions() { DeferredLoading = true });
notebook.LoadChildDocument(dataDir + "Aspose.one");
notebook.LoadChildDocument(dataDir + "Locked Pass1.one", new LoadOptions() { DocumentPassword = "pass" });
notebook.LoadChildDocument(dataDir + "Locked Pass2.one", new LoadOptions() { DocumentPassword = "pass2" });
Zeigt, wie man das Notebook als Bild mit angegebenen Optionen speichert.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook(dataDir + "Notizbuch �ffnen.onetoc2");
var notebookSaveOptions = new NotebookImageSaveOptions { SaveFormat = SaveFormat.Png };
var documentSaveOptions = notebookSaveOptions.DocumentSaveOptions;
documentSaveOptions.Resolution = 400;
dataDir += "ConvertToImageWithOptions_out.png";
notebook.Save(dataDir, notebookSaveOptions);
Zeigt, wie man das flattente Notebook als Bild speichert.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook(dataDir + "Notizbuch öffnen.onetoc2");
var notebookSaveOptions = new NotebookImageSaveOptions(SaveFormat.Png);
var documentSaveOptions = notebookSaveOptions.DocumentSaveOptions;
documentSaveOptions.Resolution = 400;
notebookSaveOptions.Flatten = true;
dataDir += "ConvertToImageAsFlattenedNotebook_out.png";
notebook.Save(dataDir, notebookSaveOptions);
Zeigt, wie man einen Abschnitt aus einem Notebook entfernen kann.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook(dataDir + "test.onetoc2");
foreach (var child in new List<inotebookchildnode>(notebook))
{
if (child.DisplayName == "Remove Me")
{
notebook.RemoveChild(child);
}
}
dataDir = dataDir + "RemoveChildNode_out.onetoc2";
notebook.Save(dataDir);
Zeigt, wie man durch vorgeladenen Dokumente eines Notebooks iteriert.
NotebookLoadOptions loadOptions = new NotebookLoadOptions { InstantLoading = true };
string inputFile = "Notizbuch öffnen.onetoc2";
string dataDir = RunExamples.GetDataDir_NoteBook();
Notebook notebook = new Notebook(dataDir + inputFile, loadOptions);
foreach (INotebookChildNode notebookChildNode in notebook.OfType<Document>())
{
}
Zeigt, wie man durch den Inhalt eines Notebooks geht.
string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
string fileName = "Open Notebook.onetoc2";
try
{
var notebook = new Notebook(dataDir + fileName);
foreach (var notebookChildNode in notebook)
{
Console.WriteLine(notebookChildNode.DisplayName);
if (notebookChildNode is Document)
{
}
else if (notebookChildNode is Notebook)
{
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Constructors
Ein Notebook ()
Initialisiert eine neue Instanz der Aspose.Note. Notebook Klasse.
public Notebook()
{
}
Ein Notebook (String)
Initialisiert eine neue Instanz der Aspose.Note. Notebook Klasse.Öffnen Sie einen vorhandenen OneNote-Notes aus einem Datei.
public Notebook(string filePath)
{
}
Parameters
filePath
string
Der Dateiweg.
Notebook (String, NoteBookLoadOptions)
Initialisiert eine neue Instanz der Aspose.Note. Notebook Klasse.Öffnen Sie eine vorhandene OneNote-Nota aus einem Datei. Erlaubt es, zusätzliche Optionen wie eine Kinderladestrategie („lazy“/instant) anzuzeigen.
public Notebook(string filePath, NotebookLoadOptions loadOptions)
{
}
Parameters
filePath
string
Der Dateiweg.
loadOptions
NotebookLoadOptions
Die Lastoptionen.
Bildschirm ( Stream )
Initialisiert eine neue Instanz der Aspose.Note. Notebook Klasse.Öffnen Sie einen vorhandenen OneNote-Notbuch aus einem Stream.
public class Notebook
{
public Notebook(Stream stream)
{
}
}
Parameters
stream
Stream
Der Strom.
Notebook (Stream, NoteBookLoadOptions)
Initialisiert eine neue Instanz der Aspose.Note. Notebook Klasse.Öffnen Sie eine vorhandene OneNote-Nota aus einem Stream. Erlaubt, zusätzliche Ladungsoptionen zu angeben.
public Notebook(Stream stream, NotebookLoadOptions loadOptions)
{
}
Parameters
stream
Stream
Der Strom.
loadOptions
NotebookLoadOptions
Die Lastoptionen.
Properties
Color
Gibt oder legt die Farbe fest.
public Color Color
{
get
{
return this.Color;
}
set
{
this.Color = value;
}
}
Eigentumswert
Count
Erhält die Anzahl der Elemente, die im Aspose.Note.Buch enthalten sind.
public int Count
{
get;
}
Eigentumswert
DisplayName
Erhalten oder setzen Sie den Display-Namen.
public string DisplayName
{
get;
set;
}
Eigentumswert
Examples
Zeigt, wie man einen Abschnitt aus einem Notebook entfernen kann.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook(dataDir + "test.onetoc2");
foreach (var child in new List<InotebookChildNode>(notebook))
{
if (child.DisplayName == "Remove Me")
{
notebook.RemoveChild(child);
}
}
dataDir = dataDir + "RemoveChildNode_out.onetoc2";
notebook.Save(dataDir);
Notes:
FileFormat
Erhalten Sie das Dateiformat (OneNote 2010, OneNota Online).
public FileFormat FileFormat
{
get;
}
Eigentumswert
Guid
Er bekommt das weltweit einzigartige ID des Objekts.
public Guid Guid
{
get;
}
Eigentumswert
IsHistoryEnabled
Er bekommt oder setzt einen Wert, der angibt, ob die Geschichte aktiviert ist.
public bool IsHistoryEnabled
{
get;
set;
}
Eigentumswert
Diese[In der
Er bekommt das Notebook-Kind-Node durch den gegebenen Index.
public INotebookChildNode this[int index]
{
get;
}
Eigentumswert
Methods
AppendChild (INotebookChiltNode)
Fügen Sie die Node am Ende der Liste hinzu.
public INotebookChildNode AppendChild(INotebookChildNode newChild)
{
return _notebook.AppendChild(newChild);
}
Parameters
newChild
INotebookChildNode
Die Node zu hinzufügen.
Returns
Die Node hinzugefügt.
GetChildNodes()
Erhalten Sie alle Knoten des Kindes nach Node-Typ.
public IList<T1> GetChildNodes<T1>() where T1 : Node
{
}
Returns
Eine Liste der Kinderknoten.
Arten von Parametern
T1
Die Art der Elemente in der zurückgegebenen Liste.
Die Anzahl der Punkte()
Wiederherstellt eine Liste, die durch die Kinderknoten des Aspose.Note.Buchs iteriert.
public IEnumerator<notebookchildnode> GetEnumerator()
{
}
Returns
IEnumerator &undlt; INotebookChildNode >
Ein System.Kollektionen.IEnumerator
LoadChildDocument (String)
Ein Kinderdokument node hinzufügen.Öffnen Sie ein bestehendes OneNote-Dokument aus einem Datei.
public void LoadChildDocument(string filePath)
{
}
Parameters
filePath
string
Der Dateiweg.
Examples
Zeigt, wie man das Notebook aus einem Stream laden kann.
string dataDir = RunExamples.GetDataDir_NoteBook();
FileStream stream = new FileStream(dataDir + "Notizbuch öffnen.onetoc2", FileMode.Open);
var notebook = new Notebook(stream);
using (FileStream childStream = new FileStream(dataDir + "Aspose.one", FileMode.Open))
{
notebook.LoadChildDocument(childStream);
}
notebook.LoadChildDocument(dataDir + "Sample1.one");
LoadChildDocument (String und LoatOptions)
Ein Kinderdokument node hinzufügen.Öffnet ein bestehendes OneNote-Dokument aus einem Datei. Erlaubt, zusätzliche Ladungsoptionen zu angeben.
public void LoadChildDocument(string filePath, Aspose.Words.LoadOptions loadOptions)
{
}
Parameters
filePath
string
Der Dateiweg.
loadOptions
LoadOptions
Die Lastoptionen.
Verwendung von LoadChildDocument (Stream)
Ein Kinderdokument node hinzufügen.Öffnen Sie ein bestehendes OneNote-Dokument aus einem Stream.
public void LoadChildDocument(Stream stream)
{
}
Parameters
stream
Stream
Der Strom.
Examples
Zeigt, wie man das Notebook aus einem Stream laden kann.
string dataDir = RunExamples.GetDataDir_NoteBook();
FileStream stream = new FileStream(dataDir + "Notizbuch öffnen.onetoc2", FileMode.Open);
var notebook = new Notebook(stream);
using (FileStream childStream = new FileStream(dataDir + "Aspose.one", FileMode.Open))
{
notebook.LoadChildDocument(childStream);
}
notebook.LoadChildDocument(dataDir + "Sample1.one");
LoadChildDocument (Stream und LoatOptions)
Ein Kinderdokument node hinzufügen.Öffnet ein bestehendes OneNote-Dokument aus einem Stream. Erlaubt, zusätzliche Ladungsoptionen zu angeben.
public void LoadChildDocument(Stream stream, LoadOptions loadOptions)
{
}
Parameters
stream
Stream
Der Strom.
loadOptions
LoadOptions
Die Lastoptionen.
LoadChildNotebook (String)
Hinzufügen eines Kindes Notebook Node.Öffnen Sie einen vorhandenen OneNote-Notes aus einem Datei.
public void LoadChildNotebook(string filePath)
{
}
Parameters
filePath
string
Der Dateiweg.
LoadChildNotebook(String, NotebookLoadOptions)
Hinzufügen eines Kindes Notebook Node.Öffnen Sie eine vorhandene OneNote-Nota aus einem Datei. Erlaubt, zusätzliche Ladungsoptionen zu angeben.
public void LoadChildNotebook(string filePath, NotebookLoadOptions loadOptions)
{
}
Parameters
filePath
string
Der Dateiweg.
loadOptions
NotebookLoadOptions
Die Lastoptionen.
LoadChildNotebook (Stream)
Hinzufügen eines Kindes Notebook Node.Öffnen Sie einen vorhandenen OneNote-Notbuch aus einem Stream.
public void LoadChildNotebook(Stream stream)
{
}
Parameters
stream
Stream
Der Strom.
LoadChildNotebook(Stream, NotebookLoadOptions)
Hinzufügen eines Kindes Notebook Node.Öffnen Sie eine vorhandene OneNote-Nota aus einem Stream. Erlaubt, zusätzliche Ladungsoptionen zu angeben.
public void LoadChildNotebook(Stream stream, NotebookLoadOptions loadOptions)
{
}
Parameters
stream
Stream
Der Strom.
loadOptions
NotebookLoadOptions
Die Lastoptionen.
Entfernung (INotebookChildNode)
Entfernen Sie das Kind Node.
public INotebookChildNode RemoveChild(INotebookChildNode oldChild)
{
}
Parameters
oldChild
INotebookChildNode
Die Node zu entfernen.
Returns
Die entfernte Node.
Examples
Zeigt, wie man alle Abschnitte aus einem Notebook zugreifen kann.
string inputFile = "notebook.onetoc2";
string dataDir = RunExamples.GetDataDir_NoteBook();
Notebook rootNotebook = new Notebook(dataDir + inputFile);
IList<Document> allDocuments = rootNotebook.GetChildNodes<Document>();
foreach (Document document in allDocuments)
{
Console.WriteLine(document.DisplayName);
}
Zeigt, wie man einen Abschnitt aus einem Notebook entfernen kann.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook(dataDir + "test.onetoc2");
foreach (var child in new List<inotebookchildnode>(notebook))
{
if (child.DisplayName == "Remove Me")
{
notebook.RemoveChild(child);
}
}
dataDir = dataDir + "RemoveChildNode_out.onetoc2";
notebook.Save(dataDir);
Sie zeigen, wie man ein Notebook speichert.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook(dataDir + "test.onetoc2", new NotebookLoadOptions() { DeferredLoading = false });
notebook.Save(dataDir + "notebook_out.onetoc2", new NotebookOneSaveOptions() { DeferredSaving = true });
if (notebook.Any())
{
var childDocument0 = notebook[0] as Document;
childDocument0.Save(dataDir + "NotLocked_out.one");
var childDocument1 = notebook[1] as Document;
childDocument1.Save(dataDir + "LockedPass1_out.one", new OneSaveOptions() { DocumentPassword = "pass" });
var childDocument2 = notebook[2] as Document;
childDocument2.Save(dataDir + "LockedPass2_out.one", new OneSaveOptions() { DocumentPassword = "pass2" });
}
Rettung ( String )
Speichern Sie das OneNote-Dokument in eine Datei.
public void Save(string fileName)
{
}
Parameters
fileName
string
Wenn eine Datei mit dem angegebenen vollständigen Namen bereits vorhanden ist, wird die bestehende Dateie übergeschrieben.
Exceptions
IncorrectDocumentStructureException
Die Dokumentstruktur verletzt die Spezifikation.
UnsupportedSaveFormatException
Ersuchtes Speicherformat wird nicht unterstützt.
Rettung ( Stream )
Speichern Sie das OneNote-Dokument in einen Strom.
public void Save(Stream stream)
{
}
Parameters
stream
Stream
Der Strom.
Exceptions
IncorrectDocumentStructureException
Die Dokumentstruktur verletzt die Spezifikation.
UnsupportedSaveFormatException
Ersuchtes Speicherformat wird nicht unterstützt.
Speichern (String und SaveFormat)
Speichert das OneNote-Dokument auf eine Datei im angegebenen Format.
public void Save(string fileName, Aspose.Words.SaveFormat format)
{
}
Parameters
fileName
string
Wenn eine Datei mit dem angegebenen vollständigen Namen bereits vorhanden ist, wird die bestehende Dateie übergeschrieben.
format
SaveFormat
Das Format, in dem Sie das Dokument speichern können.
Exceptions
IncorrectDocumentStructureException
Die Dokumentstruktur verletzt die Spezifikation.
UnsupportedSaveFormatException
Ersuchtes Speicherformat wird nicht unterstützt.
Speichern (Stream und SaveFormat)
Speichert das OneNote-Dokument in einem Stream im angegebenen Format.
public void Save(Stream stream, SaveFormat format)
{
}
Parameters
stream
Stream
Der Strom.
format
SaveFormat
Das Format, in dem Sie das Dokument speichern können.
Exceptions
IncorrectDocumentStructureException
Die Dokumentstruktur verletzt die Spezifikation.
UnsupportedSaveFormatException
Ersuchtes Speicherformat wird nicht unterstützt.
Speichern (String, NotebookSaveOptions)
Speichern Sie das OneNote-Dokument in eine Datei mit den angegebenen Speicheroptionen.
public void Save(string fileName, NotebookSaveOptions options)
{
}
Parameters
fileName
string
Wenn eine Datei mit dem angegebenen vollständigen Namen bereits vorhanden ist, wird die bestehende Dateie übergeschrieben.
options
NotebookSaveOptions
Angeben Sie die Optionen, wie das Dokument in der Datei gespeichert wird.
Exceptions
IncorrectDocumentStructureException
Die Dokumentstruktur verletzt die Spezifikation.
UnsupportedSaveFormatException
Ersuchtes Speicherformat wird nicht unterstützt.
Speichern (Stream, NotebookSaveOptions)
Speichern Sie das OneNote-Dokument in einen Strom, indem Sie die angegebenen Speicheroptionen verwenden.
public void Save(Stream stream, NotebookSaveOptions options)
{
}
Parameters
stream
Stream
Der Strom.
options
NotebookSaveOptions
Angeben Sie die Optionen, wie das Dokument gespeichert wird.
Exceptions
IncorrectDocumentStructureException
Die Dokumentstruktur verletzt die Spezifikation.
UnsupportedSaveFormatException
Ersuchtes Speicherformat wird nicht unterstützt.