Class Document

Class Document

Το όνομα: Aspose.Note Συγκέντρωση: Aspose.Note.dll (25.4.0)

Αντιπροσωπεύει ένα έγγραφο Aspose.Note.

public class Document : CompositeNode<page>, INode, ICompositeNode<page>, ICompositeNode, IEnumerable<page>, IEnumerable, INotebookChildNode

Inheritance

object Node CompositeNodeBase CompositeNode Document

Implements

INode , ICompositeNode , ICompositeNode , IEnumerable , IEnumerable , INotebookChildNode

Κληρονομημένα μέλη

CompositeNode.GetEnumerator() , CompositeNode.InsertChild(int, T1) , CompositeNode.InsertChildrenRange(int, IEnumerable) , CompositeNode.InsertChildrenRange(int, params Page[]) , CompositeNode.AppendChildFirst(T1) , CompositeNode.AppendChildLast(T1) , CompositeNode.RemoveChild(T1) , CompositeNode.Accept(DocumentVisitor) , CompositeNode.GetChildNodes(NodeType) , CompositeNode.GetChildNodes() , CompositeNode.IsComposite , CompositeNode.FirstChild , CompositeNode.LastChild , CompositeNodeBase.GetChildNodes(NodeType) , CompositeNodeBase.GetChildNodes() , CompositeNodeBase.CheckDocument(Node) , Node.Accept(DocumentVisitor) , Node.Document , Node.IsComposite , Node.NodeType , Node.ParentNode , Node.PreviousSibling , Node.NextSibling , object.GetType() , object.MemberwiseClone() , object.ToString() , object.Equals(object?) , object.Equals(object?, object?) , object.ReferenceEquals(object?, object?) , object.GetHashCode()

Examples

Δείχνει πώς να στείλετε ένα έγγραφο σε έναν εκτυπωτή χρησιμοποιώντας τον κανονικό διάλογο των Windows με προεπιλεγμένες επιλογές.

// The path to the documents directory.
                                                                                                      string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                                      var document = new Aspose.Note.Document(dataDir + "Aspose.one");

                                                                                                      document.Print();

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο.

string inputFile = "Sample1.one";
                                        string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                        string outputFile = "SaveDocToOneNoteFormat_out.one";

                                        Document doc = new Document(dataDir + inputFile);
                                        doc.Save(dataDir + outputFile);

Δείχνει πώς να κάνετε ένα κρυπτογραφημένο έγγραφο.

// The path to the documents directory.
                                              string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                              LoadOptions loadOptions = new LoadOptions { DocumentPassword = "password" };
                                              Document doc = new Document(dataDir + "Sample1.one", loadOptions);

Δείχνει πώς να αποθηκεύσετε το έγγραφο με κρυπτογράφηση.

// The path to the documents directory.
                                                      string dataDir = RunExamples.GetDataDir_NoteBook();

                                                      Document document = new Document();
                                                      document.Save(dataDir + "CreatingPasswordProtectedDoc_out.one", new OneSaveOptions() { DocumentPassword = "pass" });

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο χρησιμοποιώντας τον κατάλογο SaveFormat.

string inputFile = "Sample1.one";
                                                                     string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                     string outputFile = "SaveDocToOneNoteFormatUsingSaveFormat_out.one";

                                                                     Document document = new Document(dataDir + inputFile);

                                                                     document.Save(dataDir + outputFile, SaveFormat.One);

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο χρησιμοποιώντας OneSaveOptions.

string inputFile = "Sample1.one";
                                                             string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                             string outputFile = "SaveDocToOneNoteFormatUsingOneSaveOptions_out.one";

                                                             Document document = new Document(dataDir + inputFile);

                                                             document.Save(dataDir + outputFile, new OneSaveOptions());

Δείχνει πώς να πάρετε τον αριθμό της σελίδας ενός εγγράφου.

// The path to the documents directory.
                                                       string dataDir = RunExamples.GetDataDir_Pages();

                                                       // Load the document into Aspose.Note.
                                                       Document oneFile = new Document(dataDir + "Aspose.one");

                                                       // Get number of pages
                                                       int count = oneFile.Count();

                                                       // Print count on the output screen
                                                       Console.WriteLine(count);

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μορφή pdf χρησιμοποιώντας προεπιλεγμένες ρυθμίσεις.

// The path to the documents directory.
                                                                             string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                             // Load the document into Aspose.Note.
                                                                             Document oneFile = new Document(dataDir + "Aspose.one");

                                                                             // Save the document as PDF
                                                                             dataDir = dataDir + "SaveWithDefaultSettings_out.pdf";
                                                                             oneFile.Save(dataDir, SaveFormat.Pdf);

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μορφή gif.

// The path to the documents directory.
                                                      string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                      // Load the document into Aspose.Note.
                                                      Document oneFile = new Document(dataDir + "Aspose.one");

                                                      dataDir = dataDir + "SaveToImageDefaultOptions_out.gif";

                                                      // Save the document as gif.
                                                      oneFile.Save(dataDir, SaveFormat.Gif);

Δείχνει πώς να ρυθμίσετε την ποιότητα εικόνας όταν αποθηκεύετε το έγγραφο ως εικόνα σε μορφή JPEG.

// The path to the documents directory.
                                                                                         string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                         // Load the document into Aspose.Note.
                                                                                         Document doc = new Document(dataDir + "Aspose.one");

                                                                                         dataDir = dataDir + "SetOutputImageResolution_out.jpg";

                                                                                         // Save the document.
                                                                                         doc.Save(dataDir, new ImageSaveOptions(SaveFormat.Jpeg) { Quality = 100 });

Δείχνει πώς να ρυθμίσετε μια ανάλυση εικόνας όταν αποθηκεύετε το έγγραφο ως εικόνα.

// The path to the documents directory.
                                                                             string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                             // Load the document into Aspose.Note.
                                                                             Document doc = new Document(dataDir + "Aspose.one");

                                                                             dataDir = dataDir + "SetOutputImageResolution_out.jpg";

                                                                             // Save the document.
                                                                             doc.Save(dataDir, new ImageSaveOptions(SaveFormat.Jpeg) { Resolution = 220 });

Δείχνει πώς να πάρει μορφή αρχείου ενός εγγράφου.

// The path to the documents directory.
                                                      string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                      var document = new Aspose.Note.Document(dataDir + "Aspose.one");
                                                      switch (document.FileFormat)
                                                      {
                                                          case FileFormat.OneNote2010:
                                                              // Process OneNote 2010
                                                              break;
                                                          case FileFormat.OneNoteOnline:
                                                              // Process OneNote Online
                                                              break;
                                                      }

Δείχνει πώς να συνδέσετε ένα υπερσύνδεσμο σε μια εικόνα.

// The path to the documents directory.
                                                     string dataDir = RunExamples.GetDataDir_Images(); 

                                                     var document = new Document();

                                                     var page = new Page(document);

                                                     var image = new Image(document, dataDir + "image.jpg") { HyperlinkUrl = "http://image.com" };

                                                     page.AppendChildLast(image);

                                                     document.AppendChildLast(page);

                                                     document.Save(dataDir + "Image with Hyperlink_out.one");

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μια ροή.

// The path to the documents directory.
                                                    string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                    // Load the document into Aspose.Note.
                                                    Document doc = new Document(dataDir + "Aspose.one");

                                                    MemoryStream dstStream = new MemoryStream();
                                                    doc.Save(dstStream, SaveFormat.Pdf);

                                                    // Rewind the stream position back to zero so it is ready for next reader.
                                                    dstStream.Seek(0, SeekOrigin.Begin);

Δείχνει πώς να ελέγξετε εάν ένα έγγραφο είναι προστατευμένο με κωδικό πρόσβασης.

// The path to the documents directory.
                                                                  string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                  string fileName = Path.Combine(dataDir, "Aspose.one");

                                                                  Document document;
                                                                  if (!Document.IsEncrypted(fileName, out document))
                                                                  {
                                                                      Console.WriteLine("The document is loaded and ready to be processed.");
                                                                  }
                                                                  else
                                                                  {
                                                                      Console.WriteLine("The document is encrypted. Provide a password.");
                                                                  }

Δείχνει πώς να προσθέσετε ένα νέο τμήμα σε ένα σημειωματάριο.

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

Δείχνει πώς να ελέγξετε αν ένα φορτίο εγγράφου αποτύχει επειδή η μορφή του OneNote 2007 δεν υποστηρίζεται.

// The path to the documents directory.
                                                                                                        string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                                                        string fileName = Path.Combine(dataDir, "OneNote2007.one");

                                                                                                        try
                                                                                                        {
                                                                                                            new Document(fileName);
                                                                                                        }
                                                                                                        catch (UnsupportedFileFormatException e)
                                                                                                        {
                                                                                                            if (e.FileFormat == FileFormat.OneNote2007)
                                                                                                            {
                                                                                                                Console.WriteLine("It looks like the provided file is in OneNote 2007 format that is not supported.");
                                                                                                            }
                                                                                                            else
                                                                                                                throw;
                                                                                                        }

Δείχνει πώς να αποκαταστήσετε την προηγούμενη έκδοση μιας σελίδας.

// The path to the documents directory.
                                                           string dataDir = RunExamples.GetDataDir_Pages();

                                                           // Load OneNote document and get first child           
                                                           Document document = new Document(dataDir + "Aspose.one");
                                                           Page page = document.FirstChild;           
                                                           Page previousPageVersion = document.GetPageHistory(page).Last();

                                                           document.RemoveChild(page);
                                                           document.AppendChildLast(previousPageVersion);

                                                           document.Save(dataDir + "RollBackRevisions_out.one");

Πώς να κλωνοποιήσετε μια σελίδα

// The path to the documents directory.
                                     string dataDir = RunExamples.GetDataDir_Pages();

                                     // Load OneNote document
                                     Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });

                                     // Clone into new document without history
                                     var cloned = new Document();
                                     cloned.AppendChildLast(document.FirstChild.Clone());

                                     // Clone into new document with history
                                     cloned = new Document();
                                     cloned.AppendChildLast(document.FirstChild.Clone(true));

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μορφή html με την αποθήκευση όλων των πόρων (css/fonts/images) σε ένα ξεχωριστό αρχείο.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                                                                        var document = new Document(Path.Combine(dataDir, "Aspose.one"));

                                                                                                                        var options = new HtmlSaveOptions()
                                                                                                                                     {
                                                                                                                                         ExportCss = ResourceExportType.ExportAsStream,
                                                                                                                                         ExportFonts = ResourceExportType.ExportAsStream,
                                                                                                                                         ExportImages = ResourceExportType.ExportAsStream,
                                                                                                                                         FontFaceTypes = FontFaceType.Ttf
                                                                                                                                     };
                                                                                                                        document.Save(dataDir + "document_out.html", options);

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μια ροή σε μορφή html με την ενσωμάτωση όλων των πόρων (css/fonts/images).

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                                                                     var document = new Document(Path.Combine(dataDir, "Aspose.one"));

                                                                                                                     var options = new HtmlSaveOptions()
                                                                                                                                  {
                                                                                                                                      ExportCss = ResourceExportType.ExportEmbedded,
                                                                                                                                      ExportFonts = ResourceExportType.ExportEmbedded,
                                                                                                                                      ExportImages = ResourceExportType.ExportEmbedded,
                                                                                                                                      FontFaceTypes = FontFaceType.Ttf
                                                                                                                                  };

                                                                                                                     var r = new MemoryStream();
                                                                                                                     document.Save(r, options);

Δείχνει πώς να ρυθμίσετε μια περιγραφή κειμένου για μια εικόνα.

// The path to the documents directory.
                                                          string dataDir = RunExamples.GetDataDir_Images();

                                                          var document = new Document();
                                                          var page = new Page(document);
                                                          var image = new Image(document, dataDir + "image.jpg")
                                                                      {
                                                                          AlternativeTextTitle = "This is an image's title!",
                                                                          AlternativeTextDescription = "And this is an image's description!"
                                                                      };
                                                          page.AppendChildLast(image);
                                                          document.AppendChildLast(page);

                                                          dataDir = dataDir + "ImageAlternativeText_out.one";
                                                          document.Save(dataDir);

Δείχνει πώς να πάρετε meta πληροφορίες για μια σελίδα.

// The path to the documents directory.
                                                          string dataDir = RunExamples.GetDataDir_Pages();

                                                          // Load the document into Aspose.Note.
                                                          Document oneFile = new Document(dataDir + "Aspose.one");

                                                          foreach (Page page in oneFile)
                                                          {
                                                              Console.WriteLine("LastModifiedTime: {0}", page.LastModifiedTime);
                                                              Console.WriteLine("CreationTime: {0}", page.CreationTime);
                                                              Console.WriteLine("Title: {0}", page.Title);
                                                              Console.WriteLine("Level: {0}", page.Level);
                                                              Console.WriteLine("Author: {0}", page.Author);
                                                              Console.WriteLine();
                                                          }

