Class Document

Class Document

نام ها : Aspose.Note جمع آوری: WL31_.dll (25.4.0)

یک سند WL31 را نشان می دهد.

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

نشان می دهد چگونه برای ارسال اسناد به یک چاپگر با استفاده از دیالوگ استاندارد ویندوز با گزینه های پیش فرض.

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

نشان می دهد که چگونه برای دریافت اطلاعات متا در مورد یک صفحه.

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

نشان می دهد که چگونه سبک موضوعی تاریک را به یک سند اعمال کنید.

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

نشان می دهد چگونه برای ارسال یک سند به یک چاپگر با استفاده از دیالوگ استاندارد ویندوز با گزینه های مشخص شده.

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

نشان می دهد که چگونه می توان اطلاعات متا تصویر را دریافت کرد.

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

یک مثال جدید از کلاس Aspose.Note.Document را آغاز می کند.یک سند OneNote موجود را از یک فایل باز کنید.

public Document(string filePath)

Parameters

filePath string

فایلهای مسیر

Exceptions

UnsupportedFileFormatException

فرمت اسناد به رسمیت شناخته نمی شود یا پشتیبانی نمی شود.

FileCorruptedException

به نظر می رسد که این سند فاسد است و نمی تواند بارگذاری شود.

IncorrectPasswordException

این سند رمزگذاری شده است و نیاز به یک رمز عبور برای باز کردن، اما شما یک رمز عبور نادرست ارائه شده است.

InvalidOperationException

یک مشکل با سند وجود دارد و باید به WL31_ توسعه دهندگان اطلاع داده شود.

IOException

یک استثنا ورودی / خروجی وجود دارد.

Document(بایگانی برچسب: LoadOptions)

یک مثال جدید از کلاس Aspose.Note.Document را آغاز می کند.یک سند OneNote موجود را از یک فایل باز می کند. اجازه می دهد تا گزینه های اضافی مانند رمز عبور را مشخص کنید.

public Document(string filePath, LoadOptions loadOptions)

Parameters

filePath string

فایلهای مسیر

loadOptions LoadOptions

گزینه های مورد استفاده برای بارگذاری یک سند می تواند صفر باشد.

Exceptions

UnsupportedFileFormatException

فرمت اسناد به رسمیت شناخته نمی شود یا پشتیبانی نمی شود.

FileCorruptedException

به نظر می رسد که این سند فاسد است و نمی تواند بارگذاری شود.

IncorrectPasswordException

این سند رمزگذاری شده است و نیاز به یک رمز عبور برای باز کردن، اما شما یک رمز عبور نادرست ارائه شده است.

InvalidOperationException

یک مشکل با سند وجود دارد و باید به WL31_ توسعه دهندگان اطلاع داده شود.

IOException

یک استثنا ورودی / خروجی وجود دارد.

Document(Stream)

یک مثال جدید از کلاس Aspose.Note.Document را آغاز می کند.یک سند OneNote موجود را از یک جریان باز می کند.

public Document(Stream inStream)

Parameters

inStream Stream

جریان است.

Exceptions

UnsupportedFileFormatException

فرمت اسناد به رسمیت شناخته نمی شود یا پشتیبانی نمی شود.

FileCorruptedException

به نظر می رسد که این سند فاسد است و نمی تواند بارگذاری شود.

IncorrectPasswordException

این سند رمزگذاری شده است و نیاز به یک رمز عبور برای باز کردن، اما شما یک رمز عبور نادرست ارائه شده است.

InvalidOperationException

یک مشکل با سند وجود دارد و باید به WL31_ توسعه دهندگان اطلاع داده شود.

IOException

یک استثنا ورودی / خروجی وجود دارد.

ArgumentException

این جریان از خواندن پشتیبانی نمی کند، صفر است یا در حال حاضر بسته است.

Document(جریان، LoadOptions)

یک مثال جدید از کلاس Aspose.Note.Document را آغاز می کند.یک سند OneNote موجود را از یک جریان باز می کند. اجازه می دهد تا گزینه های اضافی مانند رمز عبور را مشخص کنید.

public Document(Stream inStream, LoadOptions loadOptions)

Parameters

inStream Stream

جریان است.

