Class Notebook

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
{
    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

object Notebook

Implements

INotebookChildNode , IEnumerable , 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

string dataDir = RunExamples.GetDataDir_NoteBook();
   var notebook = new Notebook();
   dataDir += "test_out.onetoc2";
   notebook.Save(dataDir);

Hiển thị làm thế nào để lưu sổ tay trong định dạng PDF.

string dataDir = RunExamples.GetDataDir_NoteBook();
   var notebook = new Notebook(dataDir + "Notizbuch Öffnen.onetoc2");
   dataDir += "ConvertToPDF_out.pdf";
   notebook.Save(dataDir);

Hiển thị làm thế nào để lưu notebook như một hình ảnh.

string dataDir = RunExamples.GetDataDir_NoteBook();
   var notebook = new Notebook(dataDir + "Notizbuch Öffnen.onetoc2");
   dataDir += "ConvertToImage_out.png";
   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);
   }

Hiển thị làm thế nào để lưu sổ ghi chép mờ trong định dạng 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
       });

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();
   Notebook notebook = new Notebook(dataDir + inputFile);
   foreach (var notebookChildNode in notebook.OfType<Document>())
   {
   }

Hiển thị cách thêm phần mới vào một sổ ghi chép.

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);

Hiển thị cách tải sổ ghi chép từ một dòng.

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.

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ể.

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);

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.

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);

Hiển thị cách loại bỏ một phần từ một máy tính xách tay.

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);

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.

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>())
   {
   }

Hiển thị cách thông qua nội dung của một sổ ghi chép.

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

Bản ghi ( )

Bắt đầu một trường hợp mới của lớp Aspose.Note.Notebook.

public Notebook()
   {
   }

Bản ghi (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.

Máy tính xách tay (string, 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.

Bản ghi (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 class Notebook
   {
      public Notebook(Stream stream)
      {
      }
   }

Parameters

stream Stream

dòng chảy

Máy tính xách tay (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
      {
         return this.Color;
      }
      set
      {
         this.Color = value;
      }
   }

Giá trị bất động sản

Color

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

int

DisplayName

Nhận hoặc đặt tên hiển thị.

public string DisplayName
   {
      get;
      set;
   }

Giá trị bất động sản

string

Examples

Hiển thị cách loại bỏ một phần từ một máy tính xách tay.

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

Nhận định dạng tệp (OneNote 2010, OneNota Online).

public FileFormat FileFormat
   {
      get;
   }

Giá trị bất động sản

FileFormat

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

Guid

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

bool

cái này[Ấn]

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

INotebookChildNode

Methods

Bản mẫu (INotebookChildNode)

Thêm nút vào cuối danh sách.

public INotebookChildNode AppendChild(INotebookChildNode newChild)
   {
      return _notebook.AppendChild(newChild);
   }

Parameters

newChild INotebookChildNode

Node để thêm.

Returns

INotebookChildNode

thêm node.

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

IList

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ề.

Đánh giá ( )

Quay lại một số mà iterate thông qua các nút trẻ em của Aspose.Note.Notebook.

public IEnumerator<notebookchildnode> GetEnumerator()
   {
   }

Returns

IEnumerator < INotebookChildNode >

Một hệ thống.Collections.IEnumerator

Tài liệu 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.

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(tring, LoatOptions)

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, Aspose.Words.LoadOptions loadOptions)
   {
   }

Parameters

filePath string

đường file.

loadOptions LoadOptions

Các tùy chọn tải.

Tài liệu 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.

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, LoatOptions)

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 (nghĩa đơn)

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(tring, 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.

Tải về 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.

Tải về (INotebookChildNode)

Xóa nút trẻ em.

public INotebookChildNode RemoveChild(INotebookChildNode oldChild)
   {
   }

Parameters

oldChild INotebookChildNode

nút để loại bỏ.

Returns

INotebookChildNode

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);
   }

Hiển thị cách loại bỏ một phần từ một máy tính xách tay.

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);

Hiển thị cách tiết kiệm một sổ ghi chép

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" });
   }

Tiết kiệm ( 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ợ.

Cung cấp ( 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ợ.

Lưu trữ (string, 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, Aspose.Words.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ợ.

Tải về (SaveFormat, Stream)

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(string, 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ợ.

 Tiếng Việt