Class Notebook

Class Notebook

Le nom : Aspose.Note Assemblée: Aspose.Note.dll (25.4.0)

Il s’agit d’un portable Aspose.Note.

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

Inheritance

object Notebook

Implements

INotebookChildNode , IEnumerable , IEnumerable

I membri ereditari

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

Examples

Découvrez comment sauvegarder le 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);

Découvrez comment sauvegarder un notebook dans le 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);

Découvrez comment sauvegarder le notebook comme image.

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

Découvrez comment obtenir tout le texte d’un ordinateur.

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>

Découvrez comment sauvegarder un billet en 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
                                                                  });

Il montre comment iterer à travers les documents d’un ordinateur portable les charger lentement.

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>

Découvrez comment ajouter une nouvelle section à un ordinateur portable.

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

Montrer comment charger un ordinateur portable à partir d’un courant.

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

Découvrez comment créer un ordinateur crypté.

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

Affiche comment sauvegarder un note-tête comme image avec des options spécifiées.

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

Montrer comment sauvegarder un billet flatteur comme image.

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

Découvrez comment supprimer une section d’un ordinateur portable.

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

Il montre comment iterer à travers les documents préliminés d’un ordinateur portable.

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

Découvrez comment passer par le contenu d’un ordinateur portable.

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

Initialisez une nouvelle instance de la classe Aspose.Note.Notebook.

public Notebook()

Notebook(Le string)

Initialisez une nouvelle instance de la classe Aspose.Note.Notebook.Ouvrez un notebook OneNote existant d’un fichier.

public Notebook(string filePath)

Parameters

filePath string

Il percorso del file.

Notebook(Auteur, NotebookLoadOptions)

Initialisez une nouvelle instance de la classe Aspose.Note.Notebook.Ouvrez un portable OneNote existant à partir d’un fichier. permet de spécifier des options supplémentaires telles qu’une stratégie de chargement pour enfants (“lazy” / instantané).

public Notebook(string filePath, NotebookLoadOptions loadOptions)

Parameters

filePath string

Il percorso del file.

loadOptions NotebookLoadOptions

Le opzioni di carico.

Notebook(Stream)

Initialisez une nouvelle instance de la classe Aspose.Note.Notebook.Ouvrez un notebook OneNote existant à partir d’un courant.

public Notebook(Stream stream)

Parameters

stream Stream

Il flusso .

Notebook(Étiquette, NotebookLoadOptions)

Initialisez une nouvelle instance de la classe Aspose.Note.Notebook.Ouvrez un notebook OneNote existant à partir d’un courant. permet de spécifier des options de chargement supplémentaires.

public Notebook(Stream stream, NotebookLoadOptions loadOptions)

Parameters

stream Stream

Il flusso .

loadOptions NotebookLoadOptions

Le opzioni di carico.

Properties

Color

Obtenez ou définissez la couleur.

public Color Color { get; set; }

Valore di proprietà

Color

Count

Obtenez le nombre d’éléments contenus dans le Aspose.Note.Notebook.

public int Count { get; }

Valore di proprietà

int

DisplayName

Obtenez ou définissez le nom de l’affichage.

public string DisplayName { get; set; }

Valore di proprietà

string

Examples

Découvrez comment supprimer une section d’un ordinateur portable.

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

Obtenez le format de fichier (OneNote 2010, OneNota en ligne).

public FileFormat FileFormat { get; }

Valore di proprietà

FileFormat

Guid

Recevoir l’identité unique de l’objet.

public Guid Guid { get; }

Valore di proprietà

Guid

IsHistoryEnabled

Obtenez ou définissez une valeur indiquant si l’historique est activée.

public bool IsHistoryEnabled { get; set; }

Valore di proprietà

bool

Ceci[int]

Il obtient le noyau de l’enfant du noteau par l’indice donné.

public INotebookChildNode this[int index] { get; }

Valore di proprietà

INotebookChildNode

Methods

AppendChild(Livre d’enregistrementChildNode)

Ajoutez le node à la fin de la liste.

public INotebookChildNode AppendChild(INotebookChildNode newChild)

Parameters

newChild INotebookChildNode

Le node à ajouter.

Returns

INotebookChildNode

Le noyau ajouté.

Mise à jour ()

Obtenez tous les nodes de l’enfant selon le type de node.

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

Returns

IList

Une liste des nodes d’enfant.

Tipo di parametri

T1

Le type d’éléments dans la liste retournée.

GetEnumerator()

Retourne un numérateur qui itère à travers les nodes d’enfant du Aspose.Note.Notebook.

public IEnumerator<inotebookchildnode> GetEnumerator()

Returns

IEnumerator di < INotebookChildNode >

Un système.Collections.IEnumerateur

LoadChildDocument(Le string)

Ajouter un noyau de document enfant.Ouvrez un document OneNote existant d’un fichier.

public void LoadChildDocument(string filePath)

Parameters

filePath string

Il percorso del file.

Examples

Montrer comment charger un ordinateur portable à partir d’un courant.

// 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(Télécharger, LoadOptions)

Ajouter un noyau de document enfant.Ouvrez un document OneNote existant à partir d’un fichier. permet de spécifier des options de chargement supplémentaires.

public void LoadChildDocument(string filePath, LoadOptions loadOptions)

Parameters

filePath string

Il percorso del file.