Όταν οι μακροχρόνιες σελίδες του OneNote αποθηκεύονται σε μορφή pdf, χωρίζονται μεταξύ σελίδων.Το δείγμα δείχνει πώς να ρυθμίσετε τη λογική διαίρεσης των αντικειμένων που βρίσκονται στις διακοπές της σελίδας.

// The path to the documents directory.
                                                                                                                                                                                  string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                                                                                                                  // Load the document into Aspose.Note.
                                                                                                                                                                                  Document doc = new Document(dataDir + "Aspose.one");

                                                                                                                                                                                  var pdfSaveOptions = new PdfSaveOptions();

                                                                                                                                                                                  pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(100);
                                                                                                                                                                                  // or
                                                                                                                                                                                  pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(400);

                                                                                                                                                                                  dataDir = dataDir + "PageSplittUsingKeepPartAndCloneSolidObjectToNextPageAlgorithm_out.pdf";
                                                                                                                                                                                  doc.Save(dataDir);

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μορφή png.

// The path to the documents directory.
                                                      string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                      // Load the document into Aspose.Note.
                                                      Document oneFile = new Document(dataDir + "Aspose.one");

                                                      // Initialize ImageSaveOptions object 
                                                      ImageSaveOptions opts = new ImageSaveOptions(SaveFormat.Png)
                                                                                  {
                                                                                      // Set page index
                                                                                      PageIndex = 1
                                                                                  };

                                                      dataDir = dataDir + "ConvertSpecificPageToImage_out.png";

                                                      // Save the document as PNG.
                                                      oneFile.Save(dataDir, opts);

Δείχνει πώς να επεξεργαστείτε την ιστορία της σελίδας.

// The path to the documents directory.
                                            string dataDir = RunExamples.GetDataDir_Pages();

                                            // Load OneNote document and get first child           
                                            Document document = new Document(dataDir + "Aspose.one");
                                            Page page = document.FirstChild;

                                            var pageHistory = document.GetPageHistory(page);

                                            pageHistory.RemoveRange(0, 1);

                                            pageHistory[0] = new Page(document);
                                            if (pageHistory.Count &gt; 1)
                                            {
                                                pageHistory[1].Title.TitleText.Text = "New Title";

                                                pageHistory.Add(new Page(document));

                                                pageHistory.Insert(1, new Page(document));

                                                document.Save(dataDir + "ModifyPageHistory_out.one");
                                            }

Δείχνει πώς να ελέγξετε εάν ένα έγγραφο προστατεύεται από έναν συγκεκριμένο κωδικό πρόσβασης.

// The path to the documents directory.
                                                                                       string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                                       string fileName = Path.Combine(dataDir, "Aspose.one");

                                                                                       Document document;
                                                                                       if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
                                                                                       {
                                                                                           if (document != null)
                                                                                           {
                                                                                               Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
                                                                                           }
                                                                                           else
                                                                                           {
                                                                                               Console.WriteLine("The document is encrypted. Invalid password was provided.");
                                                                                           }
                                                                                       }
                                                                                       else
                                                                                       {
                                                                                           Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
                                                                                       }

Δείχνει πώς να εφαρμόσετε το στυλ Dark theme σε ένα έγγραφο.

// The path to the documents directory.
                                                             string dataDir = RunExamples.GetDataDir_Text();

                                                             // Load the document into Aspose.Note.
                                                             Document doc = new Document(Path.Combine(dataDir, "Aspose.one"));

                                                             foreach (var page in doc)
                                                             {
                                                                 page.BackgroundColor = Color.Black;
                                                             }

                                                             foreach (var node in doc.GetChildNodes<richtext>())
                                                             {
                                                                 var c = node.ParagraphStyle.FontColor;
                                                                 if (c.IsEmpty || Math.Abs(c.R - Color.Black.R) + Math.Abs(c.G - Color.Black.G) + Math.Abs(c.B - Color.Black.B) &lt;= 30)
                                                                 {
                                                                     node.ParagraphStyle.FontColor = Color.White;
                                                                 }
                                                             }

                                                             doc.Save(Path.Combine(dataDir, "AsposeDarkTheme.pdf"));</richtext>

Δείχνει πώς να περάσει μέσα από το περιεχόμενο ενός σημειωματάρι.

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

Δείχνει πώς να πάρει μια εικόνα από ένα έγγραφο.

// The path to the documents directory.
                                                     string dataDir = RunExamples.GetDataDir_Images();

                                                     // Load the document into Aspose.Note.
                                                     Document oneFile = new Document(dataDir + "Aspose.one");

                                                     // Get all Image nodes
                                                     IList<aspose.note.image> nodes = oneFile.GetChildNodes<aspose.note.image>();

                                                     foreach (Aspose.Note.Image image in nodes)
                                                     {
                                                         using (MemoryStream stream = new MemoryStream(image.Bytes))
                                                         {
                                                             using (Bitmap bitMap = new Bitmap(stream))
                                                             {
                                                                 // Save image bytes to a file
                                                                 bitMap.Save(String.Format(dataDir + "{0}", Path.GetFileName(image.FileName)));
                                                             }
                                                         }
                                                     }</aspose.note.image></aspose.note.image>

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μορφή PDF.

// The path to the documents directory.
                                                      string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                      // Load the document into Aspose.Note.
                                                      Document oneFile = new Document(dataDir + "Aspose.one");

                                                      // Initialize PdfSaveOptions object
                                                      PdfSaveOptions opts = new PdfSaveOptions
                                                                                {
                                                                                    // Set page index of first page to be saved
                                                                                    PageIndex = 0,

                                                                                    // Set page count
                                                                                    PageCount = 1,
                                                                                };

                                                      // Save the document as PDF
                                                      dataDir = dataDir + "SaveRangeOfPagesAsPDF_out.pdf";
                                                      oneFile.Save(dataDir, opts);

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μορφή pdf χρησιμοποιώντας συγκεκριμένες ρυθμίσεις.

// The path to the documents directory.
                                                                              string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                              // Load the document into Aspose.Note.
                                                                              Document doc = new Document(dataDir + "Aspose.one");

                                                                              // Initialize PdfSaveOptions object
                                                                              PdfSaveOptions opts = new PdfSaveOptions
                                                                                                        {
                                                                                                            // Use Jpeg compression
                                                                                                            ImageCompression = Saving.Pdf.PdfImageCompression.Jpeg,

                                                                                                            // Quality for JPEG compression
                                                                                                            JpegQuality = 90
                                                                                                        };

                                                                              dataDir = dataDir + "Document.SaveWithOptions_out.pdf";
                                                                              doc.Save(dataDir, opts);

Δείχνει πώς να στείλετε ένα έγγραφο σε έναν εκτυπωτή χρησιμοποιώντας ένα προεπιλεγμένο διάλογο Windows με καθορισμένες επιλογές.

// The path to the documents directory.
                                                                                                        string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                                        var document = new Aspose.Note.Document(dataDir + "Aspose.one");

                                                                                                        var printerSettings = new PrinterSettings() { FromPage = 0, ToPage = 10 };
                                                                                                        printerSettings.DefaultPageSettings.Landscape = true;
                                                                                                        printerSettings.DefaultPageSettings.Margins = new System.Drawing.Printing.Margins(50, 50, 150, 50);

                                                                                                        document.Print(new PrintOptions()
                                                                                                                       {
                                                                                                                           PrinterSettings = printerSettings,
                                                                                                                           Resolution = 1200,
                                                                                                                           PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(),
                                                                                                                           DocumentName = "Test.one"
                                                                                                                       });

Δείχνει πώς να πάρετε το περιεχόμενο ενός συνδεδεμένου αρχείου.

// The path to the documents directory.
                                                        string dataDir = RunExamples.GetDataDir_Attachments();

                                                        // Load the document into Aspose.Note.
                                                        Document oneFile = new Document(dataDir + "Sample1.one");

                                                        // Get a list of attached file nodes
                                                        IList<attachedfile> nodes = oneFile.GetChildNodes<attachedfile>();

                                                        // Iterate through all nodes
                                                        foreach (AttachedFile file in nodes)
                                                        {
                                                            // Load attached file to a stream object
                                                            using (Stream outputStream = new MemoryStream(file.Bytes))
                                                            {
                                                                // Create a local file
                                                                using (Stream fileStream = System.IO.File.OpenWrite(String.Format(dataDir + file.FileName)))
                                                                {
                                                                    // Copy file stream
                                                                    CopyStream(outputStream, fileStream);
                                                                }
                                                            }
                                                        }</attachedfile></attachedfile>

Δείχνει πώς να πάρετε τις meta πληροφορίες της εικόνας.

// The path to the documents directory.
                                                     string dataDir = RunExamples.GetDataDir_Images();

                                                     // Load the document into Aspose.Note.
                                                     Document oneFile = new Document(dataDir + "Aspose.one");

                                                     // Get all Image nodes
                                                     IList<aspose.note.image> images = oneFile.GetChildNodes<aspose.note.image>();

                                                     foreach (Aspose.Note.Image image in images)
                                                     {
                                                         Console.WriteLine("Width: {0}", image.Width);
                                                         Console.WriteLine("Height: {0}", image.Height);
                                                         Console.WriteLine("OriginalWidth: {0}", image.OriginalWidth);
                                                         Console.WriteLine("OriginalHeight: {0}", image.OriginalHeight);
                                                         Console.WriteLine("FileName: {0}", image.FileName);
                                                         Console.WriteLine("LastModifiedTime: {0}", image.LastModifiedTime);
                                                         Console.WriteLine();
                                                     }</aspose.note.image></aspose.note.image>

Δείχνει πώς να πάρετε την ιστορία της σελίδας.

// The path to the documents directory.
                                           string dataDir = RunExamples.GetDataDir_Pages();

                                           // Load OneNote document
                                           Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });

                                           // Get first page
                                           Page firstPage = document.FirstChild;
                                           foreach (Page pageRevision in document.GetPageHistory(firstPage))
                                           {
                                               /*Use pageRevision like a regular page.*/
                                               Console.WriteLine("LastModifiedTime: {0}", pageRevision.LastModifiedTime);
                                               Console.WriteLine("CreationTime: {0}", pageRevision.CreationTime);
                                               Console.WriteLine("Title: {0}", pageRevision.Title);
                                               Console.WriteLine("Level: {0}", pageRevision.Level);
                                               Console.WriteLine("Author: {0}", pageRevision.Author);
                                               Console.WriteLine();
                                           }

Δείχνει πώς να προσθέσετε ένα αρχείο σε ένα έγγραφο χρησιμοποιώντας το φάκελο.

// The path to the documents directory.
                                                                   string dataDir = RunExamples.GetDataDir_Attachments();

                                                                   // Create an object of the Document class
                                                                   Document doc = new Document();

                                                                   // Initialize Page class object
                                                                   Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                                   // Initialize Outline class object
                                                                   Outline outline = new Outline(doc);

                                                                   // Initialize OutlineElement class object
                                                                   OutlineElement outlineElem = new OutlineElement(doc);

                                                                   // Initialize AttachedFile class object
                                                                   AttachedFile attachedFile = new AttachedFile(doc,  dataDir + "attachment.txt");

                                                                   // Add attached file
                                                                   outlineElem.AppendChildLast(attachedFile);

                                                                   // Add outline element node
                                                                   outline.AppendChildLast(outlineElem);

                                                                   // Add outline node
                                                                   page.AppendChildLast(outline);

                                                                   // Add page node
                                                                   doc.AppendChildLast(page);

                                                                   dataDir = dataDir + "AttachFileByPath_out.one";
                                                                   doc.Save(dataDir);

Δείχνει πώς να δημιουργήσετε ένα έγγραφο και να το αποθηκεύσετε σε μορφή html χρησιμοποιώντας τις προεπιλεγμένες επιλογές.

// The path to the documents directory.
                                                                                           string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                           // Initialize OneNote document
                                                                                           Document doc = new Document();
                                                                                           Page page = doc.AppendChildLast(new Page());

                                                                                           // Default style for all text in the document.
                                                                                           ParagraphStyle textStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
                                                                                           page.Title = new Title()
                                                                                                            {
                                                                                                                TitleText = new RichText() { Text = "Title text.", ParagraphStyle = textStyle },
                                                                                                                TitleDate = new RichText() { Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture), ParagraphStyle = textStyle },
                                                                                                                TitleTime = new RichText() { Text = "12:34", ParagraphStyle = textStyle }
                                                                                                            };

                                                                                           // Save into HTML format
                                                                                           dataDir = dataDir + "CreateOneNoteDocAndSaveToHTML_out.html";
                                                                                           doc.Save(dataDir);

Δείχνει πώς να ελέγξετε αν μια σελίδα είναι μια σύγκρουση σελίδα (δηλαδή έχει αλλαγές που το OneNote δεν μπορούσε να συγχωνευθεί αυτόματα).

