Class Notebook
Името на пространството: Aspose.Note Асамблея: Aspose.Note.dll (25.4.0)
Представлява Aspose.Note ноутбук.
public class Notebook : INotebookChildNode, IEnumerable<inotebookchildnode>, IEnumerable
Inheritance
Implements
INotebookChildNode
,
IEnumerable
наследници
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
Показва как да се спести ноутбук.
// 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);
Показва как да се съхранява ноутбук в 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);
Показва как да се съхранява ноутбук като изображение.
// 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);
Показва как да получите целия текст от ноутбук.
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>
Показва как да се съхранява флатентният ноутбук в 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
});
Показва как да се итерира чрез документи на ноутбук, които ги зареждат лазливо.
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>
Показва как да добавите нов раздел към ноутбук.
// 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);
Показва как да зареждате лаптопа от поток.
// 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");
Показва как да се създаде зашифрован ноутбук.
// 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" });
Показва как да се съхранява ноутбук като изображение с определени опции.
// 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);
Показва как да се съхранява флатени лаптопи като изображение.
// 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);
Показва как да премахнете секция от ноутбук.
// 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>
Показва как да се итерира чрез предварително заредени документи на ноутбук.
// 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>
Показва как да преминете през съдържанието на ноутбук.
// 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()
Иницијализира нова инстанция на класата Aspose.Note.Notebook.
public Notebook()
Notebook(Стрий)
Иницијализира нова инстанция на класата Aspose.Note.Notebook.Отворете съществуващ OneNote ноутбук от файл.
public Notebook(string filePath)
Parameters
filePath
string
Пътят на файла.
Notebook(Заглавие: NotebookLoadOptions)
Иницијализира нова инстанция на класата Aspose.Note.Notebook.Отворете съществуващ OneNote ноутбук от файл. позволява да се посочат допълнителни опции като стратегия за зареждане на деца (“лази” / Instant).
public Notebook(string filePath, NotebookLoadOptions loadOptions)
Parameters
filePath
string
Пътят на файла.
loadOptions
NotebookLoadOptions
Опции за натоварване.
Notebook(Stream)
Иницијализира нова инстанция на класата Aspose.Note.Notebook.Отворете съществуващ OneNote ноутбук от поток.
public Notebook(Stream stream)
Parameters
stream
Stream
на потока .
Notebook(Изтегляне, NotebookLoadOptions)
Иницијализира нова инстанция на класата Aspose.Note.Notebook.Отворете съществуващ OneNote ноутбук от потока. позволява да се посочат допълнителни опции за зареждане.
public Notebook(Stream stream, NotebookLoadOptions loadOptions)
Parameters
stream
Stream
на потока .
loadOptions
NotebookLoadOptions
Опции за натоварване.
Properties
Color
Вземете или поставете цвета.
public Color Color { get; set; }
стойност на имота
Count
Получава броя на елементите, съдържащи се в Aspose.Note.Notebook.
public int Count { get; }
стойност на имота
DisplayName
Получава или поставя името на дисплея.
public string DisplayName { get; set; }
стойност на имота
Examples
Показва как да премахнете секция от ноутбук.
// 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
Получаване на файлов формат (OneNote 2010, OneNota Online).
public FileFormat FileFormat { get; }
стойност на имота
Guid
Получава уникалния световен идентификатор на обекта.
public Guid Guid { get; }
стойност на имота
IsHistoryEnabled
Получава или задава стойност, която показва дали историята е включена.
public bool IsHistoryEnabled { get; set; }
стойност на имота
Това[инт]
Получава детски ноутбук от дадения индекс.
public INotebookChildNode this[int index] { get; }
стойност на имота
Methods
AppendChild(ИзображениеChildNode)
Добавете бутона до края на списъка.
public INotebookChildNode AppendChild(INotebookChildNode newChild)
Parameters
newChild
INotebookChildNode
Нодът трябва да се добави.
Returns
Добавяне на възел.
Изтегляне на данни()
Получете всички детски възли според вида на възлите.
public IList<t1> GetChildNodes<t1>() where T1 : Node
Returns
Списък на детските възли.
Типове параметри
T1
Типът на елементите в връщания списък.
GetEnumerator()
Повръща списък, който итерира през детските възли на Aspose.Note.Notebook.
public IEnumerator<inotebookchildnode> GetEnumerator()
Returns
IEnumerator < INotebookChildNode >
Една система. колекции. IEnumerator
LoadChildDocument(Стрий)
Добавете детски документ.Отворете съществуващ документ на OneNote от файл.
public void LoadChildDocument(string filePath)
Parameters
filePath
string
Пътят на файла.
Examples
Показва как да зареждате лаптопа от поток.
// 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(Стринг, опции за натоварване)
Добавете детски документ.Отворете съществуващ документ на OneNote от файл. позволява да се посочат допълнителни опции за зареждане.
public void LoadChildDocument(string filePath, LoadOptions loadOptions)
Parameters
filePath
string
Пътят на файла.
loadOptions
LoadOptions
Опции за натоварване.
LoadChildDocument(Stream)
Добавете детски документ.Отворете съществуващ документ на OneNote от поток.
public void LoadChildDocument(Stream stream)
Parameters
stream
Stream
на потока .
Examples
Показва как да зареждате лаптопа от поток.
// 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(Изтегляне, LoadOptions)
Добавете детски документ.Отворете съществуващ документ на OneNote от поток. позволява да се посочат допълнителни опции за зареждане.
public void LoadChildDocument(Stream stream, LoadOptions loadOptions)
Parameters
stream
Stream
на потока .
loadOptions
LoadOptions
Опции за натоварване.
LoadChildNotebook(Стрий)
Добавете детски ноутбук.Отворете съществуващ OneNote ноутбук от файл.
public void LoadChildNotebook(string filePath)
Parameters
filePath
string
Пътят на файла.
LoadChildNotebook(Заглавие: NotebookLoadOptions)
Добавете детски ноутбук.Отворете съществуващ OneNote ноутбук от файл. позволява да се посочат допълнителни опции за зареждане.
public void LoadChildNotebook(string filePath, NotebookLoadOptions loadOptions)
Parameters
filePath
string
Пътят на файла.
loadOptions
NotebookLoadOptions
Опции за натоварване.
LoadChildNotebook(Stream)
Добавете детски ноутбук.Отворете съществуващ OneNote ноутбук от поток.
public void LoadChildNotebook(Stream stream)
Parameters
stream
Stream
на потока .
LoadChildNotebook(Изтегляне, NotebookLoadOptions)
Добавете детски ноутбук.Отворете съществуващ OneNote ноутбук от потока. позволява да се посочат допълнителни опции за зареждане.
public void LoadChildNotebook(Stream stream, NotebookLoadOptions loadOptions)
Parameters
stream
Stream
на потока .
loadOptions
NotebookLoadOptions
Опции за натоварване.
RemoveChild(ИзображениеChildNode)
Премахване на детския възел.
public INotebookChildNode RemoveChild(INotebookChildNode oldChild)
Parameters
oldChild
INotebookChildNode
Нодът да се премахне.
Returns
Изтеглената нишка.
Examples
Показва как да получите достъп до всички секции от ноутбук.
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>
Показва как да премахнете секция от ноутбук.
// 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>
Показва как да се спести ноутбук.
// 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(Стрий)
Съхранява OneNote документ в файл.
public void Save(string fileName)
Parameters
fileName
string
Ако файл с посоченото пълно име вече съществува, съществуващият файл се надписва.
Exceptions
IncorrectDocumentStructureException
Структурата на документа нарушава спецификацията.
UnsupportedSaveFormatException
Заявеният формат за съхранение не се поддържа.
Save(Stream)
Съхранява документа на OneNote в поток.
public void Save(Stream stream)
Parameters
stream
Stream
на потока .
Exceptions
IncorrectDocumentStructureException
Структурата на документа нарушава спецификацията.
UnsupportedSaveFormatException
Заявеният формат за съхранение не се поддържа.
Save(Стъпка, SaveFormat)
Съхранява документа на OneNote към файл в посочения формат.
public void Save(string fileName, SaveFormat format)
Parameters
fileName
string
Ако файл с посоченото пълно име вече съществува, съществуващият файл се надписва.
format
SaveFormat
Форматът, в който да се съхранява документа.
Exceptions
IncorrectDocumentStructureException
Структурата на документа нарушава спецификацията.
UnsupportedSaveFormatException
Заявеният формат за съхранение не се поддържа.
Save(Изтегляне, SaveFormat)
Съхранява документа на OneNote в потока в посочения формат.
public void Save(Stream stream, SaveFormat format)
Parameters
stream
Stream
на потока .
format
SaveFormat
Форматът, в който да се съхранява документа.
Exceptions
IncorrectDocumentStructureException
Структурата на документа нарушава спецификацията.
UnsupportedSaveFormatException
Заявеният формат за съхранение не се поддържа.
Save(Заглавие: NotebookSaveOptions)
Съхранява документа на OneNote към файл, като използва определените опции за съхранение.
public void Save(string fileName, NotebookSaveOptions options)
Parameters
fileName
string
Ако файл с посоченото пълно име вече съществува, съществуващият файл се надписва.
options
NotebookSaveOptions
Определя опциите за това как документът се съхранява в файла.
Exceptions
IncorrectDocumentStructureException
Структурата на документа нарушава спецификацията.
UnsupportedSaveFormatException
Заявеният формат за съхранение не се поддържа.
Save(Изтегляне, NotebookSaveOptions)
Съхранява документа на OneNote в поток, като използва определените опции за съхранение.
public void Save(Stream stream, NotebookSaveOptions options)
Parameters
stream
Stream
на потока .
options
NotebookSaveOptions
Определя опциите за това как се съхранява документа.
Exceptions
IncorrectDocumentStructureException
Структурата на документа нарушава спецификацията.
UnsupportedSaveFormatException
Заявеният формат за съхранение не се поддържа.