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
{
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
Implements
INotebookChildNode
,
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.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook();
dataDir += "test_out.onetoc2";
notebook.Save(dataDir);
Découvrez comment sauvegarder un notebook dans le format PDF.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook(dataDir + "Notizbuch Öffnen.onetoc2");
dataDir += "ConvertToPDF_out.pdf";
notebook.Save(dataDir);
Découvrez comment sauvegarder le notebook comme image.
string dataDir = RunExamples.GetDataDir_NoteBook();
var notebook = new Notebook(dataDir + "Notizbuch Öffnen.onetoc2");
dataDir += "ConvertToImage_out.png";
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);
}
Découvrez comment sauvegarder un billet en format 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
});
Il montre comment iterer à travers les documents d’un ordinateur portable les charger lentement.
string inputFile = "Notizbuch öffnen.onetoc2";
string dataDir = RunExamples.GetDataDir_NoteBook();
Notebook notebook = new Notebook(dataDir + inputFile);
foreach (var notebookChildNode in notebook.OfType<Document>())
{
}
Découvrez comment ajouter une nouvelle section à un ordinateur portable.
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);
Montrer comment charger un ordinateur portable à partir d’un courant.
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é.
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.
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);
Montrer comment sauvegarder un billet flatteur comme image.
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);
Découvrez comment supprimer une section d’un ordinateur portable.
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);
Il montre comment iterer à travers les documents préliminés d’un ordinateur portable.
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>())
{
}
Découvrez comment passer par le contenu d’un ordinateur portable.
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
Étiquette ()
Initialisez une nouvelle instance de la classe Aspose.Note.Notebook.
public Notebook()
{
}
Étiquette ( 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 (string, 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.
Étiquette ( Stream )
Initialisez une nouvelle instance de la classe Aspose.Note.Notebook.Ouvrez un notebook OneNote existant à partir d’un courant.
public class Notebook
{
public Notebook(Stream stream)
{
}
}
Parameters
stream
Stream
Il flusso .
Notebook (Stream, Options de téléchargement de notebook)
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
{
return this.Color;
}
set
{
this.Color = value;
}
}
Valore di proprietà
Count
Obtenez le nombre d’éléments contenus dans le Aspose.Note.Notebook.
public int Count
{
get;
}
Valore di proprietà
DisplayName
Obtenez ou définissez le nom de l’affichage.
public string DisplayName
{
get;
set;
}
Valore di proprietà
Examples
Découvrez comment supprimer une section d’un ordinateur portable.
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
Obtenez le format de fichier (OneNote 2010, OneNota en ligne).
public FileFormat FileFormat
{
get;
}
Valore di proprietà
Guid
Recevoir l’identité unique de l’objet.
public Guid Guid
{
get;
}
Valore di proprietà
IsHistoryEnabled
Obtenez ou définissez une valeur indiquant si l’historique est activée.
public bool IsHistoryEnabled
{
get;
set;
}
Valore di proprietà
Ceci[int)
Il obtient le noyau de l’enfant du noteau par l’indice donné.
public INotebookChildNode this[int index]
{
get;
}
Valore di proprietà
Methods
AppendChild (INotebookNode)
Ajoutez le node à la fin de la liste.
public INotebookChildNode AppendChild(INotebookChildNode newChild)
{
return _notebook.AppendChild(newChild);
}
Parameters
newChild
INotebookChildNode
Le node à ajouter.
Returns
Le noyau ajouté.
GetChildNodes()
Obtenez tous les nodes de l’enfant selon le type de node.
public IList<T1> GetChildNodes<T1>() where T1 : Node
{
}
Returns
Une liste des nodes d’enfant.
Tipo di parametri
T1
Le type d’éléments dans la liste retournée.
Le numéro ()
Retourne un numérateur qui itère à travers les nodes d’enfant du Aspose.Note.Notebook.
public IEnumerator<notebookchildnode> GetEnumerator()
{
}
Returns
IEnumerator di < INotebookChildNode >
Un système.Collections.IEnumerateur
LoadChildDocument (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.
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, Options de chargement)
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, Aspose.Words.LoadOptions loadOptions)
{
}
Parameters
filePath
string
Il percorso del file.
loadOptions
LoadOptions
Le opzioni di carico.
Étiquette : 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.
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, Options de chargement)
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 (en anglais)
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(string, 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 (récédent)
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(Stream, 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(InotebookNode) dans le cadre de l’édition
Retirez le noyau de l’enfant.
public INotebookChildNode RemoveChild(INotebookChildNode oldChild)
{
}
Parameters
oldChild
INotebookChildNode
Le node à supprimer.
Returns
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);
}
Découvrez comment supprimer une section d’un ordinateur portable.
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);
Découvrez comment économiser un billet.
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" });
}
Réservation ( 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é.
Réservation ( 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é.
Réserver (String et SaveFormat)
Enregistrez le document OneNote dans un fichier dans le format spécifié.
public void Save(string fileName, Aspose.Words.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é.
Réservation (SaveFormat et Stream)
É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é.
Réserver(string, 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é.
Réserver (Stream, 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é.