Class Notebook
Nazwa przestrzeń: Aspose.Note Zgromadzenie: Aspose.Note.dll (25.4.0)
Przedstawiamy notatkę Aspose.Note.
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
Dziedziczeni członkowie
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
Pokaż jak zaoszczędzić notatkę.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook();
dataDir += "test_out.onetoc2";
notebook.Save(dataDir);
Pokaż, jak zaoszczędzić notebook w formacie PDF.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook(dataDir + "Notizbuch Öffnen.onetoc2");
dataDir += "ConvertToPDF_out.pdf";
notebook.Save(dataDir);
Pokaż, jak zaoszczędzić notebook jako obraz.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook(dataDir + "Notizbuch Öffnen.onetoc2");
dataDir += "ConvertToImage_out.png";
notebook.Save(dataDir);
Pokaż, jak uzyskać cały tekst z notatki.
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);
}
Pokaż, jak zaoszczędzić notatkę w formacie PDF.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook(dataDir + "Notizbuch Öffnen.onetoc2");
dataDir += "ConvertToPDFAsFlattened_out.pdf";
notebook.Save(
dataDir,
new NotebookPdfSaveOptions
{
Flatten = true
});
Pokazuje, jak iterować za pomocą dokumentów z notatnika ładując je łagodnie.
string inputFile = "Notizbuch öffnen.onetoc2";
string dataDir = RunExamples.GetDataDir_NoteBook();
Notebook notebook = new Notebook(dataDir + inputFile);
foreach (var notebookChildNode in notebook.OfType<Document>())
{
}
Pokaż, jak dodać nową sekcję do notatki.
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);
Pokaż, jak pobierać notatkę z prądu.
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");
Pokaż, jak zrobić szyfrowaną notatkę.
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" });
Pokaż, jak zaoszczędzić notebook jako obraz z określonymi opcjami.
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);
Pokaż, jak zaoszczędzić płaski notebook jako obraz.
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);
Pokaż, jak usunąć sekcję z notatki.
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);
Pokazuje, jak iterować za pośrednictwem przedładowanych dokumentów notatora.
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>())
{
}
Pokaż, jak przejść przez treść notatki.
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
Książka )
Inicjalizuje nową instancję klasy Aspose.Note.Notebook.
public Notebook()
{
}
Książka ( String )
Inicjalizuje nową instancję klasy Aspose.Note.Notebook.Otwórz istniejący notebook OneNote z pliku.
public Notebook(string filePath)
{
}
Parameters
filePath
string
Droga do pliku.
Notebook (string, opcje ładowania notatek)
Inicjalizuje nową instancję klasy Aspose.Note.Notebook.Otwiera istniejący notebook OneNote z pliku. pozwala określić dodatkowe opcje, takie jak strategia ładowania dla dzieci („lazy”/instant).
public Notebook(string filePath, NotebookLoadOptions loadOptions)
{
}
Parameters
filePath
string
Droga do pliku.
loadOptions
NotebookLoadOptions
Opcje opcji ładowania.
Książka ( Stream )
Inicjalizuje nową instancję klasy Aspose.Note.Notebook.Otwórz istniejący notebook OneNote z przepływu.
public class Notebook
{
public Notebook(Stream stream)
{
}
}
Parameters
stream
Stream
w strumieniu .
Notebook (strumień, opcje ładowania notebooka)
Inicjalizuje nową instancję klasy Aspose.Note.Notebook.Otwiera istniejący notebook OneNote z przepływu. pozwala określić dodatkowe opcje ładowania.
public Notebook(Stream stream, NotebookLoadOptions loadOptions)
{
}
Parameters
stream
Stream
w strumieniu .
loadOptions
NotebookLoadOptions
Opcje opcji ładowania.
Properties
Color
Zostaw lub ustaw kolor.
public Color Color
{
get
{
return this.Color;
}
set
{
this.Color = value;
}
}
Wartość nieruchomości
Count
Otrzymuje liczbę elementów zawartych w Aspose.Note.Notebook.
public int Count
{
get;
}
Wartość nieruchomości
DisplayName
Dostęp lub ustaw nazwę wyświetlacza.
public string DisplayName
{
get;
set;
}
Wartość nieruchomości
Examples
Pokaż, jak usunąć sekcję z notatki.
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
Dostęp do formatu pliku (OneNote 2010),
public FileFormat FileFormat
{
get;
}
Wartość nieruchomości
Guid
Otrzymuje globalnie unikalny identyfikator obiektu.
public Guid Guid
{
get;
}
Wartość nieruchomości
IsHistoryEnabled
Otrzymuje lub ustawia wartość wskazującą, czy historia jest włączona.
public bool IsHistoryEnabled
{
get;
set;
}
Wartość nieruchomości
Tego[wt)
Otrzymuje notatkę dziecięce przez dany indeks.
public INotebookChildNode this[int index]
{
get;
}
Wartość nieruchomości
Methods
Książka (InotebookChildNode)
Dodaj przycisk do końca listy.
public INotebookChildNode AppendChild(INotebookChildNode newChild)
{
return _notebook.AppendChild(newChild);
}
Parameters
newChild
INotebookChildNode
Noda do dodania.
Returns
Dodany wkładek.
GetChildNodes()
Zdobądź wszystkie węzły dziecka według typu węgla.
public IList<T1> GetChildNodes<T1>() where T1 : Node
{
}
Returns
Lista węzłów dziecięcych.
Rodzaj parametrów
T1
Rodzaj elementów w zwróconej liście.
wskaźnik ()
Powraca numerator, który iteruje przez węzły dziecięce Aspose.Note.Notebook.
public IEnumerator<notebookchildnode> GetEnumerator()
{
}
Returns
IEnumerator • < INotebookChildNode >
A System. Kolekcje.IEnumerator
LoadChildDocument (string) - dokumenty
Dodaj dziecku dokument node.Otwórz istniejący dokument OneNote z pliku.
public void LoadChildDocument(string filePath)
{
}
Parameters
filePath
string
Droga do pliku.
Examples
Pokaż, jak pobierać notatkę z prądu.
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, Opcje ładowania)
Dodaj dziecku dokument node.Otwiera istniejący dokument OneNote z pliku. pozwala określić dodatkowe opcje ładowania.
public void LoadChildDocument(string filePath, Aspose.Words.LoadOptions loadOptions)
{
}
Parameters
filePath
string
Droga do pliku.
loadOptions
LoadOptions
Opcje opcji ładowania.
LoadChildDocument (strumień)
Dodaj dziecku dokument node.Otwórz istniejący dokument OneNote z przepływu.
public void LoadChildDocument(Stream stream)
{
}
Parameters
stream
Stream
w strumieniu .
Examples
Pokaż, jak pobierać notatkę z prądu.
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, Opcje ładowania)
Dodaj dziecku dokument node.Otwiera istniejący dokument programu OneNote z przepływu. pozwala określić dodatkowe opcje ładowania.
public void LoadChildDocument(Stream stream, LoadOptions loadOptions)
{
}
Parameters
stream
Stream
w strumieniu .
loadOptions
LoadOptions
Opcje opcji ładowania.
LoadChildNotebook (string) – książka
Dodaj dziecku notatkę.Otwórz istniejący notebook OneNote z pliku.
public void LoadChildNotebook(string filePath)
{
}
Parameters
filePath
string
Droga do pliku.
LoadChildNotebook(string, NotebookLoadOptions)
Dodaj dziecku notatkę.Otwiera istniejący notebook OneNote z pliku. pozwala określić dodatkowe opcje ładowania.
public void LoadChildNotebook(string filePath, NotebookLoadOptions loadOptions)
{
}
Parameters
filePath
string
Droga do pliku.
loadOptions
NotebookLoadOptions
Opcje opcji ładowania.
Artykuły na temat LoadChildNotebook(Stream)
Dodaj dziecku notatkę.Otwórz istniejący notebook OneNote z przepływu.
public void LoadChildNotebook(Stream stream)
{
}
Parameters
stream
Stream
w strumieniu .
LoadChildNotebook(Strumień, NotebookLoadOptions)
Dodaj dziecku notatkę.Otwiera istniejący notebook OneNote z przepływu. pozwala określić dodatkowe opcje ładowania.
public void LoadChildNotebook(Stream stream, NotebookLoadOptions loadOptions)
{
}
Parameters
stream
Stream
w strumieniu .
loadOptions
NotebookLoadOptions
Opcje opcji ładowania.
RemoveChild(Wymagania z INotebookNode)
Usunąć dziecko węzła.
public INotebookChildNode RemoveChild(INotebookChildNode oldChild)
{
}
Parameters
oldChild
INotebookChildNode
Noda do usunięcia.
Returns
Usunięte węzły .
Examples
Pokaż, jak uzyskać dostęp do wszystkich sekcji z notebooka.
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);
}
Pokaż, jak usunąć sekcję z notatki.
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);
Pokaż jak zaoszczędzić notatkę.
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" });
}
Zachowaj ( String )
Zapisz dokument OneNote do pliku.
public void Save(string fileName)
{
}
Parameters
fileName
string
Pełna nazwa pliku.Jeśli plik z wyznaczonym pełnym nazwą już istnieje, istniejące pliki są przesłane.
Exceptions
IncorrectDocumentStructureException
Struktura dokumentu narusza specyfikację.
UnsupportedSaveFormatException
Zapytany format nie jest obsługiwany.
Zachowaj ( strumień )
Zapisz dokument OneNote na strumień.
public void Save(Stream stream)
{
}
Parameters
stream
Stream
w strumieniu .
Exceptions
IncorrectDocumentStructureException
Struktura dokumentu narusza specyfikację.
UnsupportedSaveFormatException
Zapytany format nie jest obsługiwany.
Zapisywanie (string, SaveFormat)
Zapisz dokument OneNote do pliku w określonym formacie.
public void Save(string fileName, Aspose.Words.SaveFormat format)
{
}
Parameters
fileName
string
Pełna nazwa pliku.Jeśli plik z wyznaczonym pełnym nazwą już istnieje, istniejące pliki są przesłane.
format
SaveFormat
Format, w którym można zapisać dokument.
Exceptions
IncorrectDocumentStructureException
Struktura dokumentu narusza specyfikację.
UnsupportedSaveFormatException
Zapytany format nie jest obsługiwany.
przepływ (strum, SaveFormat)
Zapisz dokument OneNote do strumienia w określonym formacie.
public void Save(Stream stream, SaveFormat format)
{
}
Parameters
stream
Stream
w strumieniu .
format
SaveFormat
Format, w którym można zapisać dokument.
Exceptions
IncorrectDocumentStructureException
Struktura dokumentu narusza specyfikację.
UnsupportedSaveFormatException
Zapytany format nie jest obsługiwany.
Zapisz (string, NotebookSaveOptions)
Zapisz dokument OneNote do pliku za pomocą określonych opcji zapisywania.
public void Save(string fileName, NotebookSaveOptions options)
{
}
Parameters
fileName
string
Pełna nazwa pliku.Jeśli plik z wyznaczonym pełnym nazwą już istnieje, istniejące pliki są przesłane.
options
NotebookSaveOptions
Określa opcje, w jaki sposób dokument jest zapisywany w pliku.
Exceptions
IncorrectDocumentStructureException
Struktura dokumentu narusza specyfikację.
UnsupportedSaveFormatException
Zapytany format nie jest obsługiwany.
Save(Strumień, NotebookSaveOptions)
Zapisz dokument OneNote do strumienia za pomocą określonych opcji zapisywania.
public void Save(Stream stream, NotebookSaveOptions options)
{
}
Parameters
stream
Stream
w strumieniu .
options
NotebookSaveOptions
Określa opcje, w jaki sposób dokument jest zapisywany.
Exceptions
IncorrectDocumentStructureException
Struktura dokumentu narusza specyfikację.
UnsupportedSaveFormatException
Zapytany format nie jest obsługiwany.