Class Notebook
Název místa: Aspose.Note Shromáždění: Aspose.Note.dll (25.4.0)
Představuje Aspose.Note notebook.
public class Notebook : INotebookChildNode, IEnumerable<inotebookchildnode>, IEnumerable
Inheritance
Implements
INotebookChildNode
,
IEnumerable
Dědiční členové
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
Ukažte, jak zachránit notebook.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook();
dataDir = dataDir + "test_out.onetoc2";
// Save the Notebook
notebook.Save(dataDir);
Ukazuje, jak uložit notebook ve formátu PDF.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_NoteBook();
// Load a OneNote Notebook
var notebook = new Notebook(dataDir + "Notizbuch �ffnen.onetoc2");
dataDir = dataDir + "ConvertToPDF_out.pdf";
// Save the Notebook
notebook.Save(dataDir);
Ukazuje, jak zachránit notebook jako obrázek.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_NoteBook();
// Load a OneNote Notebook
var notebook = new Notebook(dataDir + "Notizbuch �ffnen.onetoc2");
dataDir = dataDir + "ConvertToImage_out.png";
// Save the Notebook
notebook.Save(dataDir);
Ukazuje, jak získat celý text z notebooku.
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);
}</richtext></richtext>
Ukazuje, jak ušetřit pletené notebooky ve formátu PDF.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_NoteBook();
// Load a OneNote Notebook
var notebook = new Notebook(dataDir + "Notizbuch �ffnen.onetoc2");
// Save the Notebook
dataDir = dataDir + "ConvertToPDFAsFlattened_out.pdf";
notebook.Save(
dataDir,
new NotebookPdfSaveOptions
{
Flatten = true
});
Ukazuje, jak iterovat prostřednictvím dokumentů notebooku, které je lehce nabízejí.
string inputFile = "Notizbuch öffnen.onetoc2";
string dataDir = RunExamples.GetDataDir_NoteBook();
// By default children loading is "lazy".
Notebook notebook = new Notebook(dataDir + inputFile);
foreach (var notebookChildNode in notebook.OfType<document>())
{
// Actual loading of the child document happens only here.
// Do something with child document
}</document>
Ukazuje, jak přidat novou sekci do notebooku.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_NoteBook();
// Load a OneNote Notebook
var notebook = new Notebook(dataDir + "Notizbuch �ffnen.onetoc2");
// Append a new child to the Notebook
notebook.AppendChild(new Document(dataDir + "Neuer Abschnitt 1.one"));
dataDir = dataDir + "AddChildNode_out.onetoc2";
// Save the Notebook
notebook.Save(dataDir);
Ukazuje, jak nabít notebook z toku.
// The path to the documents directory.
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");
Ukazuje, jak vytvořit šifrovaný notebook.
// The path to the documents directory.
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" });
Ukazuje, jak uložit notebook jako obrázek s specifikovanými možnostmi.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_NoteBook();
// Load a OneNote Notebook
var notebook = new Notebook(dataDir + "Notizbuch �ffnen.onetoc2");
var notebookSaveOptions = new NotebookImageSaveOptions(SaveFormat.Png);
var documentSaveOptions = notebookSaveOptions.DocumentSaveOptions;
documentSaveOptions.Resolution = 400;
dataDir = dataDir + "ConvertToImageWithOptions_out.png";
// Save the Notebook
notebook.Save(dataDir, notebookSaveOptions);
Ukazuje, jak zachránit pletený notebook jako obrázek.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_NoteBook();
// Load a OneNote 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 = dataDir + "ConvertToImageAsFlattenedNotebook_out.png";
// Save the Notebook
notebook.Save(dataDir, notebookSaveOptions);
Ukazuje, jak odstranit část z notebooku.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_NoteBook();
// Load a OneNote Notebook
var notebook = new Notebook(dataDir + "test.onetoc2");
// Traverse through its child nodes for searching the desired child item
foreach (var child in new List<inotebookchildnode>(notebook))
{
if (child.DisplayName == "Remove Me")
{
// Remove the Child Item from the Notebook
notebook.RemoveChild(child);
}
}
dataDir = dataDir + "RemoveChildNode_out.onetoc2";
// Save the Notebook
notebook.Save(dataDir);</inotebookchildnode>
Ukáže, jak iterovat prostřednictvím předložených dokumentů notebooku.
// By default children loading is "lazy".
// Therefore for instant loading has took place,
// it is necessary to set the NotebookLoadOptions.InstantLoading flag.
NotebookLoadOptions loadOptions = new NotebookLoadOptions { InstantLoading = true };
String inputFile = "Notizbuch öffnen.onetoc2";
String dataDir = RunExamples.GetDataDir_NoteBook();
Notebook notebook = new Notebook(dataDir + inputFile, loadOptions);
// All child documents are already loaded.
foreach (INotebookChildNode notebookChildNode in notebook.OfType<document>())
{
// Do something with child document
}</document>
Ukazuje, jak projít obsahem notebooku.
// The path to the documents directory.
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)
{
// Do something with child document
}
else if (notebookChildNode is Notebook)
{
// Do something with child notebook
}
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Constructors
Notebook()
Začíná nový příklad třídy Aspose.Note.Notebook.
public Notebook()
Notebook(Stringová)
Začíná nový příklad třídy Aspose.Note.Notebook.Otevře se stávající notebook OneNote z souboru.
public Notebook(string filePath)
Parameters
filePath
string
Původní cestou souboru.
Notebook(Třída, NotebookLoadOptions)
Začíná nový příklad třídy Aspose.Note.Notebook.Otevře se stávající notebook OneNote z souboru. Umožňuje specifikovat další možnosti, jako je dětská strategie nabíjení („lazy“/instant).
public Notebook(string filePath, NotebookLoadOptions loadOptions)
Parameters
filePath
string
Původní cestou souboru.
loadOptions
NotebookLoadOptions
Možnosti nabíjen.
Notebook(Stream)
Začíná nový příklad třídy Aspose.Note.Notebook.Otevře se stávající notebook OneNote z toku.
public Notebook(Stream stream)
Parameters
stream
Stream
To je proud.
Notebook(Přenos, NotebookLoadOptions)
Začíná nový příklad třídy Aspose.Note.Notebook.Otevře se stávající notebook OneNote z toku. umožňuje specifikovat další možnosti nabíjení.
public Notebook(Stream stream, NotebookLoadOptions loadOptions)
Parameters
stream
Stream
To je proud.
loadOptions
NotebookLoadOptions
Možnosti nabíjen.
Properties
Color
Obdržíte nebo nastavte barvu.
public Color Color { get; set; }
Hodnota nemovitosti
Count
Obdrží počet prvků obsažených v Aspose.Note.Notebook.
public int Count { get; }
Hodnota nemovitosti
DisplayName
Obdržíte nebo nastavte název zobrazení.
public string DisplayName { get; set; }
Hodnota nemovitosti
Examples
Ukazuje, jak odstranit část z notebooku.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_NoteBook();
// Load a OneNote Notebook
var notebook = new Notebook(dataDir + "test.onetoc2");
// Traverse through its child nodes for searching the desired child item
foreach (var child in new List<inotebookchildnode>(notebook))
{
if (child.DisplayName == "Remove Me")
{
// Remove the Child Item from the Notebook
notebook.RemoveChild(child);
}
}
dataDir = dataDir + "RemoveChildNode_out.onetoc2";
// Save the Notebook
notebook.Save(dataDir);</inotebookchildnode>
FileFormat
Obdrží formát souboru (OneNote 2010, OneNota Online).
public FileFormat FileFormat { get; }
Hodnota nemovitosti
Guid
Obsahuje celosvětově unikátní identitu objektu.
public Guid Guid { get; }
Hodnota nemovitosti
IsHistoryEnabled
Obdrží nebo nastaví hodnotu, která naznačuje, zda je příběh povolen.
public bool IsHistoryEnabled { get; set; }
Hodnota nemovitosti
Tohle[Int]
Obdrží notebook dětský uzel podle daného indexu.
public INotebookChildNode this[int index] { get; }
Hodnota nemovitosti
Methods
AppendChild(Úvodní stránkaChildNode)
Přidejte nůž na konec seznamu.
public INotebookChildNode AppendChild(INotebookChildNode newChild)
Parameters
newChild
INotebookChildNode
Nůž k přidání.
Returns
Přidaný nůž.
Připravte se na T1>()
Získejte všechny dětské uzliny podle typu uzlů.
public IList<t1> GetChildNodes<t1>() where T1 : Node
Returns
Seznam dětských uzlin.
Typy parametrů
T1
Typ prvků v vráceném seznamu.
GetEnumerator()
Vrátí výpisník, který iteruje prostřednictvím dětských uzlin Aspose.Note.Notebook.
public IEnumerator<inotebookchildnode> GetEnumerator()
Returns
IEnumerator < INotebookChildNode >
Sbírka snímků - IENUMERATOR
LoadChildDocument(Stringová)
Přidejte dětský dokument.Otevře existující dokument OneNote z souboru.
public void LoadChildDocument(string filePath)
Parameters
filePath
string
Původní cestou souboru.
Examples
Ukazuje, jak nabít notebook z toku.
// The path to the documents directory.
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 a LoadOptions)
Přidejte dětský dokument.Otevře existující dokument OneNote z souboru. umožňuje specifikovat další možnosti nabití.
public void LoadChildDocument(string filePath, LoadOptions loadOptions)
Parameters
filePath
string
Původní cestou souboru.
loadOptions
LoadOptions
Možnosti nabíjen.
LoadChildDocument(Stream)
Přidejte dětský dokument.Otevře existující dokument OneNote z toku.
public void LoadChildDocument(Stream stream)
Parameters
stream
Stream
To je proud.
Examples
Ukazuje, jak nabít notebook z toku.
// The path to the documents directory.
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(Přenos, LoadOptions)
Přidejte dětský dokument.Otevře existující dokument OneNote z toku. umožňuje specifikovat další možnosti nabíjení.
public void LoadChildDocument(Stream stream, LoadOptions loadOptions)
Parameters
stream
Stream
To je proud.
loadOptions
LoadOptions
Možnosti nabíjen.
LoadChildNotebook(Stringová)
Přidejte dětský notebook.Otevře se stávající notebook OneNote z souboru.
public void LoadChildNotebook(string filePath)
Parameters
filePath
string
Původní cestou souboru.
LoadChildNotebook(Třída, NotebookLoadOptions)
Přidejte dětský notebook.Otevře se stávající notebook OneNote z souboru. umožňuje specifikovat další možnosti nabití.
public void LoadChildNotebook(string filePath, NotebookLoadOptions loadOptions)
Parameters
filePath
string
Původní cestou souboru.
loadOptions
NotebookLoadOptions
Možnosti nabíjen.
LoadChildNotebook(Stream)
Přidejte dětský notebook.Otevře se stávající notebook OneNote z toku.
public void LoadChildNotebook(Stream stream)
Parameters
stream
Stream
To je proud.
LoadChildNotebook(Přenos, NotebookLoadOptions)
Přidejte dětský notebook.Otevře stávající notebook OneNote z toku. Umožňuje specifikovat další možnosti nabíjení.
public void LoadChildNotebook(Stream stream, NotebookLoadOptions loadOptions)
Parameters
stream
Stream
To je proud.
loadOptions
NotebookLoadOptions
Možnosti nabíjen.
RemoveChild(Úvodní stránkaChildNode)
Odstraňte dětský nůž.
public INotebookChildNode RemoveChild(INotebookChildNode oldChild)
Parameters
oldChild
INotebookChildNode
Nůž k odstranění.
Returns
Odstraněný nůž
Examples
Ukazuje, jak získat přístup ke všem sekcím z notebooku.
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);
}</document></document>
Ukazuje, jak odstranit část z notebooku.
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_NoteBook();
// Load a OneNote Notebook
var notebook = new Notebook(dataDir + "test.onetoc2");
// Traverse through its child nodes for searching the desired child item
foreach (var child in new List<inotebookchildnode>(notebook))
{
if (child.DisplayName == "Remove Me")
{
// Remove the Child Item from the Notebook
notebook.RemoveChild(child);
}
}
dataDir = dataDir + "RemoveChildNode_out.onetoc2";
// Save the Notebook
notebook.Save(dataDir);</inotebookchildnode>
Ukáže, jak zachránit notebook.
// The path to the documents directory.
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 + "Not Locked_out.one");
var childDocument1 = notebook[1] as Document;
childDocument1.Save(dataDir + "Locked Pass1_out.one", new OneSaveOptions() { DocumentPassword = "pass" });
var childDocument2 = notebook[2] as Document;
childDocument2.Save(dataDir + "Locked Pass2_out.one", new OneSaveOptions() { DocumentPassword = "pass2" });
}
Save(Stringová)
Uloží dokument OneNote do souboru.
public void Save(string fileName)
Parameters
fileName
string
Úplné jméno souboru.Jestliže soubory s uvedeným úplným jménem již existují, je stávající Soubor přepsaný.
Exceptions
IncorrectDocumentStructureException
Struktura dokumentu porušuje specifikace.
UnsupportedSaveFormatException
Vyžádaný formát není podporován.
Save(Stream)
Uloží dokument OneNote do toku.
public void Save(Stream stream)
Parameters
stream
Stream
To je proud.
Exceptions
IncorrectDocumentStructureException
Struktura dokumentu porušuje specifikace.
UnsupportedSaveFormatException
Vyžádaný formát není podporován.
Save(Shrnutí, SaveFormat)
Uloží dokument OneNote do souboru ve stanoveném formátu.
public void Save(string fileName, SaveFormat format)
Parameters
fileName
string
Úplné jméno souboru.Jestliže soubory s uvedeným úplným jménem již existují, je stávající Soubor přepsaný.
format
SaveFormat
Formát, ve kterém doklad uložit.
Exceptions
IncorrectDocumentStructureException
Struktura dokumentu porušuje specifikace.
UnsupportedSaveFormatException
Vyžádaný formát není podporován.
Save(Přenos, SaveFormat)
Uloží dokument OneNote do toku ve stanoveném formátu.
public void Save(Stream stream, SaveFormat format)
Parameters
stream
Stream
To je proud.
format
SaveFormat
Formát, ve kterém doklad uložit.
Exceptions
IncorrectDocumentStructureException
Struktura dokumentu porušuje specifikace.
UnsupportedSaveFormatException
Vyžádaný formát není podporován.
Save(Třída, NotebookSaveOptions)
Uloží dokument OneNote do souboru pomocí nastavených možností ušetření.
public void Save(string fileName, NotebookSaveOptions options)
Parameters
fileName
string
Úplné jméno souboru.Jestliže soubory s uvedeným úplným jménem již existují, je stávající Soubor přepsaný.
options
NotebookSaveOptions
Určuje možnosti, jak je dokument uložen v souboru.
Exceptions
IncorrectDocumentStructureException
Struktura dokumentu porušuje specifikace.
UnsupportedSaveFormatException
Vyžádaný formát není podporován.
Save(Přenos, NotebookSaveOptions)
Ušetří dokument OneNote do toku pomocí nastavených možností ušetření.
public void Save(Stream stream, NotebookSaveOptions options)
Parameters
stream
Stream
To je proud.
options
NotebookSaveOptions
Určuje možnosti, jak je dokument uložen.
Exceptions
IncorrectDocumentStructureException
Struktura dokumentu porušuje specifikace.
UnsupportedSaveFormatException
Vyžádaný formát není podporován.