Class Notebook
ชื่อพื้นที่: Aspose.Note การประกอบ: Aspose.Note.dll (25.4.0)
แสดงให้เห็น Aspose.Note notebook
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);
แสดงวิธีรับข้อความทั้งหมดจาก notebook
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>
แสดงวิธีการบันทึก notebook flattened ในรูปแบบ 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
});
แสดงให้เห็นว่าวิธีการ iterate ผ่านเอกสารของแล็ปท็อปโหลดพวกเขาได้อย่างราบรื่น
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>
แสดงวิธีเพิ่มส่วนใหม่ไปยัง notebook
// 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);
แสดงวิธีการลบส่วนจาก noteboot
// 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>
แสดงวิธีการ iterate ผ่านเอกสารที่ดาวน์โหลดก่อนของ notebook
// 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>
แสดงวิธีการผ่านเนื้อหาของ notebook
// 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เปิด notebook ของ OneNote ที่มีอยู่จากไฟล์
public Notebook(string filePath)
Parameters
filePath
string
เส้นทางไฟล์
Notebook(ลวด, NotebookLoadOptions)
เปิดตัวตัวอย่างใหม่ของคลาส Aspose.Note.Notebookเปิด Notebook OneNote ที่มีอยู่จากไฟล์ ช่วยให้คุณสามารถระบุตัวเลือกเพิ่มเติมเช่นกลยุทธ์การโหลดสําหรับเด็ก ( “Lazy” / Instant)
public Notebook(string filePath, NotebookLoadOptions loadOptions)
Parameters
filePath
string
เส้นทางไฟล์
loadOptions
NotebookLoadOptions
ตัวเลือกโหลด
Notebook(Stream)
เปิดตัวตัวอย่างใหม่ของคลาส Aspose.Note.Notebookเปิด Notebook OneNote ที่มีอยู่จาก Stream
public Notebook(Stream stream)
Parameters
stream
Stream
กระแส
Notebook(กระแส, NotebookLoadOptions)
เปิดตัวตัวอย่างใหม่ของคลาส Aspose.Note.Notebookเปิด Notebook OneNote ที่มีอยู่จาก Stream ช่วยให้คุณระบุตัวเลือกการโหลดเพิ่มเติม
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
แสดงวิธีการลบส่วนจาก noteboot
// 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
รับ ID วัตถุที่ไม่ซ้ํากันทั่วโลก
public Guid Guid { get; }
คุณสมบัติมูลค่า
IsHistoryEnabled
รับหรือตั้งค่าหมายเหตุว่าประวัติจะเปิดใช้งานหรือไม่
public bool IsHistoryEnabled { get; set; }
คุณสมบัติมูลค่า
นี่[int]
รับโน๊ตโน้ตเด็กตามดัชนีที่กําหนด
public INotebookChildNode this[int index] { get; }
คุณสมบัติมูลค่า
Methods
AppendChild(INotebookChildNode)
เพิ่ม node ไปยังปลายรายการ
public INotebookChildNode AppendChild(INotebookChildNode newChild)
Parameters
newChild
INotebookChildNode
ปุ่มที่จะเพิ่ม
Returns
หมายเลขที่เพิ่ม
GetChildNodes()
รับ nodes ของเด็กทั้งหมดตามชนิดของ node
public IList<t1> GetChildNodes<t1>() where T1 : Node
Returns
รายการของช่องคลอดเด็ก
ประเภทพารามิเตอร์
T1
ประเภทขององค์ประกอบในรายการที่กลับมา
GetEnumerator()
กลับตัวเลขที่ยึดผ่านช่องเด็กของ Aspose.Note.Notebook
public IEnumerator<inotebookchildnode> GetEnumerator()
Returns
IEnumerator < INotebookChildNode >
A System.Collections.IEnumerator
LoadChildDocument(รั้ว)
เพิ่ม node ของเอกสารเด็กเปิดเอกสาร 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(ลวด, LoadOptions)
เพิ่ม node ของเอกสารเด็กเปิดเอกสาร OneNote ที่มีอยู่จากไฟล์ ช่วยให้คุณระบุตัวเลือกโหลดเพิ่มเติม
public void LoadChildDocument(string filePath, LoadOptions loadOptions)
Parameters
filePath
string
เส้นทางไฟล์
loadOptions
LoadOptions
ตัวเลือกโหลด
LoadChildDocument(Stream)
เพิ่ม node ของเอกสารเด็กเปิดเอกสาร OneNote ที่มีอยู่จาก Stream
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)
เพิ่ม node ของเอกสารเด็กเปิดเอกสาร OneNote ที่มีอยู่จาก Stream ช่วยให้คุณระบุตัวเลือกโหลดเพิ่มเติม
public void LoadChildDocument(Stream stream, LoadOptions loadOptions)
Parameters
stream
Stream
กระแส
loadOptions
LoadOptions
ตัวเลือกโหลด
LoadChildNotebook(รั้ว)
เพิ่มน็อตโน้ตเด็กเปิด notebook ของ OneNote ที่มีอยู่จากไฟล์
public void LoadChildNotebook(string filePath)
Parameters
filePath
string
เส้นทางไฟล์
LoadChildNotebook(ลวด, NotebookLoadOptions)
เพิ่มน็อตโน้ตเด็กเปิด Notebook OneNote ที่มีอยู่จากไฟล์ ช่วยให้คุณระบุตัวเลือกโหลดเพิ่มเติม
public void LoadChildNotebook(string filePath, NotebookLoadOptions loadOptions)
Parameters
filePath
string
เส้นทางไฟล์
loadOptions
NotebookLoadOptions
ตัวเลือกโหลด
LoadChildNotebook(Stream)
เพิ่มน็อตโน้ตเด็กเปิด Notebook OneNote ที่มีอยู่จาก Stream
public void LoadChildNotebook(Stream stream)
Parameters
stream
Stream
กระแส
LoadChildNotebook(กระแส, NotebookLoadOptions)
เพิ่มน็อตโน้ตเด็กเปิด Notebook ของ OneNote ที่มีอยู่จาก Stream ช่วยให้คุณระบุตัวเลือกโหลดเพิ่มเติม
public void LoadChildNotebook(Stream stream, NotebookLoadOptions loadOptions)
Parameters
stream
Stream
กระแส
loadOptions
NotebookLoadOptions
ตัวเลือกโหลด
RemoveChild(INotebookChildNode)
ลบปุ่มเด็ก
public INotebookChildNode RemoveChild(INotebookChildNode oldChild)
Parameters
oldChild
INotebookChildNode
ปุ่มที่จะลบ
Returns
หมายเลขที่ถอดออก
Examples
แสดงวิธีการเข้าถึงส่วนทั้งหมดจาก notebook
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>
แสดงวิธีการลบส่วนจาก noteboot
// 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
รูปแบบบันทึกที่ต้องการไม่ได้รับการสนับสนุน