loadOptions LoadOptions

گزینه های مورد استفاده برای بارگذاری یک سند می تواند صفر باشد.

Exceptions

UnsupportedFileFormatException

فرمت اسناد به رسمیت شناخته نمی شود یا پشتیبانی نمی شود.

FileCorruptedException

به نظر می رسد که این سند فاسد است و نمی تواند بارگذاری شود.

IncorrectPasswordException

این سند رمزگذاری شده است و نیاز به یک رمز عبور برای باز کردن، اما شما یک رمز عبور نادرست ارائه شده است.

InvalidOperationException

یک مشکل با سند وجود دارد و باید به WL31_ توسعه دهندگان اطلاع داده شود.

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

شناسه جهانی منحصر به فرد اشیاء را دریافت می کند.

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.AutomaticLayoutChangesDetectionEnabled تنظیم شده به درست، به طور خودکار در ابتدای صادرات اسناد استفاده می شود.

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

_WL31 _ صفحه تاریخچه

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)

وارد مجموعه ای از صفحات از اسناد 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)

وارد مجموعه ای از صفحات از یک سند HTML ارائه شده است.

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

Parameters

stream Stream

یک جریان با سند HTML.

importOptions HtmlImportOptions

گزینه هایی را مشخص می کند که چگونه صفحات را از یک سند HTML وارد کنید.

mergeOptions MergeOptions

گزینه ها را مشخص می کند که چگونه صفحات ارائه شده را ادغام کنیم.

Returns

Document

بازگرداندن مرجع به این سند.

Import(بایگانی برچسب ها: HtmlImportOptions)

وارد مجموعه ای از صفحات از یک سند HTML ارائه شده است.

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

Parameters

file string

یک فایل با اسناد HTML

importOptions HtmlImportOptions

گزینه هایی را مشخص می کند که چگونه صفحات را از یک سند HTML وارد کنید.

mergeOptions MergeOptions

گزینه ها را مشخص می کند که چگونه صفحات ارائه شده را ادغام کنیم.

Returns

Document

بازگرداندن مرجع به این سند.

IsEncrypted(جریان، LoadOptions، خارج از اسناد)

بررسی کنید که آیا یک سند از یک جریان رمزگذاری شده است.برای بررسی آن باید این سند را به طور کامل بارگذاری کنیم، بنابراین این روش می تواند منجر به اجرای مجازات شود.

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(جریان، ردیف، خارج از سند)

بررسی کنید که آیا یک سند از یک جریان رمزگذاری شده است.برای بررسی آن باید این سند را به طور کامل بارگذاری کنیم، بنابراین این روش می تواند منجر به اجرای مجازات شود.

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(بایگانی برچسب ها: Out Document)

بررسی کنید که آیا یک سند از یک جریان رمزگذاری شده است.برای بررسی آن باید این سند را به طور کامل بارگذاری کنیم، بنابراین این روش می تواند منجر به اجرای مجازات شود.

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(String، LoadOptions، خارج از اسناد)

بررسی کنید که آیا یک سند از یک فایل رمزگذاری شده است.برای بررسی آن باید این سند را به طور کامل بارگذاری کنیم، بنابراین این روش می تواند منجر به اجرای مجازات شود.

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(بایگانی برچسب ها: Out Document)

بررسی کنید که آیا یک سند از یک فایل رمزگذاری شده است.برای بررسی آن باید این سند را به طور کامل بارگذاری کنیم، بنابراین این روش می تواند منجر به اجرای مجازات شود.

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

نشان می دهد چگونه برای ارسال اسناد به یک چاپگر با استفاده از دیالوگ استاندارد ویندوز با گزینه های پیش فرض.

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

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

                                                                                                      document.Print();

نشان می دهد چگونه برای ارسال یک سند به یک چاپگر با استفاده از دیالوگ استاندارد ویندوز با گزینه های مشخص شده.

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

فایل 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

سیستم.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

سیستم.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);

نشان می دهد که چگونه سبک موضوعی تاریک را به یک سند اعمال کنید.

// 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 با طرح صفحه نامه ذخیره کنید.

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

سیستم.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

فرمت ذخیره درخواست شده پشتیبانی نمی شود.

 فارسی