string dataDir = RunExamples.GetDataDir_Pages();

                                                                                                                          // Load OneNote document
                                                                                                                          Document doc = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });

                                                                                                                          var history = doc.GetPageHistory(doc.FirstChild);
                                                                                                                          for (int i = 0; i &lt; history.Count; i++)
                                                                                                                          {
                                                                                                                              var historyPage = history[i];
                                                                                                                              Console.Write("    {0}. Author: {1}, {2:dd.MM.yyyy hh.mm.ss}",
                                                                                                                                              i,
                                                                                                                                              historyPage.PageContentRevisionSummary.AuthorMostRecent,
                                                                                                                                              historyPage.PageContentRevisionSummary.LastModifiedTime);
                                                                                                                              Console.WriteLine(historyPage.IsConflictPage ? ", IsConflict: true" : string.Empty);

                                                                                                                              // By default conflict pages are just skipped on saving.
                                                                                                                              // If mark it as non-conflict then it will be saved as usual one in the history.
                                                                                                                              if (historyPage.IsConflictPage)
                                                                                                                                  historyPage.IsConflictPage = false;
                                                                                                                          }

                                                                                                                          doc.Save(dataDir + "ConflictPageManipulation_out.one", SaveFormat.One);

Δείχνει πώς να προσθέσετε μια εικόνα από ένα αρχείο σε ένα έγγραφο με ορισμένες ιδιότητες του χρήστη.

// The path to the documents directory.
                                                                                          string dataDir = RunExamples.GetDataDir_Images();

                                                                                          // Load document from the stream.
                                                                                          Document doc = new Document(dataDir + "Aspose.one");

                                                                                          // Get the first page of the document.
                                                                                          Aspose.Note.Page page = doc.FirstChild;

                                                                                          // Load an image from the file.
                                                                                          Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "image.jpg")
                                                                                                                    {
                                                                                                                        // Change the image's size according to your needs (optional).
                                                                                                                        Width = 100,
                                                                                                                        Height = 100,

                                                                                                                        // Set the image's location in the page (optional).
                                                                                                                        HorizontalOffset = 100,
                                                                                                                        VerticalOffset = 400,

                                                                                                                        // Set image alignment
                                                                                                                        Alignment = HorizontalAlignment.Right
                                                                                                                    };

                                                                                          // Add the image to the page.
                                                                                          page.AppendChildLast(image);

Δείχνει πώς να προσθέσετε ένα αρχείο από μια ροή σε ένα έγγραφο.

// The path to the documents directory.
                                                               string dataDir = RunExamples.GetDataDir_Attachments();

                                                               // Create an object of the Document class
                                                               Document doc = new Document();

                                                               // Initialize Page class object
                                                               Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                               // Initialize Outline class object
                                                               Outline outline = new Outline(doc);

                                                               // Initialize OutlineElement class object
                                                               OutlineElement outlineElem = new OutlineElement(doc);

                                                               using (var stream = File.OpenRead(dataDir + "icon.jpg"))
                                                               {
                                                                   // Initialize AttachedFile class object and also pass its icon path
                                                                   AttachedFile attachedFile = new AttachedFile(doc, dataDir + "attachment.txt", stream, ImageFormat.Jpeg);

                                                                   // Add attached file
                                                                   outlineElem.AppendChildLast(attachedFile);
                                                               }

                                                               // Add outline element node
                                                               outline.AppendChildLast(outlineElem);

                                                               // Add outline node
                                                               page.AppendChildLast(outline);

                                                               // Add page node
                                                               doc.AppendChildLast(page);

                                                               dataDir = dataDir + "AttachFileAndSetIcon_out.one";
                                                               doc.Save(dataDir);

Όταν οι μακροχρόνιες σελίδες του OneNote αποθηκεύονται σε μορφή pdf, χωρίζονται μεταξύ σελίδων.Το παράδειγμα δείχνει πώς να ρυθμίσετε τη λογική διαίρεσης των αντικειμένων που βρίσκονται στις διακοπές της σελίδας.

// The path to the documents directory.
                                                                                                                                                                                   string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                                                                                                                   // Load the document into Aspose.Note.
                                                                                                                                                                                   Document doc = new Document(dataDir + "Aspose.one");
                                                                                                                                                                                   var pdfSaveOptions = new PdfSaveOptions();
                                                                                                                                                                                   pdfSaveOptions.PageSplittingAlgorithm = new AlwaysSplitObjectsAlgorithm();
                                                                                                                                                                                   // Or
                                                                                                                                                                                   pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm();
                                                                                                                                                                                   // Or
                                                                                                                                                                                   pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm();

                                                                                                                                                                                   float heightLimitOfClonedPart = 500;
                                                                                                                                                                                   pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(heightLimitOfClonedPart);
                                                                                                                                                                                   // Or
                                                                                                                                                                                   pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(heightLimitOfClonedPart);

                                                                                                                                                                                   pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(100);
                                                                                                                                                                                   // Or
                                                                                                                                                                                   pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(400);

                                                                                                                                                                                   dataDir = dataDir + "UsingKeepSOlidObjectsAlgorithm_out.pdf";
                                                                                                                                                                                   doc.Save(dataDir);

Δείχνει πώς να δημιουργήσετε ένα έγγραφο και να αποθηκεύσετε σε μορφή html μια συγκεκριμένη σειρά σελίδων.

// The path to the documents directory.
                                                                                           string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                           // Initialize OneNote document
                                                                                           Document doc = new Document();

                                                                                           Page page = doc.AppendChildLast(new Page());

                                                                                           // Default style for all text in the document.
                                                                                           ParagraphStyle textStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
                                                                                           page.Title = new Title()
                                                                                                        {
                                                                                                            TitleText = new RichText() { Text = "Title text.", ParagraphStyle = textStyle },
                                                                                                            TitleDate = new RichText() { Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture), ParagraphStyle = textStyle },
                                                                                                            TitleTime = new RichText() { Text = "12:34", ParagraphStyle = textStyle }
                                                                                                        };

                                                                                           // Save into HTML format
                                                                                           dataDir = dataDir + "CreateAndSavePageRange_out.html";
                                                                                           doc.Save(dataDir, new HtmlSaveOptions
                                                                                                             {
                                                                                                                 PageCount = 1,
                                                                                                                 PageIndex = 0
                                                                                                             });

Δείχνει πώς να δημιουργήσετε ένα έγγραφο με τίτλο σελίδας.

// The path to the documents directory.
                                                           string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                           // Create an object of the Document class
                                                           Document doc = new Aspose.Note.Document();

                                                           // Initialize Page class object
                                                           Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                           // Default style for all text in the document.
                                                           ParagraphStyle textStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };

                                                           // Set page title properties
                                                           page.Title = new Title(doc)
                                                                        {
                                                                            TitleText = new RichText(doc) { Text = "Title text.", ParagraphStyle = textStyle },
                                                                            TitleDate = new RichText(doc) { Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture), ParagraphStyle = textStyle },
                                                                            TitleTime = new RichText(doc) { Text = "12:34", ParagraphStyle = textStyle }
                                                                        };

                                                           // Append Page node in the document
                                                           doc.AppendChildLast(page);

                                                           // Save OneNote document
                                                           dataDir = dataDir + "CreateDocWithPageTitle_out.one";
                                                           doc.Save(dataDir);

Δείχνει πώς να προσθέσετε μια εικόνα από το ρεύμα σε ένα έγγραφο.

// The path to the documents directory.
                                                               string dataDir = RunExamples.GetDataDir_Images();

                                                               // Create an object of the Document class
                                                               Document doc = new Document();

                                                               // Initialize Page class object
                                                               Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                               Outline outline1 = new Outline(doc);
                                                               OutlineElement outlineElem1 = new OutlineElement(doc);

                                                               using (FileStream fs = File.OpenRead(dataDir + "image.jpg"))
                                                               {

                                                                   // Load the second image using the image name, extension and stream.
                                                                   Aspose.Note.Image image1 = new Aspose.Note.Image(doc, "Penguins.jpg", fs)
                                                                                                  {
                                                                                                      // Set image alignment
                                                                                                      Alignment = HorizontalAlignment.Right
                                                                                                  };

                                                                   outlineElem1.AppendChildLast(image1);
                                                               }

                                                               outline1.AppendChildLast(outlineElem1);
                                                               page.AppendChildLast(outline1);

                                                               doc.AppendChildLast(page);

                                                               // Save OneNote document
                                                               dataDir = dataDir + "BuildDocAndInsertImageUsingImageStream_out.one";
                                                               doc.Save(dataDir);

Δείχνει πώς να προσθέσετε μια εικόνα από ένα αρχείο σε ένα έγγραφο.

// The path to the documents directory.
                                                             string dataDir = RunExamples.GetDataDir_Images();

                                                             // Create an object of the Document class
                                                             Document doc = new Document();

                                                             // Initialize Page class object
                                                             Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                             // Initialize Outline class object and set offset properties
                                                             Outline outline = new Outline(doc);

                                                             // Initialize OutlineElement class object
                                                             OutlineElement outlineElem = new OutlineElement(doc);

                                                             // Load an image by the file path.
                                                             Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "image.jpg")
                                                                                       {
                                                                                           // Set image alignment
                                                                                           Alignment = HorizontalAlignment.Right
                                                                                       };

                                                             // Add image
                                                             outlineElem.AppendChildLast(image);

                                                             // Add outline elements
                                                             outline.AppendChildLast(outlineElem);

                                                             // Add Outline node
                                                             page.AppendChildLast(outline);

                                                             // Add Page node
                                                             doc.AppendChildLast(page);

                                                             // Save OneNote document
                                                             dataDir = dataDir + "BuildDocAndInsertImage_out.one";
                                                             doc.Save(dataDir);

Δείχνει πώς να δημιουργήσετε ένα έγγραφο με κείμενο.

// The path to the documents directory.
                                                      string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                      // Create an object of the Document class
                                                      Document doc = new Document();

                                                      // Initialize Page class object
                                                      Page page = new Page(doc);

                                                      // Initialize Outline class object
                                                      Outline outline = new Outline(doc);

                                                      // Initialize OutlineElement class object
                                                      OutlineElement outlineElem = new OutlineElement(doc);

                                                      // Initialize TextStyle class object and set formatting properties
                                                      ParagraphStyle textStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };

                                                      // Initialize RichText class object and apply text style
                                                      RichText text = new RichText(doc) { Text = "Hello OneNote text!", ParagraphStyle = textStyle };

                                                      // Add RichText node
                                                      outlineElem.AppendChildLast(text);

                                                      // Add OutlineElement node
                                                      outline.AppendChildLast(outlineElem);

                                                      // Add Outline node
                                                      page.AppendChildLast(outline);

                                                      // Add Page node
                                                      doc.AppendChildLast(page);

                                                      // Save OneNote document
                                                      dataDir = dataDir + "CreateDocWithSimpleRichText_out.one";
                                                      doc.Save(dataDir);

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε διαφορετικές μορφές.

// The path to the documents directory.
                                                             string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                             // Initialize the new Document
                                                             Document doc = new Document() { AutomaticLayoutChangesDetectionEnabled = false };

                                                             // Initialize the new Page
                                                             Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                             // Default style for all text in the document.
                                                             ParagraphStyle textStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
                                                             page.Title = new Title(doc)
                                                                          {
                                                                              TitleText = new RichText(doc) { Text = "Title text.", ParagraphStyle = textStyle },
                                                                              TitleDate = new RichText(doc) { Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture), ParagraphStyle = textStyle },
                                                                              TitleTime = new RichText(doc) { Text = "12:34", ParagraphStyle = textStyle }
                                                                          };

                                                             // Append page node
                                                             doc.AppendChildLast(page);

                                                             // Save OneNote document in different formats, set text font size and detect layout changes manually.
                                                             doc.Save(dataDir + "ConsequentExportOperations_out.html");            
                                                             doc.Save(dataDir + "ConsequentExportOperations_out.pdf");            
                                                             doc.Save(dataDir + "ConsequentExportOperations_out.jpg");            
                                                             textStyle.FontSize = 11;           
                                                             doc.DetectLayoutChanges();            
                                                             doc.Save(dataDir + "ConsequentExportOperations_out.bmp");

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μορφή html με την αποθήκευση όλων των πόρων (css/fonts/images) χρησιμοποιώντας καθορισμένες κλήσεις.

