Class Notebook
Tên không gian: Aspose.Note Tổng hợp: Aspose.Note.dll (25.4.0)
Có một máy tính xách tay Aspose.Note.
public class Notebook : INotebookChildNode, IEnumerable<inotebookchildnode>, IEnumerable
Inheritance
Implements
INotebookChildNode
,
IEnumerable
Thành viên thừa kế
object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()
Examples
Hiển thị cách tiết kiệm 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);
Hiển thị làm thế nào để lưu sổ tay trong định dạng 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);
Hiển thị làm thế nào để lưu notebook như một hình ảnh.
// 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);
Hiển thị làm thế nào để có được tất cả các văn bản từ một sổ tay.
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>
Hiển thị làm thế nào để lưu sổ ghi chép mờ trong định dạng 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
});
Hiển thị làm thế nào để iterate thông qua các tài liệu của một máy tính xách tay tải chúng nhẹ nhàng.
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>
Hiển thị cách thêm phần mới vào một sổ ghi chép.
// 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);
Hiển thị cách tải sổ ghi chép từ một dòng.
// 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");
Hiển thị làm thế nào để một máy tính xách tay mã hóa.
// 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" });
Hiển thị cách lưu máy tính xách tay như một hình ảnh với các tùy chọn cụ thể.
// 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);
Hiển thị làm thế nào để tiết kiệm máy tính xách tay mờ như một hình ảnh.
// 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);
Hiển thị cách loại bỏ một phần từ một máy tính xách tay.
// 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>
Hiển thị cách iterate thông qua các tài liệu tải về trước của một máy tính xách tay.
// 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>
Hiển thị cách thông qua nội dung của một sổ ghi chép.
// 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()
Bắt đầu một trường hợp mới của lớp Aspose.Note.Notebook.
public Notebook()
Notebook(String)
Bắt đầu một trường hợp mới của lớp Aspose.Note.Notebook.Mở một sổ ghi chép OneNote hiện có từ một tệp.
public Notebook(string filePath)
Parameters
filePath
string
đường file.
Notebook(Lời bài hát: NotebookLoadOptions)
Bắt đầu một trường hợp mới của lớp Aspose.Note.Notebook.Mở một sổ ghi chép OneNote hiện có từ một tệp. cho phép xác định các tùy chọn bổ sung như một chiến lược tải trẻ em (“lazy” / ngay lập tức).
public Notebook(string filePath, NotebookLoadOptions loadOptions)
Parameters
filePath
string
đường file.
loadOptions
NotebookLoadOptions
Các tùy chọn tải.
Notebook(Stream)
Bắt đầu một trường hợp mới của lớp Aspose.Note.Notebook.Mở một sổ ghi chép OneNote hiện có từ một dòng.
public Notebook(Stream stream)
Parameters
stream
Stream
dòng chảy
Notebook(Stream, NotebookLoadOptions)
Bắt đầu một trường hợp mới của lớp Aspose.Note.Notebook.Mở một sổ ghi chép OneNote hiện có từ một dòng. cho phép xác định các tùy chọn tải thêm.
public Notebook(Stream stream, NotebookLoadOptions loadOptions)
Parameters
stream
Stream
dòng chảy
loadOptions
NotebookLoadOptions
Các tùy chọn tải.
Properties
Color
Nhận hoặc đặt màu sắc.
public Color Color { get; set; }
Giá trị bất động sản
Count
Nhận số lượng các yếu tố chứa trong Aspose.Note.Notebook.
public int Count { get; }
Giá trị bất động sản
DisplayName
Nhận hoặc đặt tên hiển thị.
public string DisplayName { get; set; }
Giá trị bất động sản
Examples
Hiển thị cách loại bỏ một phần từ một máy tính xách tay.
// 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
Nhận định dạng tệp (OneNote 2010, OneNota Online).
public FileFormat FileFormat { get; }
Giá trị bất động sản
Guid
Nhận ID độc đáo toàn cầu của đối tượng.
public Guid Guid { get; }
Giá trị bất động sản
IsHistoryEnabled
Nhận hoặc đặt một giá trị cho thấy liệu lịch sử có được bật hay không.
public bool IsHistoryEnabled { get; set; }
Giá trị bất động sản
cái này[int]
Nó nhận được nút ghi chép trẻ em theo chỉ số đó.
public INotebookChildNode this[int index] { get; }
Giá trị bất động sản
Methods
AppendChild(Tin tứcChildNode)
Thêm nút vào cuối danh sách.
public INotebookChildNode AppendChild(INotebookChildNode newChild)
Parameters
newChild
INotebookChildNode
Node để thêm.
Returns
thêm node.
Tải về GetChildNodes()
Nhận tất cả các nút của trẻ theo loại nút.
public IList<t1> GetChildNodes<t1>() where T1 : Node
Returns
Một danh sách các nút trẻ em.
Loại Parameters
T1
Loại các yếu tố trong danh sách trả về.
GetEnumerator()
Quay lại một số mà iterate thông qua các nút trẻ em của Aspose.Note.Notebook.
public IEnumerator<inotebookchildnode> GetEnumerator()
Returns
IEnumerator < INotebookChildNode >
Một hệ thống.Collections.IEnumerator
LoadChildDocument(String)
Thêm một nút tài liệu trẻ em.Mở một tài liệu OneNote hiện có từ một tệp.
public void LoadChildDocument(string filePath)
Parameters
filePath
string
đường file.
Examples
Hiển thị cách tải sổ ghi chép từ một dòng.
// 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, LoadOptions)
Thêm một nút tài liệu trẻ em.Mở một tài liệu OneNote hiện có từ một tệp. cho phép xác định các tùy chọn tải thêm.
public void LoadChildDocument(string filePath, LoadOptions loadOptions)
Parameters
filePath
string
đường file.
loadOptions
LoadOptions
Các tùy chọn tải.
LoadChildDocument(Stream)
Thêm một nút tài liệu trẻ em.Mở một tài liệu OneNote hiện có từ một dòng.
public void LoadChildDocument(Stream stream)
Parameters
stream
Stream
dòng chảy
Examples
Hiển thị cách tải sổ ghi chép từ một dòng.
// 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, LoadOptions)
Thêm một nút tài liệu trẻ em.Mở tài liệu OneNote hiện có từ một dòng. cho phép xác định các tùy chọn tải thêm.
public void LoadChildDocument(Stream stream, LoadOptions loadOptions)
Parameters
stream
Stream
dòng chảy
loadOptions
LoadOptions
Các tùy chọn tải.
LoadChildNotebook(String)
Thêm một nút notebook trẻ em.Mở một sổ ghi chép OneNote hiện có từ một tệp.
public void LoadChildNotebook(string filePath)
Parameters
filePath
string
đường file.
LoadChildNotebook(Lời bài hát: NotebookLoadOptions)
Thêm một nút notebook trẻ em.Mở một sổ ghi chép OneNote hiện có từ một tệp. cho phép xác định các tùy chọn tải thêm.
public void LoadChildNotebook(string filePath, NotebookLoadOptions loadOptions)
Parameters
filePath
string
đường file.
loadOptions
NotebookLoadOptions
Các tùy chọn tải.
LoadChildNotebook(Stream)
Thêm một nút notebook trẻ em.Mở một sổ ghi chép OneNote hiện có từ một dòng.
public void LoadChildNotebook(Stream stream)
Parameters
stream
Stream
dòng chảy
LoadChildNotebook(Stream, NotebookLoadOptions)
Thêm một nút notebook trẻ em.Mở một sổ ghi chép OneNote hiện có từ một dòng. cho phép xác định các tùy chọn tải thêm.
public void LoadChildNotebook(Stream stream, NotebookLoadOptions loadOptions)
Parameters
stream
Stream
dòng chảy
loadOptions
NotebookLoadOptions
Các tùy chọn tải.
RemoveChild(Tin tứcChildNode)
Xóa nút trẻ em.
public INotebookChildNode RemoveChild(INotebookChildNode oldChild)
Parameters
oldChild
INotebookChildNode
nút để loại bỏ.
Returns
Node bị loại bỏ.
Examples
Hiển thị cách truy cập tất cả các phần từ một máy tính xách tay.
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>
Hiển thị cách loại bỏ một phần từ một máy tính xách tay.
// 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>
Hiển thị cách tiết kiệm một sổ ghi chép
// 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(String)
Lưu tài liệu OneNote vào một tệp.
public void Save(string fileName)
Parameters
fileName
string
Nếu một tệp có tên đầy đủ đã tồn tại, file hiện có sẽ được viết quá.
Exceptions
IncorrectDocumentStructureException
cấu trúc tài liệu vi phạm các thông số kỹ thuật.
UnsupportedSaveFormatException
Định dạng lưu yêu cầu không được hỗ trợ.
Save(Stream)
Tiết kiệm tài liệu OneNote cho một dòng.
public void Save(Stream stream)
Parameters
stream
Stream
dòng chảy
Exceptions
IncorrectDocumentStructureException
cấu trúc tài liệu vi phạm các thông số kỹ thuật.
UnsupportedSaveFormatException
Định dạng lưu yêu cầu không được hỗ trợ.
Save(Nhãn hiệu: SaveFormat)
Lưu tài liệu OneNote vào một tệp trong định dạng cụ thể.
public void Save(string fileName, SaveFormat format)
Parameters
fileName
string
Nếu một tệp có tên đầy đủ đã tồn tại, file hiện có sẽ được viết quá.
format
SaveFormat
Định dạng trong đó để lưu tài liệu.
Exceptions
IncorrectDocumentStructureException
cấu trúc tài liệu vi phạm các thông số kỹ thuật.
UnsupportedSaveFormatException
Định dạng lưu yêu cầu không được hỗ trợ.
Save(Thông tin, SaveFormat)
Lưu tài liệu OneNote vào một dòng trong định dạng cụ thể.
public void Save(Stream stream, SaveFormat format)
Parameters
stream
Stream
dòng chảy
format
SaveFormat
Định dạng trong đó để lưu tài liệu.
Exceptions
IncorrectDocumentStructureException
cấu trúc tài liệu vi phạm các thông số kỹ thuật.
UnsupportedSaveFormatException
Định dạng lưu yêu cầu không được hỗ trợ.
Save(Thẻ, NotebookSaveOptions)
Lưu tài liệu OneNote vào một tệp bằng cách sử dụng các tùy chọn lưu được chỉ định.
public void Save(string fileName, NotebookSaveOptions options)
Parameters
fileName
string
Nếu một tệp có tên đầy đủ đã tồn tại, file hiện có sẽ được viết quá.
options
NotebookSaveOptions
Cài đặt các tùy chọn làm thế nào tài liệu được lưu trong tệp.
Exceptions
IncorrectDocumentStructureException
cấu trúc tài liệu vi phạm các thông số kỹ thuật.
UnsupportedSaveFormatException
Định dạng lưu yêu cầu không được hỗ trợ.
Save(Stream, NotebookSaveOptions)
Lưu tài liệu OneNote cho một dòng bằng cách sử dụng các tùy chọn lưu được chỉ định.
public void Save(Stream stream, NotebookSaveOptions options)
Parameters
stream
Stream
dòng chảy
options
NotebookSaveOptions
Cung cấp các tùy chọn làm thế nào tài liệu được lưu.
Exceptions
IncorrectDocumentStructureException
cấu trúc tài liệu vi phạm các thông số kỹ thuật.
UnsupportedSaveFormatException
Định dạng lưu yêu cầu không được hỗ trợ.