Class Notebook

Class Notebook

Nama dari : Aspose.Note Perhitungan: Aspose.Note.dll (25.4.0)

Ini adalah buku catatan Aspose.Note.

public class Notebook : INotebookChildNode, IEnumerable<inotebookchildnode>, IEnumerable

Inheritance

object Notebook

Implements

INotebookChildNode , IEnumerable , IEnumerable

anggota yang diwarisi

object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

Menunjukkan cara menyelamatkan 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);

Menunjukkan cara menyimpan notebook dalam format 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);

Menunjukkan cara menyimpan notebook sebagai gambar.

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

Menunjukkan bagaimana untuk mendapatkan semua teks dari 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>

Menunjukkan cara menyimpan notebook berlapis dalam format 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
                                                                  });

Menunjukkan bagaimana untuk iterasi melalui dokumen dari notebook yang mengisi mereka dengan lancar.

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>

Menunjukkan cara menambahkan bagian baru ke 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);

Menunjukkan cara mengisi notebook dari aliran.

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

Menunjukkan cara membuat notebook terenkripsi.

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

Menunjukkan cara menyimpan notebook sebagai gambar dengan opsi yang ditentukan.

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

Menunjukkan bagaimana untuk menyimpan notebook berlapis sebagai gambar.

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

Menunjukkan bagaimana untuk menghapus bagian dari notebook.

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

Menunjukkan cara iterasi melalui dokumen yang diunggah dari 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>

Menunjukkan bagaimana untuk melewati konten dari 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()

Initifikasi instansi baru dari kelas Aspose.Note.Notebook.

public Notebook()

Notebook(String)

Initifikasi instansi baru dari kelas Aspose.Note.Notebook.Buka notebook OneNote yang ada dari file.

public Notebook(string filePath)

Parameters

filePath string

jalur file tersebut.

Notebook(Keterangan, NotebookLoadOptions)

Initifikasi instansi baru dari kelas Aspose.Note.Notebook.Membuka notebook OneNote yang ada dari file. memungkinkan untuk menentukan opsi tambahan seperti strategi beban anak (“lazy” / instan).

public Notebook(string filePath, NotebookLoadOptions loadOptions)

Parameters

filePath string

jalur file tersebut.

loadOptions NotebookLoadOptions

dengan opsi beban.

Notebook(Stream)

Initifikasi instansi baru dari kelas Aspose.Note.Notebook.Buka notebook OneNote yang ada dari aliran.

public Notebook(Stream stream)

Parameters

stream Stream

dan aliran tersebut.

Notebook(Pengiriman, NotebookLoadOptions)

Initifikasi instansi baru dari kelas Aspose.Note.Notebook.Buka notebook OneNote yang ada dari aliran. memungkinkan untuk menentukan opsi muatan tambahan.

public Notebook(Stream stream, NotebookLoadOptions loadOptions)

Parameters

stream Stream

dan aliran tersebut.

loadOptions NotebookLoadOptions

dengan opsi beban.

Properties

Color

Dapatkan atau menetapkan warna.

public Color Color { get; set; }

Nilai Properti

Color

Count

Dapatkan jumlah elemen yang terkandung dalam Aspose.Note.Notebook.

public int Count { get; }

Nilai Properti

int

DisplayName

Dapatkan atau menetapkan nama tampilan.

public string DisplayName { get; set; }

Nilai Properti

string

Examples

Menunjukkan bagaimana untuk menghapus bagian dari notebook.

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

Dapatkan format file (OneNote 2010, OneNota Online).

public FileFormat FileFormat { get; }

Nilai Properti

FileFormat

Guid

Dapatkan identitas unik objek secara global.

public Guid Guid { get; }

Nilai Properti

Guid

IsHistoryEnabled

Dapatkan atau menetapkan nilai yang menunjukkan apakah sejarah diaktifkan.

public bool IsHistoryEnabled { get; set; }

Nilai Properti

bool

ini[int]

Mendapatkan notebook anak nod oleh indeks yang diberikan.

public INotebookChildNode this[int index] { get; }

Nilai Properti

INotebookChildNode

Methods

AppendChild(InovasiBahasa Inggeris)

Tambahkan node ke akhir daftar.

public INotebookChildNode AppendChild(INotebookChildNode newChild)

Parameters

newChild INotebookChildNode

Node untuk ditambahkan.

Returns

INotebookChildNode

Node yang ditambahkan.

Keterangan()

Dapatkan semua nod anak sesuai dengan jenis nod.

public IList<t1> GetChildNodes<t1>() where T1 : Node

Returns

IList

Daftar nodus anak.

Jenis Parameter

T1

Jenis elemen dalam daftar yang dikembalikan.

GetEnumerator()

Mengembalikan enumerator yang iterasi melalui nod anak dari Aspose.Note.Notebook.

public IEnumerator<inotebookchildnode> GetEnumerator()

Returns

IEnumerator dan lt; INotebookChildNode >

Menggunakan Sistem.Koleksi.IEnumerator

LoadChildDocument(String)

Menambahkan node dokumen anak.Buka dokumen OneNote yang ada dari file.

public void LoadChildDocument(string filePath)

Parameters

filePath string

jalur file tersebut.

Examples

Menunjukkan cara mengisi notebook dari aliran.

// 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 dan LoadOptions)

Menambahkan node dokumen anak.Buka dokumen OneNote yang ada dari file. memungkinkan untuk menentukan opsi muatan tambahan.

public void LoadChildDocument(string filePath, LoadOptions loadOptions)

Parameters

filePath string