// The code below creates 'documentFolder' folder containing document.html, 'css' folder with 'style.css' file, 'images' folder with images and 'fonts' folder with fonts.
                                                                                                                                    // 'style.css' file will contain at the end the following string "/* This line is appended to stream manually by user */"
                                                                                                                                    var savingCallbacks = new UserSavingCallbacks()
                                                                                                                                                              {
                                                                                                                                                                  RootFolder = "documentFolder",
                                                                                                                                                                  CssFolder = "css",
                                                                                                                                                                  KeepCssStreamOpened = true,
                                                                                                                                                                  ImagesFolder = "images",
                                                                                                                                                                  FontsFolder = "fonts"
                                                                                                                                                              };
                                                                                                                                    var options = new HtmlSaveOptions
                                                                                                                                                  {
                                                                                                                                                      FontFaceTypes = FontFaceType.Ttf,
                                                                                                                                                      CssSavingCallback = savingCallbacks,
                                                                                                                                                      FontSavingCallback = savingCallbacks,
                                                                                                                                                      ImageSavingCallback = savingCallbacks
                                                                                                                                                  };

                                                                                                                                    if (!Directory.Exists(savingCallbacks.RootFolder))
                                                                                                                                    {
                                                                                                                                        Directory.CreateDirectory(savingCallbacks.RootFolder);
                                                                                                                                    }

                                                                                                                                    string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                                                                                    var document = new Document(Path.Combine(dataDir, "Aspose.one"));

                                                                                                                                    using (var stream = File.Create(Path.Combine(savingCallbacks.RootFolder, "document.html")))
                                                                                                                                    {
                                                                                                                                        document.Save(stream, options);
                                                                                                                                    }

                                                                                                                                    using (var writer = new StreamWriter(savingCallbacks.CssStream))
                                                                                                                                    {
                                                                                                                                        writer.WriteLine();
                                                                                                                                        writer.WriteLine("/* This line is appended to stream manually by user */");
                                                                                                                                    }

Δείχνει πώς να συνδέσετε ένα υπερσύνδεσμο με ένα κείμενο.

// The path to the documents directory.
                                                   string dataDir = RunExamples.GetDataDir_Tasks();

                                                   // Create an object of the Document class
                                                   Document doc = new Document();

                                                   RichText titleText = new RichText() { ParagraphStyle = ParagraphStyle.Default }.Append("Title!");

                                                   Outline outline = new Outline()
                                                                         {
                                                                             MaxWidth = 200,
                                                                             MaxHeight = 200,
                                                                             VerticalOffset = 100,
                                                                             HorizontalOffset = 100
                                                                         };

                                                   TextStyle textStyleRed = new TextStyle
                                                                                {
                                                                                    FontColor = Color.Red,
                                                                                    FontName = "Arial",
                                                                                    FontSize = 10,
                                                                                };

                                                   TextStyle textStyleHyperlink = new TextStyle
                                                                                      {
                                                                                          IsHyperlink = true,
                                                                                          HyperlinkAddress = "www.google.com"
                                                                                      };

                                                   RichText text = new RichText() { ParagraphStyle = ParagraphStyle.Default }
                                                                       .Append("This is ", textStyleRed)
                                                                       .Append("hyperlink", textStyleHyperlink)
                                                                       .Append(". This text is not a hyperlink.", TextStyle.Default);

                                                   OutlineElement outlineElem = new OutlineElement();
                                                   outlineElem.AppendChildLast(text);

                                                   // Add outline elements
                                                   outline.AppendChildLast(outlineElem);

                                                   // Initialize Title class object
                                                   Title title = new Title() { TitleText = titleText };

                                                   // Initialize Page class object
                                                   Page page = new Note.Page() { Title = title };

                                                   // Add Outline node
                                                   page.AppendChildLast(outline);

                                                   // Add Page node
                                                   doc.AppendChildLast(page);

                                                   // Save OneNote document
                                                   dataDir = dataDir + "AddHyperlink_out.one";
                                                   doc.Save(dataDir);

Δείχνει πώς να έχετε πρόσβαση στο περιεχόμενο ενός εγγράφου χρησιμοποιώντας έναν επισκέπτη.