loadOptions LoadOptions

Le opzioni di carico.

LoadChildDocument(Stream)

Ajouter un noyau de document enfant.Ouvrez un document OneNote existant à partir d’un flux.

public void LoadChildDocument(Stream stream)

Parameters

stream Stream

Il flusso .

Examples

Montrer comment charger un ordinateur portable à partir d’un courant.

// 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(Résumé, LoadOptions)

Ajouter un noyau de document enfant.Ouvrez un document OneNote existant à partir d’un flux. permet de spécifier des options de chargement supplémentaires.

public void LoadChildDocument(Stream stream, LoadOptions loadOptions)

Parameters

stream Stream

Il flusso .

loadOptions LoadOptions

Le opzioni di carico.

LoadChildNotebook(Le string)

Ajoutez un noyau d’enfant.Ouvrez un notebook OneNote existant d’un fichier.

public void LoadChildNotebook(string filePath)

Parameters

filePath string

Il percorso del file.

LoadChildNotebook(Auteur, NotebookLoadOptions)

Ajoutez un noyau d’enfant.Ouvrez un notebook OneNote existant à partir d’un fichier. permet de spécifier des options de chargement supplémentaires.

public void LoadChildNotebook(string filePath, NotebookLoadOptions loadOptions)

Parameters

filePath string

Il percorso del file.

loadOptions NotebookLoadOptions

Le opzioni di carico.

LoadChildNotebook(Stream)

Ajoutez un noyau d’enfant.Ouvrez un notebook OneNote existant à partir d’un courant.

public void LoadChildNotebook(Stream stream)

Parameters

stream Stream

Il flusso .

LoadChildNotebook(Étiquette, NotebookLoadOptions)

Ajoutez un noyau d’enfant.Ouvrez un notebook OneNote existant à partir d’un courant. permet de spécifier des options de chargement supplémentaires.

public void LoadChildNotebook(Stream stream, NotebookLoadOptions loadOptions)

Parameters

stream Stream

Il flusso .

loadOptions NotebookLoadOptions

Le opzioni di carico.

RemoveChild(Livre d’enregistrementChildNode)

Retirez le noyau de l’enfant.

public INotebookChildNode RemoveChild(INotebookChildNode oldChild)

Parameters

oldChild INotebookChildNode

Le node à supprimer.

Returns

INotebookChildNode

Le node supprimé.

Examples

Découvrez comment accéder à toutes les sections d’un ordinateur portable.

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>

Découvrez comment supprimer une section d’un ordinateur portable.

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

Découvrez comment économiser un billet.

// 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(Le string)

Économisez le document OneNote dans un fichier.

public void Save(string fileName)

Parameters

fileName string

Si un fichier avec le nom complet spécifié existe déjà, le dossier existant est surécrite.

Exceptions

IncorrectDocumentStructureException

La structure du document est en violation des spécifications.

UnsupportedSaveFormatException

Le format de sauvegarde demandé n’est pas supporté.

Save(Stream)

Économisez le document OneNote dans un flux.

public void Save(Stream stream)

Parameters

stream Stream

Il flusso .

Exceptions

IncorrectDocumentStructureException

La structure du document est en violation des spécifications.

UnsupportedSaveFormatException

Le format de sauvegarde demandé n’est pas supporté.

Save(Téléchargement, SaveFormat)

Enregistrez le document OneNote dans un fichier dans le format spécifié.

public void Save(string fileName, SaveFormat format)

Parameters

fileName string

Si un fichier avec le nom complet spécifié existe déjà, le dossier existant est surécrite.

format SaveFormat

文書を保存するための形式

Exceptions

IncorrectDocumentStructureException

La structure du document est en violation des spécifications.

UnsupportedSaveFormatException

Le format de sauvegarde demandé n’est pas supporté.

Save(Résumé : SaveFormat)

Économisez le document OneNote à un flux dans le format spécifié.

public void Save(Stream stream, SaveFormat format)

Parameters

stream Stream

Il flusso .

format SaveFormat

文書を保存するための形式

Exceptions

IncorrectDocumentStructureException

La structure du document est en violation des spécifications.

UnsupportedSaveFormatException

Le format de sauvegarde demandé n’est pas supporté.

Save(Auteur, NotebookSaveOptions)

Enregistrez le document OneNote dans un fichier en utilisant les options d’enregistrement spécifiées.

public void Save(string fileName, NotebookSaveOptions options)

Parameters

fileName string

Si un fichier avec le nom complet spécifié existe déjà, le dossier existant est surécrite.

options NotebookSaveOptions

Il spécifie les options de la façon dont le document est enregistré dans le fichier.

Exceptions

IncorrectDocumentStructureException

La structure du document est en violation des spécifications.

UnsupportedSaveFormatException

Le format de sauvegarde demandé n’est pas supporté.

Save(Étiquette, NotebookSaveOptions)

Économisez le document OneNote dans un flux en utilisant les options spécifiées de sauvegarde.

public void Save(Stream stream, NotebookSaveOptions options)

Parameters

stream Stream

Il flusso .

options NotebookSaveOptions

Définir les options de la façon dont le document est enregistré.

Exceptions

IncorrectDocumentStructureException

La structure du document est en violation des spécifications.

UnsupportedSaveFormatException

Le format de sauvegarde demandé n’est pas supporté.

 Français