jalur file tersebut.

loadOptions LoadOptions

dengan opsi beban.

LoadChildDocument(Stream)

Menambahkan node dokumen anak.Buka dokumen OneNote yang ada dari aliran.

public void LoadChildDocument(Stream stream)

Parameters

stream Stream

dan aliran tersebut.

Examples

Menunjukkan cara mengisi notebook dari aliran.

// 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(Perbedaan, LoadOptions)

Menambahkan node dokumen anak.Buka dokumen OneNote yang ada dari aliran. memungkinkan untuk menentukan opsi beban tambahan.

public void LoadChildDocument(Stream stream, LoadOptions loadOptions)

Parameters

stream Stream

dan aliran tersebut.

loadOptions LoadOptions

dengan opsi beban.

LoadChildNotebook(String)

Menambahkan buku catatan anak.Buka notebook OneNote yang ada dari file.

public void LoadChildNotebook(string filePath)

Parameters

filePath string

jalur file tersebut.

LoadChildNotebook(Keterangan, NotebookLoadOptions)

Menambahkan buku catatan anak.Buka notebook OneNote yang ada dari file. memungkinkan untuk menentukan opsi muatan tambahan.

public void LoadChildNotebook(string filePath, NotebookLoadOptions loadOptions)

Parameters

filePath string

jalur file tersebut.

loadOptions NotebookLoadOptions

dengan opsi beban.

LoadChildNotebook(Stream)

Menambahkan buku catatan anak.Buka notebook OneNote yang ada dari aliran.

public void LoadChildNotebook(Stream stream)

Parameters

stream Stream

dan aliran tersebut.

LoadChildNotebook(Pengiriman, NotebookLoadOptions)

Menambahkan buku catatan anak.Buka notebook OneNote yang ada dari aliran. memungkinkan untuk menentukan opsi beban tambahan.

public void LoadChildNotebook(Stream stream, NotebookLoadOptions loadOptions)

Parameters

stream Stream

dan aliran tersebut.

loadOptions NotebookLoadOptions

dengan opsi beban.

RemoveChild(InovasiBahasa Inggeris)

Menghilangkan nodus anak.

public INotebookChildNode RemoveChild(INotebookChildNode oldChild)

Parameters

oldChild INotebookChildNode

Node yang harus dihapus.

Returns

INotebookChildNode

Node yang dihapus.

Examples

Menunjukkan cara mengakses semua bagian dari 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>

Menunjukkan bagaimana untuk menghapus bagian dari notebook.

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

Menunjukkan cara menyimpan buku catatan.

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

Simpan dokumen OneNote ke file.

public void Save(string fileName)

Parameters

fileName string

Nama lengkap untuk file.Jika file dengan nama lengkap yang ditentukan sudah ada, file yang ada akan ditulis kembali.

Exceptions

IncorrectDocumentStructureException

Struktur dokumen melanggar spesifikasi.

UnsupportedSaveFormatException

Format penyimpanan yang diminta tidak didukung.

Save(Stream)

Simpan dokumen OneNote ke arus.

public void Save(Stream stream)

Parameters

stream Stream

dan aliran tersebut.

Exceptions

IncorrectDocumentStructureException

Struktur dokumen melanggar spesifikasi.

UnsupportedSaveFormatException

Format penyimpanan yang diminta tidak didukung.

Save(Peta dan SaveFormat)

Simpan dokumen OneNote ke file dalam format yang ditentukan.

public void Save(string fileName, SaveFormat format)

Parameters

fileName string

Nama lengkap untuk file.Jika file dengan nama lengkap yang ditentukan sudah ada, file yang ada akan ditulis kembali.

format SaveFormat

Format di mana untuk menyimpan dokumen.

Exceptions

IncorrectDocumentStructureException

Struktur dokumen melanggar spesifikasi.

UnsupportedSaveFormatException

Format penyimpanan yang diminta tidak didukung.

Save(Perbedaan, SaveFormat)

Simpan dokumen OneNote ke arus dalam format yang ditentukan.

public void Save(Stream stream, SaveFormat format)

Parameters

stream Stream

dan aliran tersebut.

format SaveFormat

Format di mana untuk menyimpan dokumen.

Exceptions

IncorrectDocumentStructureException

Struktur dokumen melanggar spesifikasi.

UnsupportedSaveFormatException

Format penyimpanan yang diminta tidak didukung.

Save(Keterangan, NotebookSaveOptions)

Simpan dokumen OneNote ke file menggunakan opsi simpanan yang ditentukan.

public void Save(string fileName, NotebookSaveOptions options)

Parameters

fileName string

Nama lengkap untuk file.Jika file dengan nama lengkap yang ditentukan sudah ada, file yang ada akan ditulis kembali.

options NotebookSaveOptions

Menentukan pilihan bagaimana dokumen disimpan dalam file.

Exceptions

IncorrectDocumentStructureException

Struktur dokumen melanggar spesifikasi.

UnsupportedSaveFormatException

Format penyimpanan yang diminta tidak didukung.

Save(Pengiriman, NotebookSaveOptions)

Simpan dokumen OneNote ke arus menggunakan opsi simpanan yang ditentukan.

public void Save(Stream stream, NotebookSaveOptions options)

Parameters

stream Stream

dan aliran tersebut.

options NotebookSaveOptions

Menentukan pilihan bagaimana dokumen disimpan.

Exceptions

IncorrectDocumentStructureException

Struktur dokumen melanggar spesifikasi.

UnsupportedSaveFormatException

Format penyimpanan yang diminta tidak didukung.

 Indonesia