public static void Run()
                                                                   {
                                                                       // The path to the documents directory.
                                                                       string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                       // Open the document we want to convert.
                                                                       Document doc = new Document(dataDir + "Aspose.one");

                                                                       // Create an object that inherits from the DocumentVisitor class.
                                                                       MyOneNoteToTxtWriter myConverter = new MyOneNoteToTxtWriter();

                                                                       // This is the well known Visitor pattern. Get the model to accept a visitor.
                                                                       // The model will iterate through itself by calling the corresponding methods
                                                                       // on the visitor object (this is called visiting).
                                                                       //
                                                                       // Note that every node in the object model has the Accept method so the visiting
                                                                       // can be executed not only for the whole document, but for any node in the document.
                                                                       doc.Accept(myConverter);

                                                                       // Once the visiting is complete, we can retrieve the result of the operation,
                                                                       // that in this example, has accumulated in the visitor.
                                                                       Console.WriteLine(myConverter.GetText());
                                                                       Console.WriteLine(myConverter.NodeCount);            
                                                                   }

                                                                   /// <summary>
                                                                   /// Simple implementation of saving a document in the plain text format. Implemented as a Visitor.
                                                                   /// </summary>
                                                                   public class MyOneNoteToTxtWriter : DocumentVisitor
                                                                   {
                                                                       public MyOneNoteToTxtWriter()
                                                                       {
                                                                           nodecount = 0;
                                                                           mIsSkipText = false;
                                                                           mBuilder = new StringBuilder();
                                                                       }

                                                                       /// <summary>
                                                                       /// Gets the plain text of the document that was accumulated by the visitor.
                                                                       /// </summary>
                                                                       public string GetText()
                                                                       {
                                                                           return mBuilder.ToString();
                                                                       }

                                                                       /// <summary>
                                                                       /// Adds text to the current output. Honors the enabled/disabled output flag.
                                                                       /// </summary>
                                                                       private void AppendText(string text)
                                                                       {
                                                                           if (!mIsSkipText)
                                                                           {
                                                                               mBuilder.AppendLine(text);
                                                                           }
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when a RichText node is encountered in the document.
                                                                       /// </summary>
                                                                       public override void VisitRichTextStart(RichText run)
                                                                       {
                                                                           ++nodecount;
                                                                           AppendText(run.Text);
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when a Document node is encountered in the document.
                                                                       /// </summary>
                                                                       public override void VisitDocumentStart(Document document)
                                                                       {
                                                                           ++nodecount;
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when a Page node is encountered in the document.
                                                                       /// </summary>
                                                                       public override void VisitPageStart(Page page)
                                                                       {
                                                                           ++nodecount;
                                                                           this.AppendText($"*** Page '{page.Title?.TitleText?.Text ?? "(no title)"}' ***");
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when processing of a Page node is finished.
                                                                       /// </summary>
                                                                       public override void VisitPageEnd(Page page)
                                                                       {
                                                                           this.AppendText(string.Empty);
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when a Title node is encountered in the document.
                                                                       /// </summary>
                                                                       public override void VisitTitleStart(Title title)
                                                                       {
                                                                           ++nodecount;
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when a Image node is encountered in the document.
                                                                       /// </summary>
                                                                       public override void VisitImageStart(Image image)
                                                                       {
                                                                           ++nodecount;
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when a OutlineGroup node is encountered in the document.
                                                                       /// </summary>
                                                                       public override void VisitOutlineGroupStart(OutlineGroup outlineGroup)
                                                                       {
                                                                           ++nodecount;
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when a Outline node is encountered in the document.
                                                                       /// </summary>
                                                                       public override void VisitOutlineStart(Outline outline)
                                                                       {
                                                                           ++nodecount;
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when a OutlineElement node is encountered in the document.
                                                                       /// </summary>
                                                                       public override void VisitOutlineElementStart(OutlineElement outlineElement)
                                                                       {
                                                                           ++nodecount;
                                                                       }

                                                                       /// <summary>
                                                                       /// Gets the total count of nodes by the Visitor
                                                                       /// </summary>
                                                                       public Int32 NodeCount
                                                                       {
                                                                           get { return this.nodecount; }
                                                                       }

                                                                       private readonly StringBuilder mBuilder;
                                                                       private bool mIsSkipText;
                                                                       private Int32 nodecount;
                                                                   }

Constructors

Document()

Αρχίζει μια νέα περίπτωση της κατηγορίας Aspose.Note.Document.Δημιουργεί ένα άδειο έγγραφο OneNote.

public Document()

Document(Σύνδεσμος)

Αρχίζει μια νέα περίπτωση της κατηγορίας Aspose.Note.Document.Ανοίγει ένα υπάρχον έγγραφο του OneNote από ένα αρχείο.

public Document(string filePath)

Parameters

filePath string

Ο δρόμος του αρχείου.

Exceptions

UnsupportedFileFormatException

Η μορφή εγγράφου δεν αναγνωρίζεται ή δεν υποστηρίζεται.

FileCorruptedException

Το έγγραφο φαίνεται να είναι κατεστραμμένο και δεν μπορεί να φορτωθεί.

IncorrectPasswordException

Το έγγραφο είναι κρυπτογραφημένο και απαιτεί έναν κωδικό πρόσβασης για να ανοίξει, αλλά έχετε παράσχει ένα λανθασμένο κωδικό πρόσβασης.

InvalidOperationException

Υπάρχει ένα πρόβλημα με το έγγραφο και θα πρέπει να ειδοποιείται στους προγραμματιστές Aspose.Note.

IOException

Υπάρχει εξαίρεση εισόδου/εξόδου.

Document(Σύνδεσμος, LoadOptions)

Αρχίζει μια νέα περίπτωση της κατηγορίας Aspose.Note.Document.Ανοίγει ένα υπάρχον έγγραφο του OneNote από ένα αρχείο. Επιτρέπει να προσδιορίσετε πρόσθετες επιλογές, όπως κωδικό πρόσβασης.

public Document(string filePath, LoadOptions loadOptions)

Parameters

filePath string

Ο δρόμος του αρχείου.

loadOptions LoadOptions

Επιλογές που χρησιμοποιούνται για την φόρτωση ενός εγγράφου. μπορεί να είναι μηδέν.

Exceptions

UnsupportedFileFormatException

Η μορφή εγγράφου δεν αναγνωρίζεται ή δεν υποστηρίζεται.

FileCorruptedException

Το έγγραφο φαίνεται να είναι κατεστραμμένο και δεν μπορεί να φορτωθεί.

IncorrectPasswordException

Το έγγραφο είναι κρυπτογραφημένο και απαιτεί έναν κωδικό πρόσβασης για να ανοίξει, αλλά έχετε παράσχει ένα λανθασμένο κωδικό πρόσβασης.

InvalidOperationException

Υπάρχει ένα πρόβλημα με το έγγραφο και θα πρέπει να ειδοποιείται στους προγραμματιστές Aspose.Note.

IOException

Υπάρχει εξαίρεση εισόδου/εξόδου.

Document(Stream)

Αρχίζει μια νέα περίπτωση της κατηγορίας Aspose.Note.Document.Ανοίγει ένα υπάρχον έγγραφο του OneNote από μια ροή.

public Document(Stream inStream)

Parameters

inStream Stream

Το ρεύμα.

Exceptions

UnsupportedFileFormatException

Η μορφή εγγράφου δεν αναγνωρίζεται ή δεν υποστηρίζεται.

FileCorruptedException

Το έγγραφο φαίνεται να είναι κατεστραμμένο και δεν μπορεί να φορτωθεί.

IncorrectPasswordException

Το έγγραφο είναι κρυπτογραφημένο και απαιτεί έναν κωδικό πρόσβασης για να ανοίξει, αλλά έχετε παράσχει ένα λανθασμένο κωδικό πρόσβασης.

InvalidOperationException

Υπάρχει ένα πρόβλημα με το έγγραφο και θα πρέπει να ειδοποιείται στους προγραμματιστές Aspose.Note.

IOException

Υπάρχει εξαίρεση εισόδου/εξόδου.

ArgumentException

Το ρεύμα δεν υποστηρίζει την ανάγνωση, είναι μηδέν ή είναι ήδη κλειστό.

Document(Σύνδεση, LoadOptions)

Αρχίζει μια νέα περίπτωση της κατηγορίας Aspose.Note.Document.Ανοίγει ένα υπάρχον έγγραφο του OneNote από μια ροή. Επιτρέπει να προσδιορίσετε πρόσθετες επιλογές, όπως κωδικό κρυπτογράφησης.

public Document(Stream inStream, LoadOptions loadOptions)

Parameters

inStream Stream

Το ρεύμα.

loadOptions LoadOptions

Επιλογές που χρησιμοποιούνται για την φόρτωση ενός εγγράφου. μπορεί να είναι μηδέν.

Exceptions

UnsupportedFileFormatException

Η μορφή εγγράφου δεν αναγνωρίζεται ή δεν υποστηρίζεται.

FileCorruptedException

Το έγγραφο φαίνεται να είναι κατεστραμμένο και δεν μπορεί να φορτωθεί.

IncorrectPasswordException

Το έγγραφο είναι κρυπτογραφημένο και απαιτεί έναν κωδικό πρόσβασης για να ανοίξει, αλλά έχετε παράσχει ένα λανθασμένο κωδικό πρόσβασης.

InvalidOperationException

Υπάρχει ένα πρόβλημα με το έγγραφο και θα πρέπει να ειδοποιείται στους προγραμματιστές Aspose.Note.

IOException

Υπάρχει εξαίρεση εισόδου/εξόδου.

ArgumentException

Το ρεύμα δεν υποστηρίζει την ανάγνωση, είναι μηδέν ή είναι ήδη κλειστό.

Properties

AutomaticLayoutChangesDetectionEnabled

Αποκτά ή τοποθετεί μια τιμή που υποδεικνύει εάν Aspose.Note εκτελεί την ανίχνευση των αλλαγών στη διάταξη αυτόματα.Η προεπιλεγμένη τιμή είναι “πραγματική”.

public bool AutomaticLayoutChangesDetectionEnabled { get; set; }

Αξία ιδιοκτησίας

bool

Examples

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε διαφορετικές μορφές.

// The path to the documents directory.
                                                             string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                             // Initialize the new Document
                                                             Document doc = new Document() { AutomaticLayoutChangesDetectionEnabled = false };

                                                             // Initialize the new Page
                                                             Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                             // Default style for all text in the document.
                                                             ParagraphStyle textStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
                                                             page.Title = new Title(doc)
                                                                          {
                                                                              TitleText = new RichText(doc) { Text = "Title text.", ParagraphStyle = textStyle },
                                                                              TitleDate = new RichText(doc) { Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture), ParagraphStyle = textStyle },
                                                                              TitleTime = new RichText(doc) { Text = "12:34", ParagraphStyle = textStyle }
                                                                          };

                                                             // Append page node
                                                             doc.AppendChildLast(page);

                                                             // Save OneNote document in different formats, set text font size and detect layout changes manually.
                                                             doc.Save(dataDir + "ConsequentExportOperations_out.html");            
                                                             doc.Save(dataDir + "ConsequentExportOperations_out.pdf");            
                                                             doc.Save(dataDir + "ConsequentExportOperations_out.jpg");            
                                                             textStyle.FontSize = 11;           
                                                             doc.DetectLayoutChanges();            
                                                             doc.Save(dataDir + "ConsequentExportOperations_out.bmp");

Color

Πάρτε ή τοποθετήστε το χρώμα.

public Color Color { get; set; }

Αξία ιδιοκτησίας

Color

CreationTime

Αποκτά ή καθορίζει τον χρόνο δημιουργίας.

public DateTime CreationTime { get; set; }

Αξία ιδιοκτησίας

DateTime

DisplayName

Πάρτε ή τοποθετήστε το όνομα της οθόνης.

public string DisplayName { get; set; }

Αξία ιδιοκτησίας

string

FileFormat

Αποκτήστε τη μορφή αρχείου (OneNote 2010, OneNota Online).

public FileFormat FileFormat { get; }

Αξία ιδιοκτησίας

FileFormat

Examples

Δείχνει πώς να πάρει μορφή αρχείου ενός εγγράφου.

// The path to the documents directory.
                                                      string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                      var document = new Aspose.Note.Document(dataDir + "Aspose.one");
                                                      switch (document.FileFormat)
                                                      {
                                                          case FileFormat.OneNote2010:
                                                              // Process OneNote 2010
                                                              break;
                                                          case FileFormat.OneNoteOnline:
                                                              // Process OneNote Online
                                                              break;
                                                      }

Guid

Αποκτά το παγκόσμιο μοναδικό ID του αντικειμένου.

public Guid Guid { get; }

Αξία ιδιοκτησίας

Guid

Methods

Accept(DocumentVisitor)

Αποδέχεται ο επισκέπτης του κόμβου.

public override void Accept(DocumentVisitor visitor)

Parameters

visitor DocumentVisitor

Το αντικείμενο μιας κατηγορίας που προέρχεται από το Aspose.Note.DocumentVisitor.

Examples

Δείχνει πώς να έχετε πρόσβαση στο περιεχόμενο ενός εγγράφου χρησιμοποιώντας έναν επισκέπτη.

public static void Run()
                                                                   {
                                                                       // The path to the documents directory.
                                                                       string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                       // Open the document we want to convert.
                                                                       Document doc = new Document(dataDir + "Aspose.one");

                                                                       // Create an object that inherits from the DocumentVisitor class.
                                                                       MyOneNoteToTxtWriter myConverter = new MyOneNoteToTxtWriter();

                                                                       // This is the well known Visitor pattern. Get the model to accept a visitor.
                                                                       // The model will iterate through itself by calling the corresponding methods
                                                                       // on the visitor object (this is called visiting).
                                                                       //
                                                                       // Note that every node in the object model has the Accept method so the visiting
                                                                       // can be executed not only for the whole document, but for any node in the document.
                                                                       doc.Accept(myConverter);

                                                                       // Once the visiting is complete, we can retrieve the result of the operation,
                                                                       // that in this example, has accumulated in the visitor.
                                                                       Console.WriteLine(myConverter.GetText());
                                                                       Console.WriteLine(myConverter.NodeCount);            
                                                                   }

                                                                   /// <summary>
                                                                   /// Simple implementation of saving a document in the plain text format. Implemented as a Visitor.
                                                                   /// </summary>
                                                                   public class MyOneNoteToTxtWriter : DocumentVisitor
                                                                   {
                                                                       public MyOneNoteToTxtWriter()
                                                                       {
                                                                           nodecount = 0;
                                                                           mIsSkipText = false;
                                                                           mBuilder = new StringBuilder();
                                                                       }

                                                                       /// <summary>
                                                                       /// Gets the plain text of the document that was accumulated by the visitor.
                                                                       /// </summary>
                                                                       public string GetText()
                                                                       {
                                                                           return mBuilder.ToString();
                                                                       }

                                                                       /// <summary>
                                                                       /// Adds text to the current output. Honors the enabled/disabled output flag.
                                                                       /// </summary>
                                                                       private void AppendText(string text)
                                                                       {
                                                                           if (!mIsSkipText)
                                                                           {
                                                                               mBuilder.AppendLine(text);
                                                                           }
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when a RichText node is encountered in the document.
                                                                       /// </summary>
                                                                       public override void VisitRichTextStart(RichText run)
                                                                       {
                                                                           ++nodecount;
                                                                           AppendText(run.Text);
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when a Document node is encountered in the document.
                                                                       /// </summary>
                                                                       public override void VisitDocumentStart(Document document)
                                                                       {
                                                                           ++nodecount;
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when a Page node is encountered in the document.
                                                                       /// </summary>
                                                                       public override void VisitPageStart(Page page)
                                                                       {
                                                                           ++nodecount;
                                                                           this.AppendText($"*** Page '{page.Title?.TitleText?.Text ?? "(no title)"}' ***");
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when processing of a Page node is finished.
                                                                       /// </summary>
                                                                       public override void VisitPageEnd(Page page)
                                                                       {
                                                                           this.AppendText(string.Empty);
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when a Title node is encountered in the document.
                                                                       /// </summary>
                                                                       public override void VisitTitleStart(Title title)
                                                                       {
                                                                           ++nodecount;
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when a Image node is encountered in the document.
                                                                       /// </summary>
                                                                       public override void VisitImageStart(Image image)
                                                                       {
                                                                           ++nodecount;
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when a OutlineGroup node is encountered in the document.
                                                                       /// </summary>
                                                                       public override void VisitOutlineGroupStart(OutlineGroup outlineGroup)
                                                                       {
                                                                           ++nodecount;
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when a Outline node is encountered in the document.
                                                                       /// </summary>
                                                                       public override void VisitOutlineStart(Outline outline)
                                                                       {
                                                                           ++nodecount;
                                                                       }

                                                                       /// <summary>
                                                                       /// Called when a OutlineElement node is encountered in the document.
                                                                       /// </summary>
                                                                       public override void VisitOutlineElementStart(OutlineElement outlineElement)
                                                                       {
                                                                           ++nodecount;
                                                                       }

                                                                       /// <summary>
                                                                       /// Gets the total count of nodes by the Visitor
                                                                       /// </summary>
                                                                       public Int32 NodeCount
                                                                       {
                                                                           get { return this.nodecount; }
                                                                       }

                                                                       private readonly StringBuilder mBuilder;
                                                                       private bool mIsSkipText;
                                                                       private Int32 nodecount;
                                                                   }

DetectLayoutChanges()

Ανακαλύπτει όλες τις αλλαγές που έγιναν στη διάταξη του εγγράφου από την προηγούμενη κλήση Aspose.Note.Document.DetectLayoutChanges.Στην περίπτωση Aspose.Note.Document.AutomaticLayoutChangesDetectionΕπιτρέπεται να είναι αληθινό, χρησιμοποιείται αυτόματα στην αρχή της εξαγωγής εγγράφων.

public void DetectLayoutChanges()

Examples

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε διαφορετικές μορφές.

// The path to the documents directory.
                                                             string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                             // Initialize the new Document
                                                             Document doc = new Document() { AutomaticLayoutChangesDetectionEnabled = false };

                                                             // Initialize the new Page
                                                             Aspose.Note.Page page = new Aspose.Note.Page(doc);

                                                             // Default style for all text in the document.
                                                             ParagraphStyle textStyle = new ParagraphStyle { FontColor = Color.Black, FontName = "Arial", FontSize = 10 };
                                                             page.Title = new Title(doc)
                                                                          {
                                                                              TitleText = new RichText(doc) { Text = "Title text.", ParagraphStyle = textStyle },
                                                                              TitleDate = new RichText(doc) { Text = new DateTime(2011, 11, 11).ToString("D", CultureInfo.InvariantCulture), ParagraphStyle = textStyle },
                                                                              TitleTime = new RichText(doc) { Text = "12:34", ParagraphStyle = textStyle }
                                                                          };

                                                             // Append page node
                                                             doc.AppendChildLast(page);

                                                             // Save OneNote document in different formats, set text font size and detect layout changes manually.
                                                             doc.Save(dataDir + "ConsequentExportOperations_out.html");            
                                                             doc.Save(dataDir + "ConsequentExportOperations_out.pdf");            
                                                             doc.Save(dataDir + "ConsequentExportOperations_out.jpg");            
                                                             textStyle.FontSize = 11;           
                                                             doc.DetectLayoutChanges();            
                                                             doc.Save(dataDir + "ConsequentExportOperations_out.bmp");

GetPageHistory(Page)

Αποκτά το Aspose.Note.PageHistory που περιέχει πλήρη ιστορικό για κάθε σελίδα που παρουσιάζεται σε ένα έγγραφο (το πρώτο στο δείκτη 0).Η τρέχουσα αναθεώρηση της σελίδας είναι διαθέσιμη ως Aspose.Note.PageHistory.Current και περιέχεται ξεχωριστά από τη συλλογή ιστορικών εκδόσεων.

public PageHistory GetPageHistory(Page page)

Parameters

page Page

Η τρέχουσα αναθεώρηση μιας σελίδας.

Returns

PageHistory

Το Aspose.Note.PageΙστορία

Examples

Δείχνει πώς να αποκαταστήσετε την προηγούμενη έκδοση μιας σελίδας.

// The path to the documents directory.
                                                           string dataDir = RunExamples.GetDataDir_Pages();

                                                           // Load OneNote document and get first child           
                                                           Document document = new Document(dataDir + "Aspose.one");
                                                           Page page = document.FirstChild;           
                                                           Page previousPageVersion = document.GetPageHistory(page).Last();

                                                           document.RemoveChild(page);
                                                           document.AppendChildLast(previousPageVersion);

                                                           document.Save(dataDir + "RollBackRevisions_out.one");

Δείχνει πώς να επεξεργαστείτε την ιστορία της σελίδας.

// The path to the documents directory.
                                            string dataDir = RunExamples.GetDataDir_Pages();

                                            // Load OneNote document and get first child           
                                            Document document = new Document(dataDir + "Aspose.one");
                                            Page page = document.FirstChild;

                                            var pageHistory = document.GetPageHistory(page);

                                            pageHistory.RemoveRange(0, 1);

                                            pageHistory[0] = new Page(document);
                                            if (pageHistory.Count &gt; 1)
                                            {
                                                pageHistory[1].Title.TitleText.Text = "New Title";

                                                pageHistory.Add(new Page(document));

                                                pageHistory.Insert(1, new Page(document));

                                                document.Save(dataDir + "ModifyPageHistory_out.one");
                                            }

Δείχνει πώς να ελέγξετε αν μια σελίδα είναι μια σύγκρουση σελίδα (δηλαδή έχει αλλαγές που το OneNote δεν μπορούσε να συγχωνευθεί αυτόματα).

string dataDir = RunExamples.GetDataDir_Pages();

                                                                                                                          // Load OneNote document
                                                                                                                          Document doc = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });

                                                                                                                          var history = doc.GetPageHistory(doc.FirstChild);
                                                                                                                          for (int i = 0; i &lt; history.Count; i++)
                                                                                                                          {
                                                                                                                              var historyPage = history[i];
                                                                                                                              Console.Write("    {0}. Author: {1}, {2:dd.MM.yyyy hh.mm.ss}",
                                                                                                                                              i,
                                                                                                                                              historyPage.PageContentRevisionSummary.AuthorMostRecent,
                                                                                                                                              historyPage.PageContentRevisionSummary.LastModifiedTime);
                                                                                                                              Console.WriteLine(historyPage.IsConflictPage ? ", IsConflict: true" : string.Empty);

                                                                                                                              // By default conflict pages are just skipped on saving.
                                                                                                                              // If mark it as non-conflict then it will be saved as usual one in the history.
                                                                                                                              if (historyPage.IsConflictPage)
                                                                                                                                  historyPage.IsConflictPage = false;
                                                                                                                          }

                                                                                                                          doc.Save(dataDir + "ConflictPageManipulation_out.one", SaveFormat.One);

Import(Δραστηριότητες κοντά σε: PdfImportOptions)

Εισάγει ένα σύνολο σελίδων από το παρεχόμενο έγγραφο PDF.

public Document Import(Stream stream, PdfImportOptions importOptions = null, MergeOptions mergeOptions = null)

Parameters

stream Stream

Μια ροή με έγγραφο PDF.

importOptions PdfImportOptions

Προσδιορίζει τις επιλογές πώς να εισαγάγετε σελίδες από το έγγραφο PDF.

mergeOptions MergeOptions

Προσδιορίζει τις επιλογές πώς να συγχωνεύσετε τις παρεχόμενες σελίδες.

Returns

Document

Επιστρέφει την αναφορά στο έγγραφο.

Import(Σύνδεσμος, PdfImportOptions, Mergeoptions)

Εισάγει ένα σύνολο σελίδων από το παρεχόμενο έγγραφο PDF.

public Document Import(string file, PdfImportOptions importOptions = null, MergeOptions mergeOptions = null)

Parameters

file string

Ένα αρχείο με PDF έγγραφο.

importOptions PdfImportOptions

Προσδιορίζει τις επιλογές πώς να εισαγάγετε σελίδες από το έγγραφο PDF.

mergeOptions MergeOptions

Προσδιορίζει τις επιλογές πώς να συγχωνεύσετε τις παρεχόμενες σελίδες.

Returns

Document

Επιστρέφει την αναφορά στο έγγραφο.

Examples

Δείχνει πώς να εισαγάγετε όλες τις σελίδες από ένα σύνολο αρχείων PDF σελίδα ανά σελίδα.

string dataDir = RunExamples.GetDataDir_Import();

                                                                                  var d = new Document();

                                                                                  d.Import(Path.Combine(dataDir, "sampleText.pdf"))
                                                                                   .Import(Path.Combine(dataDir, "sampleImage.pdf"))
                                                                                   .Import(Path.Combine(dataDir, "sampleTable.pdf"));

                                                                                  d.Save(Path.Combine(dataDir, "sample_SimpleMerge.one"));

Δείχνει πώς να εισαγάγετε όλες τις σελίδες από ένα σύνολο εγγράφων PDF, ενώ εισάγοντας σελίδια από κάθε έγγραφο PDF ως παιδιά μιας σελίδας του OneNote υψηλού επιπέδου.

string dataDir = RunExamples.GetDataDir_Import();

                                                                                                                                                           var d = new Document();

                                                                                                                                                           foreach (var file in new[] { "sampleText.pdf", "sampleImage.pdf", "sampleTable.pdf" })
                                                                                                                                                           {
                                                                                                                                                               d.AppendChildLast(new Page()).Title = new Title() { TitleText = new RichText() { ParagraphStyle = ParagraphStyle.Default }.Append(file) };
                                                                                                                                                               d.Import(Path.Combine(dataDir, file), new PdfImportOptions(), new MergeOptions() { InsertAt = int.MaxValue, InsertAsChild = true });
                                                                                                                                                           }

                                                                                                                                                           d.Save(Path.Combine(dataDir, "sample_StructuredMerge.one"));

Δείχνει πώς να εισαγάγετε όλο το περιεχόμενο από ένα σύνολο εγγράφων PDF ενώ συνδυάζετε σελίδες από κάθε έγγραφο PDF σε μια ενιαία σελίδα του OneNote.

string dataDir = RunExamples.GetDataDir_Import();

                                                                                                                                            var d = new Document();

                                                                                                                                            var importOptions = new PdfImportOptions();
                                                                                                                                            var mergeOptions = new MergeOptions() { ImportAsSinglePage = true, PageSpacing = 100 };

                                                                                                                                            d.Import(Path.Combine(dataDir, "sampleText.pdf"), importOptions, mergeOptions)
                                                                                                                                             .Import(Path.Combine(dataDir, "sampleImage.pdf"), importOptions, mergeOptions)
                                                                                                                                             .Import(Path.Combine(dataDir, "sampleTable.pdf"), importOptions, mergeOptions);

                                                                                                                                            d.Save(Path.Combine(dataDir, "sample_SinglePageMerge.one"));

Import(Σύνδεση, HtmlImportOptions, Mergeoptions)

Εισάγει ένα σύνολο σελίδων από το παρεχόμενο έγγραφο HTML.

public Document Import(Stream stream, HtmlImportOptions importOptions, MergeOptions mergeOptions = null)

Parameters

stream Stream

Μια ροή με έγγραφο HTML.

importOptions HtmlImportOptions

Προσδιορίζει τις επιλογές πώς να εισαγάγετε σελίδες από ένα έγγραφο HTML.

mergeOptions MergeOptions

Προσδιορίζει τις επιλογές πώς να συγχωνεύσετε τις παρεχόμενες σελίδες.

Returns

Document

Επιστρέφει την αναφορά στο έγγραφο.

Import(Σύνδεσμος, HtmlImportOptions, Mergeoptions)

Εισάγει ένα σύνολο σελίδων από το παρεχόμενο έγγραφο HTML.

public Document Import(string file, HtmlImportOptions importOptions, MergeOptions mergeOptions = null)

Parameters

file string

Ένα αρχείο με έγγραφο HTML.

importOptions HtmlImportOptions

Προσδιορίζει τις επιλογές πώς να εισαγάγετε σελίδες από ένα έγγραφο HTML.

mergeOptions MergeOptions

Προσδιορίζει τις επιλογές πώς να συγχωνεύσετε τις παρεχόμενες σελίδες.

Returns

Document

Επιστρέφει την αναφορά στο έγγραφο.

IsEncrypted(Stream, LoadOptions, Out Έγγραφο)

Ελέγξτε αν ένα έγγραφο από μια ροή είναι κρυπτογραφημένο.Για να το ελέγξουμε πρέπει να φορτίσουμε πλήρως αυτό το έγγραφο. έτσι αυτή η μέθοδος μπορεί να οδηγήσει σε ποινή απόδοσης.

public static bool IsEncrypted(Stream stream, LoadOptions options, out Document document)

Parameters

stream Stream

Το ρεύμα.

options LoadOptions

Οι επιλογές φορτίου.

document Document

Το φορτισμένο έγγραφο.

Returns

bool

Επιστρέφει αληθινό εάν το έγγραφο κρυπτογραφείται διαφορετικά ψεύτικο.

Examples

Δείχνει πώς να ελέγξετε εάν ένα έγγραφο είναι προστατευμένο με κωδικό πρόσβασης.

// The path to the documents directory.
                                                                  string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                  string fileName = Path.Combine(dataDir, "Aspose.one");

                                                                  Document document;
                                                                  if (!Document.IsEncrypted(fileName, out document))
                                                                  {
                                                                      Console.WriteLine("The document is loaded and ready to be processed.");
                                                                  }
                                                                  else
                                                                  {
                                                                      Console.WriteLine("The document is encrypted. Provide a password.");
                                                                  }

Δείχνει πώς να ελέγξετε εάν ένα έγγραφο προστατεύεται από έναν συγκεκριμένο κωδικό πρόσβασης.

// The path to the documents directory.
                                                                                       string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                                       string fileName = Path.Combine(dataDir, "Aspose.one");

                                                                                       Document document;
                                                                                       if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
                                                                                       {
                                                                                           if (document != null)
                                                                                           {
                                                                                               Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
                                                                                           }
                                                                                           else
                                                                                           {
                                                                                               Console.WriteLine("The document is encrypted. Invalid password was provided.");
                                                                                           }
                                                                                       }
                                                                                       else
                                                                                       {
                                                                                           Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
                                                                                       }

IsEncrypted(Stream, string, out έγγραφο)

Ελέγξτε αν ένα έγγραφο από μια ροή είναι κρυπτογραφημένο.Για να το ελέγξουμε πρέπει να φορτίσουμε πλήρως αυτό το έγγραφο. έτσι αυτή η μέθοδος μπορεί να οδηγήσει σε ποινή απόδοσης.

public static bool IsEncrypted(Stream stream, string password, out Document document)

Parameters

stream Stream

Το ρεύμα.

password string

Ο κωδικός πρόσβασης για να αποκρυπτογραφήσει ένα έγγραφο.

document Document

Το φορτισμένο έγγραφο.

Returns

bool

Επιστρέφει αληθινό εάν το έγγραφο κρυπτογραφείται διαφορετικά ψεύτικο.

Examples

Δείχνει πώς να ελέγξετε εάν ένα έγγραφο είναι προστατευμένο με κωδικό πρόσβασης.

// The path to the documents directory.
                                                                  string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                  string fileName = Path.Combine(dataDir, "Aspose.one");

                                                                  Document document;
                                                                  if (!Document.IsEncrypted(fileName, out document))
                                                                  {
                                                                      Console.WriteLine("The document is loaded and ready to be processed.");
                                                                  }
                                                                  else
                                                                  {
                                                                      Console.WriteLine("The document is encrypted. Provide a password.");
                                                                  }

Δείχνει πώς να ελέγξετε εάν ένα έγγραφο προστατεύεται από έναν συγκεκριμένο κωδικό πρόσβασης.

// The path to the documents directory.
                                                                                       string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                                       string fileName = Path.Combine(dataDir, "Aspose.one");

                                                                                       Document document;
                                                                                       if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
                                                                                       {
                                                                                           if (document != null)
                                                                                           {
                                                                                               Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
                                                                                           }
                                                                                           else
                                                                                           {
                                                                                               Console.WriteLine("The document is encrypted. Invalid password was provided.");
                                                                                           }
                                                                                       }
                                                                                       else
                                                                                       {
                                                                                           Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
                                                                                       }

IsEncrypted(Σύνδεσμος, έγγραφο)

Ελέγξτε αν ένα έγγραφο από μια ροή είναι κρυπτογραφημένο.Για να το ελέγξουμε πρέπει να φορτίσουμε πλήρως αυτό το έγγραφο. έτσι αυτή η μέθοδος μπορεί να οδηγήσει σε ποινή απόδοσης.

public static bool IsEncrypted(Stream stream, out Document document)

Parameters

stream Stream

Το ρεύμα.

document Document

Το φορτισμένο έγγραφο.

Returns

bool

Επιστρέφει αληθινό εάν το έγγραφο κρυπτογραφείται διαφορετικά ψεύτικο.

Examples

Δείχνει πώς να ελέγξετε εάν ένα έγγραφο είναι προστατευμένο με κωδικό πρόσβασης.

// The path to the documents directory.
                                                                  string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                  string fileName = Path.Combine(dataDir, "Aspose.one");

                                                                  Document document;
                                                                  if (!Document.IsEncrypted(fileName, out document))
                                                                  {
                                                                      Console.WriteLine("The document is loaded and ready to be processed.");
                                                                  }
                                                                  else
                                                                  {
                                                                      Console.WriteLine("The document is encrypted. Provide a password.");
                                                                  }

Δείχνει πώς να ελέγξετε εάν ένα έγγραφο προστατεύεται από έναν συγκεκριμένο κωδικό πρόσβασης.

// The path to the documents directory.
                                                                                       string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                                       string fileName = Path.Combine(dataDir, "Aspose.one");

                                                                                       Document document;
                                                                                       if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
                                                                                       {
                                                                                           if (document != null)
                                                                                           {
                                                                                               Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
                                                                                           }
                                                                                           else
                                                                                           {
                                                                                               Console.WriteLine("The document is encrypted. Invalid password was provided.");
                                                                                           }
                                                                                       }
                                                                                       else
                                                                                       {
                                                                                           Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
                                                                                       }

IsEncrypted(Σύνδεσμος, LoadOptions, Out Document)

Ελέγξτε αν ένα έγγραφο από ένα αρχείο είναι κρυπτογραφημένο.Για να το ελέγξουμε πρέπει να φορτίσουμε πλήρως αυτό το έγγραφο. έτσι αυτή η μέθοδος μπορεί να οδηγήσει σε ποινή απόδοσης.

public static bool IsEncrypted(string filePath, LoadOptions options, out Document document)

Parameters

filePath string

Ο δρόμος του αρχείου.

options LoadOptions

Οι επιλογές φορτίου.

document Document

Το φορτισμένο έγγραφο.

Returns

bool

Επιστρέφει αληθινό εάν το έγγραφο κρυπτογραφείται διαφορετικά ψεύτικο.

Examples

Δείχνει πώς να ελέγξετε εάν ένα έγγραφο είναι προστατευμένο με κωδικό πρόσβασης.

// The path to the documents directory.
                                                                  string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                  string fileName = Path.Combine(dataDir, "Aspose.one");

                                                                  Document document;
                                                                  if (!Document.IsEncrypted(fileName, out document))
                                                                  {
                                                                      Console.WriteLine("The document is loaded and ready to be processed.");
                                                                  }
                                                                  else
                                                                  {
                                                                      Console.WriteLine("The document is encrypted. Provide a password.");
                                                                  }

Δείχνει πώς να ελέγξετε εάν ένα έγγραφο προστατεύεται από έναν συγκεκριμένο κωδικό πρόσβασης.

// The path to the documents directory.
                                                                                       string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                                       string fileName = Path.Combine(dataDir, "Aspose.one");

                                                                                       Document document;
                                                                                       if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
                                                                                       {
                                                                                           if (document != null)
                                                                                           {
                                                                                               Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
                                                                                           }
                                                                                           else
                                                                                           {
                                                                                               Console.WriteLine("The document is encrypted. Invalid password was provided.");
                                                                                           }
                                                                                       }
                                                                                       else
                                                                                       {
                                                                                           Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
                                                                                       }

IsEncrypted(Σύνδεσμος, έγγραφο)

Ελέγξτε αν ένα έγγραφο από ένα αρχείο είναι κρυπτογραφημένο.Για να το ελέγξουμε πρέπει να φορτίσουμε πλήρως αυτό το έγγραφο. έτσι αυτή η μέθοδος μπορεί να οδηγήσει σε ποινή απόδοσης.

public static bool IsEncrypted(string filePath, out Document document)

Parameters

filePath string

Ο δρόμος του αρχείου.

document Document

Το φορτισμένο έγγραφο.

Returns

bool

Επιστρέφει αληθινό εάν το έγγραφο κρυπτογραφείται διαφορετικά ψεύτικο.

Examples

Δείχνει πώς να ελέγξετε εάν ένα έγγραφο είναι προστατευμένο με κωδικό πρόσβασης.

// The path to the documents directory.
                                                                  string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                  string fileName = Path.Combine(dataDir, "Aspose.one");

                                                                  Document document;
                                                                  if (!Document.IsEncrypted(fileName, out document))
                                                                  {
                                                                      Console.WriteLine("The document is loaded and ready to be processed.");
                                                                  }
                                                                  else
                                                                  {
                                                                      Console.WriteLine("The document is encrypted. Provide a password.");
                                                                  }

Δείχνει πώς να ελέγξετε εάν ένα έγγραφο προστατεύεται από έναν συγκεκριμένο κωδικό πρόσβασης.

// The path to the documents directory.
                                                                                       string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                                       string fileName = Path.Combine(dataDir, "Aspose.one");

                                                                                       Document document;
                                                                                       if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
                                                                                       {
                                                                                           if (document != null)
                                                                                           {
                                                                                               Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
                                                                                           }
                                                                                           else
                                                                                           {
                                                                                               Console.WriteLine("The document is encrypted. Invalid password was provided.");
                                                                                           }
                                                                                       }
                                                                                       else
                                                                                       {
                                                                                           Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
                                                                                       }

IsEncrypted(Σύνδεσμος, String, Out Document)

Ελέγξτε αν ένα έγγραφο από ένα αρχείο είναι κρυπτογραφημένο.Για να το ελέγξουμε πρέπει να φορτίσουμε πλήρως αυτό το έγγραφο. έτσι αυτή η μέθοδος μπορεί να οδηγήσει σε ποινή απόδοσης.

public static bool IsEncrypted(string filePath, string password, out Document document)

Parameters

filePath string

Ο δρόμος του αρχείου.

password string

Ο κωδικός πρόσβασης για να αποκρυπτογραφήσει ένα έγγραφο.

document Document

Το φορτισμένο έγγραφο.

Returns

bool

Επιστρέφει αληθινό εάν το έγγραφο κρυπτογραφείται διαφορετικά ψεύτικο.

Examples

Δείχνει πώς να ελέγξετε εάν ένα έγγραφο είναι προστατευμένο με κωδικό πρόσβασης.

// The path to the documents directory.
                                                                  string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                  string fileName = Path.Combine(dataDir, "Aspose.one");

                                                                  Document document;
                                                                  if (!Document.IsEncrypted(fileName, out document))
                                                                  {
                                                                      Console.WriteLine("The document is loaded and ready to be processed.");
                                                                  }
                                                                  else
                                                                  {
                                                                      Console.WriteLine("The document is encrypted. Provide a password.");
                                                                  }

Δείχνει πώς να ελέγξετε εάν ένα έγγραφο προστατεύεται από έναν συγκεκριμένο κωδικό πρόσβασης.

// The path to the documents directory.
                                                                                       string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                                       string fileName = Path.Combine(dataDir, "Aspose.one");

                                                                                       Document document;
                                                                                       if (Document.IsEncrypted(fileName, "VerySecretPassword", out document))
                                                                                       {
                                                                                           if (document != null)
                                                                                           {
                                                                                               Console.WriteLine("The document is decrypted. It is loaded and ready to be processed.");
                                                                                           }
                                                                                           else
                                                                                           {
                                                                                               Console.WriteLine("The document is encrypted. Invalid password was provided.");
                                                                                           }
                                                                                       }
                                                                                       else
                                                                                       {
                                                                                           Console.WriteLine("The document is NOT encrypted. It is loaded and ready to be processed.");
                                                                                       }

Merge(Αριθμός σελίδων>Επιλογές MergeOptions)

Μεταφέρετε ένα σύνολο σελίδων στο έγγραφο.

public Document Merge(IEnumerable<page> pages, MergeOptions mergeOptions = null)

Parameters

pages IEnumerable &lt · Page >

Ένα σύνολο σελίδων.

mergeOptions MergeOptions

Προσδιορίζει τις επιλογές πώς να συγχωνεύσετε τις παρεχόμενες σελίδες.

Returns

Document

Επιστρέφει την αναφορά στο έγγραφο.

Examples

Δείχνει πώς να εισαγάγετε όλες τις σελίδες από ένα έγγραφο PDF που ομαδοποιεί κάθε 5 σελίδα σε μια ενιαία σελίδα του OneNote.

string dataDir = RunExamples.GetDataDir_Import();

                                                                                                           var d = new Document();

                                                                                                           var mergeOptions = new MergeOptions() { ImportAsSinglePage = true, PageSpacing = 100 };

                                                                                                           IEnumerable<page> pages = PdfImporter.Import(Path.Combine(dataDir, "SampleGrouping.pdf"));
                                                                                                           while (pages.Any())
                                                                                                           {
                                                                                                               d.Merge(pages.Take(5), mergeOptions);
                                                                                                               pages = pages.Skip(5);
                                                                                                           }

                                                                                                           d.Save(Path.Combine(dataDir, "sample_CustomMerge.one"));</page>

Print()

Εκτυπώστε το έγγραφο χρησιμοποιώντας τον προεπιλεγμένο εκτυπωτή.

public void Print()

Examples

Δείχνει πώς να στείλετε ένα έγγραφο σε έναν εκτυπωτή χρησιμοποιώντας τον κανονικό διάλογο των Windows με προεπιλεγμένες επιλογές.

// The path to the documents directory.
                                                                                                      string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                                      var document = new Aspose.Note.Document(dataDir + "Aspose.one");

                                                                                                      document.Print();

Δείχνει πώς να στείλετε ένα έγγραφο σε έναν εκτυπωτή χρησιμοποιώντας ένα προεπιλεγμένο διάλογο Windows με καθορισμένες επιλογές.

// The path to the documents directory.
                                                                                                        string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                                        var document = new Aspose.Note.Document(dataDir + "Aspose.one");

                                                                                                        var printerSettings = new PrinterSettings() { FromPage = 0, ToPage = 10 };
                                                                                                        printerSettings.DefaultPageSettings.Landscape = true;
                                                                                                        printerSettings.DefaultPageSettings.Margins = new System.Drawing.Printing.Margins(50, 50, 150, 50);

                                                                                                        document.Print(new PrintOptions()
                                                                                                                       {
                                                                                                                           PrinterSettings = printerSettings,
                                                                                                                           Resolution = 1200,
                                                                                                                           PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(),
                                                                                                                           DocumentName = "Test.one"
                                                                                                                       });

Print(PrintOptions)

Εκτυπώστε το έγγραφο χρησιμοποιώντας τον προεπιλεγμένο εκτυπωτή.

public void Print(PrintOptions options)

Parameters

options PrintOptions

Επιλογές που χρησιμοποιούνται για την εκτύπωση ενός εγγράφου. μπορεί να είναι μηδέν.

Save(Σύνδεσμος)

Αποθηκεύει το έγγραφο OneNote σε ένα αρχείο.

public void Save(string fileName)

Parameters

fileName string

Το πλήρες όνομα του αρχείου.Εάν ένα αρχείο με το καθορισμένο πλήρη όνομα ήδη υπάρχει, το υφιστάμενο αρχεία υπεργραφεί.

Examples

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο.

string inputFile = "Sample1.one";
                                        string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                        string outputFile = "SaveDocToOneNoteFormat_out.one";

                                        Document doc = new Document(dataDir + inputFile);
                                        doc.Save(dataDir + outputFile);

Exceptions

IncorrectDocumentStructureException

Η δομή του εγγράφου παραβιάζει τις προδιαγραφές.

UnsupportedSaveFormatException

Η απαιτούμενη μορφή αποθήκευσης δεν υποστηρίζεται.

Save(Stream)

Αποθηκεύει το έγγραφο του OneNote σε μια ροή.

public void Save(Stream stream)

Parameters

stream Stream

Το System.IO.Stream όπου θα αποθηκευτεί το έγγραφο.

Exceptions

IncorrectDocumentStructureException

Η δομή του εγγράφου παραβιάζει τις προδιαγραφές.

UnsupportedSaveFormatException

Η απαιτούμενη μορφή αποθήκευσης δεν υποστηρίζεται.

Save(Σύνδεσμος, SaveFormat)

Αποθηκεύει το έγγραφο του OneNote σε ένα αρχείο στην καθορισμένη μορφή.

public void Save(string fileName, SaveFormat format)

Parameters

fileName string

Το πλήρες όνομα του αρχείου.Εάν ένα αρχείο με το καθορισμένο πλήρη όνομα ήδη υπάρχει, το υφιστάμενο αρχεία υπεργραφεί.

format SaveFormat

Η μορφή στην οποία να αποθηκεύσετε το έγγραφο.

Examples

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο χρησιμοποιώντας τον κατάλογο SaveFormat.

string inputFile = "Sample1.one";
                                                                     string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                                     string outputFile = "SaveDocToOneNoteFormatUsingSaveFormat_out.one";

                                                                     Document document = new Document(dataDir + inputFile);

                                                                     document.Save(dataDir + outputFile, SaveFormat.One);

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μορφή gif.

// The path to the documents directory.
                                                      string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                      // Load the document into Aspose.Note.
                                                      Document oneFile = new Document(dataDir + "Aspose.one");

                                                      dataDir = dataDir + "SaveToImageDefaultOptions_out.gif";

                                                      // Save the document as gif.
                                                      oneFile.Save(dataDir, SaveFormat.Gif);

Exceptions

IncorrectDocumentStructureException

Η δομή του εγγράφου παραβιάζει τις προδιαγραφές.

UnsupportedSaveFormatException

Η απαιτούμενη μορφή αποθήκευσης δεν υποστηρίζεται.

Save(Σύνδεση, SaveFormat)

Αποθηκεύει το έγγραφο του OneNote σε μια ροή στην καθορισμένη μορφή.

public void Save(Stream stream, SaveFormat format)

Parameters

stream Stream

Το System.IO.Stream όπου θα αποθηκευτεί το έγγραφο.

format SaveFormat

Η μορφή στην οποία να αποθηκεύσετε το έγγραφο.

Examples

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μορφή pdf χρησιμοποιώντας προεπιλεγμένες ρυθμίσεις.

// The path to the documents directory.
                                                                             string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                             // Load the document into Aspose.Note.
                                                                             Document oneFile = new Document(dataDir + "Aspose.one");

                                                                             // Save the document as PDF
                                                                             dataDir = dataDir + "SaveWithDefaultSettings_out.pdf";
                                                                             oneFile.Save(dataDir, SaveFormat.Pdf);

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μια ροή.

// The path to the documents directory.
                                                    string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                    // Load the document into Aspose.Note.
                                                    Document doc = new Document(dataDir + "Aspose.one");

                                                    MemoryStream dstStream = new MemoryStream();
                                                    doc.Save(dstStream, SaveFormat.Pdf);

                                                    // Rewind the stream position back to zero so it is ready for next reader.
                                                    dstStream.Seek(0, SeekOrigin.Begin);

Δείχνει πώς να εφαρμόσετε το στυλ Dark theme σε ένα έγγραφο.

// The path to the documents directory.
                                                             string dataDir = RunExamples.GetDataDir_Text();

                                                             // Load the document into Aspose.Note.
                                                             Document doc = new Document(Path.Combine(dataDir, "Aspose.one"));

                                                             foreach (var page in doc)
                                                             {
                                                                 page.BackgroundColor = Color.Black;
                                                             }

                                                             foreach (var node in doc.GetChildNodes<richtext>())
                                                             {
                                                                 var c = node.ParagraphStyle.FontColor;
                                                                 if (c.IsEmpty || Math.Abs(c.R - Color.Black.R) + Math.Abs(c.G - Color.Black.G) + Math.Abs(c.B - Color.Black.B) &lt;= 30)
                                                                 {
                                                                     node.ParagraphStyle.FontColor = Color.White;
                                                                 }
                                                             }

                                                             doc.Save(Path.Combine(dataDir, "AsposeDarkTheme.pdf"));</richtext>

Exceptions

IncorrectDocumentStructureException

Η δομή του εγγράφου παραβιάζει τις προδιαγραφές.

UnsupportedSaveFormatException

Η απαιτούμενη μορφή αποθήκευσης δεν υποστηρίζεται.

Save(Σύνδεσμος, SaveOptions)

Αποθηκεύει το έγγραφο του OneNote σε ένα αρχείο χρησιμοποιώντας τις επιλογές αποθήκευσης που καθορίζονται.

public void Save(string fileName, SaveOptions options)

Parameters

fileName string

Το πλήρες όνομα του αρχείου.Εάν ένα αρχείο με το καθορισμένο πλήρη όνομα ήδη υπάρχει, το υφιστάμενο αρχεία υπεργραφεί.

options SaveOptions

Προσδιορίζει τις επιλογές πώς αποθηκεύεται το έγγραφο στο αρχείο.

Examples

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο χρησιμοποιώντας OneSaveOptions.

string inputFile = "Sample1.one";
                                                             string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
                                                             string outputFile = "SaveDocToOneNoteFormatUsingOneSaveOptions_out.one";

                                                             Document document = new Document(dataDir + inputFile);

                                                             document.Save(dataDir + outputFile, new OneSaveOptions());

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο ως εικόνα σε μορφή JPEG χρησιμοποιώντας το SaveFormat.

// The path to the documents directory.
                                                                                 string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                 // Load the document into Aspose.Note.
                                                                                 Document oneFile = new Document(dataDir + "Aspose.one");

                                                                                 dataDir = dataDir + "SaveToJpegImageUsingSaveFormat_out.jpg";

                                                                                 // Save the document.
                                                                                 oneFile.Save(dataDir, SaveFormat.Jpeg);

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο ως εικόνα σε μορφή Bmp χρησιμοποιώντας ImageSaveOptions.

// The path to the documents directory.
                                                                                      string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                      // Load the document into Aspose.Note.
                                                                                      Document oneFile = new Document(dataDir + "Aspose.one");

                                                                                      dataDir = dataDir + "SaveToBmpImageUsingImageSaveOptions_out.bmp";

                                                                                      // Save the document.
                                                                                      oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Bmp));

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μορφή PDF με τη διάταξη σελίδας Letter.

// The path to the documents directory.
                                                                              string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                              // Load the document into Aspose.Note.
                                                                              Document oneFile = new Document(dataDir + "OneNote.one");

                                                                              var dst = Path.Combine(dataDir, "SaveToPdfUsingLetterPageSettings.pdf");

                                                                              // Save the document.
                                                                              oneFile.Save(dst, new PdfSaveOptions() { PageSettings = PageSettings.Letter });

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μορφή PDF με διάταξη σελίδας A4 χωρίς όριο ύψους.

// The path to the documents directory.
                                                                                               string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                               // Load the document into Aspose.Note.
                                                                                               Document oneFile = new Document(dataDir + "OneNote.one");

                                                                                               var dst = Path.Combine(dataDir, "SaveToPdfUsingA4PageSettingsWithoutHeightLimit.pdf");

                                                                                               // Save the document.
                                                                                               oneFile.Save(dst, new PdfSaveOptions() { PageSettings = PageSettings.A4NoHeightLimit });

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο ως γραφική εικόνα.

// The path to the documents directory.
                                                           string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                           // Load the document into Aspose.Note.
                                                           Document oneFile = new Document(dataDir + "Aspose.one");

                                                           dataDir = dataDir + "SaveAsGrayscaleImage_out.png";

                                                           // Save the document as gif.
                                                           oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
                                                                                     {
                                                                                         ColorMode = ColorMode.GrayScale
                                                                                     });

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο ως εικόνα σε μορφή Tiff χρησιμοποιώντας την συμπίεση PackBits.

// The path to the documents directory.
                                                                                           string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                           // Load the document into Aspose.Note.
                                                                                           Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));

                                                                                           var dst = Path.Combine(dataDir, "SaveToTiffUsingPackBitsCompression.tiff");

                                                                                           // Save the document.
                                                                                           oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
                                                                                                                 {
                                                                                                                     TiffCompression = TiffCompression.PackBits
                                                                                                                 });

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο ως εικόνα σε μορφή Tiff χρησιμοποιώντας Jpeg συμπίεση.

// The path to the documents directory.
                                                                                       string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                       // Load the document into Aspose.Note.
                                                                                       Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));

                                                                                       var dst = Path.Combine(dataDir, "SaveToTiffUsingJpegCompression.tiff");

                                                                                       // Save the document.
                                                                                       oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
                                                                                                             {
                                                                                                                 TiffCompression = TiffCompression.Jpeg,
                                                                                                                 Quality = 93
                                                                                                             });

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο ως εικόνα σε μορφή Tiff χρησιμοποιώντας συμπίεση φαξ CCITT Group 3.

// The path to the documents directory.
                                                                                                    string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                                    // Load the document into Aspose.Note.
                                                                                                    Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));

                                                                                                    var dst = Path.Combine(dataDir, "SaveToTiffUsingCcitt3Compression.tiff");

                                                                                                    // Save the document.
                                                                                                    oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
                                                                                                                          {
                                                                                                                              ColorMode = ColorMode.BlackAndWhite,
                                                                                                                              TiffCompression = TiffCompression.Ccitt3
                                                                                                                          });

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μορφή PDF.

// The path to the documents directory.
                                                      string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                      // Load the document into Aspose.Note.
                                                      Document oneFile = new Document(dataDir + "Aspose.one");

                                                      // Initialize PdfSaveOptions object
                                                      PdfSaveOptions opts = new PdfSaveOptions
                                                                                {
                                                                                    // Set page index of first page to be saved
                                                                                    PageIndex = 0,

                                                                                    // Set page count
                                                                                    PageCount = 1,
                                                                                };

                                                      // Save the document as PDF
                                                      dataDir = dataDir + "SaveRangeOfPagesAsPDF_out.pdf";
                                                      oneFile.Save(dataDir, opts);

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μορφή pdf χρησιμοποιώντας συγκεκριμένες ρυθμίσεις.

// The path to the documents directory.
                                                                              string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                              // Load the document into Aspose.Note.
                                                                              Document doc = new Document(dataDir + "Aspose.one");

                                                                              // Initialize PdfSaveOptions object
                                                                              PdfSaveOptions opts = new PdfSaveOptions
                                                                                                        {
                                                                                                            // Use Jpeg compression
                                                                                                            ImageCompression = Saving.Pdf.PdfImageCompression.Jpeg,

                                                                                                            // Quality for JPEG compression
                                                                                                            JpegQuality = 90
                                                                                                        };

                                                                              dataDir = dataDir + "Document.SaveWithOptions_out.pdf";
                                                                              doc.Save(dataDir, opts);

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο ως δυαδική εικόνα χρησιμοποιώντας τη μέθοδο του Otsu.

// The path to the documents directory.
                                                                            string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                            // Load the document into Aspose.Note.
                                                                            Document oneFile = new Document(dataDir + "Aspose.one");

                                                                            dataDir = dataDir + "SaveToBinaryImageUsingOtsuMethod_out.png";

                                                                            // Save the document as gif.
                                                                            oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
                                                                                                    {
                                                                                                        ColorMode = ColorMode.BlackAndWhite,
                                                                                                        BinarizationOptions = new ImageBinarizationOptions()
                                                                                                                              {
                                                                                                                                  BinarizationMethod = BinarizationMethod.Otsu,
                                                                                                                              }
                                                                                                    });

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο ως δυαδική εικόνα χρησιμοποιώντας ένα σταθερό όριο.

// The path to the documents directory.
                                                                              string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                              // Load the document into Aspose.Note.
                                                                              Document oneFile = new Document(dataDir + "Aspose.one");

                                                                              dataDir = dataDir + "SaveToBinaryImageUsingFixedThreshold_out.png";

                                                                              // Save the document as gif.
                                                                              oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
                                                                                                        {
                                                                                                            ColorMode = ColorMode.BlackAndWhite,
                                                                                                            BinarizationOptions = new ImageBinarizationOptions()
                                                                                                                                      {
                                                                                                                                          BinarizationMethod = BinarizationMethod.FixedThreshold,
                                                                                                                                          BinarizationThreshold = 123
                                                                                                                                      }
                                                                                                        });

Exceptions

IncorrectDocumentStructureException

Η δομή του εγγράφου παραβιάζει τις προδιαγραφές.

UnsupportedSaveFormatException

Η απαιτούμενη μορφή αποθήκευσης δεν υποστηρίζεται.

Save(Δραστηριότητες, SaveOptions)

Αποθηκεύει το έγγραφο του OneNote σε μια ροή χρησιμοποιώντας τις επιλογές αποθήκευσης που καθορίζονται.

public void Save(Stream stream, SaveOptions options)

Parameters

stream Stream

Το System.IO.Stream όπου θα αποθηκευτεί το έγγραφο.

options SaveOptions

Προσδιορίζει τις επιλογές πώς αποθηκεύεται το έγγραφο σε ρεύμα.

Examples

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μορφή pdf χρησιμοποιώντας μια καθορισμένη προεπιλεγμένη γραμματοσειρά.

// The path to the documents directory.
                                                                                   string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                   // Load the document into Aspose.Note.
                                                                                   Document oneFile = new Document(Path.Combine(dataDir, "missing-font.one"));

                                                                                   // Save the document as PDF
                                                                                   dataDir = dataDir + "SaveUsingDocumentFontsSubsystemWithDefaultFontName_out.pdf";
                                                                                   oneFile.Save(dataDir, new PdfSaveOptions() 
                                                                                                         {
                                                                                                             FontsSubsystem = DocumentFontsSubsystem.UsingDefaultFont("Times New Roman")
                                                                                                         });

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μορφή pdf χρησιμοποιώντας προεπιλεγμένη γραμματοσειρά από ένα αρχείο.

// The path to the documents directory.
                                                                                     string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                     string fontFile = Path.Combine(dataDir, "geo_1.ttf");

                                                                                     // Load the document into Aspose.Note.
                                                                                     Document oneFile = new Document(Path.Combine(dataDir, "missing-font.one"));

                                                                                     // Save the document as PDF
                                                                                     dataDir = dataDir + "SaveUsingDocumentFontsSubsystemWithDefaultFontFromFile_out.pdf";
                                                                                     oneFile.Save(dataDir, new PdfSaveOptions()
                                                                                                               {
                                                                                                                   FontsSubsystem = DocumentFontsSubsystem.UsingDefaultFontFromFile(fontFile)
                                                                                                               });

Δείχνει πώς να αποθηκεύσετε ένα έγγραφο σε μορφή pdf χρησιμοποιώντας προεπιλεγμένη γραμματοσειρά από μια ροή.

// The path to the documents directory.
                                                                                       string dataDir = RunExamples.GetDataDir_LoadingAndSaving();

                                                                                       string fontFile = Path.Combine(dataDir, "geo_1.ttf");

                                                                                       // Load the document into Aspose.Note.
                                                                                       Document oneFile = new Document(Path.Combine(dataDir, "missing-font.one"));

                                                                                       // Save the document as PDF
                                                                                       dataDir = dataDir + "SaveUsingDocumentFontsSubsystemWithDefaultFontFromStream_out.pdf";

                                                                                       using (var stream = File.Open(fontFile, FileMode.Open, FileAccess.Read, FileShare.Read))
                                                                                       {
                                                                                           oneFile.Save(dataDir, new PdfSaveOptions()
                                                                                                                     {
                                                                                                                         FontsSubsystem = DocumentFontsSubsystem.UsingDefaultFontFromStream(stream)
                                                                                                                     });
                                                                                       }

Exceptions

IncorrectDocumentStructureException

Η δομή του εγγράφου παραβιάζει τις προδιαγραφές.

UnsupportedSaveFormatException

Η απαιτούμενη μορφή αποθήκευσης δεν υποστηρίζεται.

 Ελληνικά