Class Document

Class Document

اسم الفضاء : Aspose.Note تجميع: Aspose.Note.dll (25.4.0)

يقدم وثيقة Aspose.Note.

public class Document : CompositeNode<Page>, INode, ICompositeNode<Page>, ICompositeNode, IEnumerable<Page>, IEnumerable, INotebookChildNode
{
}

Inheritance

object Node CompositeNodeBase CompositeNode Document

Implements

INode , ICompositeNode , ICompositeNode , IEnumerable , IEnumerable , INotebookChildNode

الأعضاء الموروثين

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

Examples

يظهر كيفية إرسال المستند إلى الطابعة باستخدام الحوار القياسي لنظام التشغيل Windows مع الخيارات الافتراضية.

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

إظهار كيفية الحصول على وثيقة مشفرة.

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

إظهار كيفية حفظ المستند مع التشفير.

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

إظهار كيفية الحصول على عدد الصفحات من وثيقة.

string dataDir = RunExamples.GetDataDir_Pages();
   Document oneFile = new Document(dataDir + "Aspose.one");
   int count = oneFile.Count();
   Console.WriteLine(count);

يظهر كيفية حفظ وثيقة في تنسيق PDF باستخدام الإعدادات الافتراضية.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   dataDir += "SaveWithDefaultSettings_out.pdf";
   oneFile.Save(dataDir, SaveFormat.Pdf);

يظهر كيفية حفظ وثيقة في تنسيق GIF.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   dataDir += "SaveToImageDefaultOptions_out.gif";
   oneFile.Save(dataDir, SaveFormat.Gif);

يظهر كيفية تعيين جودة الصورة عند حفظ المستند كصورة في تنسيق JPEG.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document(dataDir + "Aspose.one");
   dataDir = dataDir + "SetOutputImageResolution_out.jpg";
   doc.Save(dataDir, new ImageSaveOptions(SaveFormat.Jpeg) { Quality = 100 });

يظهر كيفية تعيين دقة الصورة عند حفظ المستند كصورة.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document(dataDir + "Aspose.one");
   int resolution = 220;
   dataDir = dataDir + "SetOutputImageResolution_out.jpg";
   doc.Save(dataDir, new ImageSaveOptions(SaveFormat.Jpeg) { Resolution = resolution });

إظهار كيفية الحصول على تنسيق ملف وثيقة.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   var document = new Aspose.Note.Document(dataDir + "Aspose.one");
   switch (document.FileFormat)
   {
       case FileFormat.OneNote2010:
           break;
       case FileFormat.OneNoteOnline:
           break;
   }

يظهر كيفية ربط الرابط إلى صورة.

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

إظهار كيفية حفظ وثيقة إلى تدفق.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document(dataDir + "Aspose.one");
   MemoryStream dstStream = new MemoryStream();
   doc.Save(dstStream, SaveFormat.Pdf);
   dstStream.Seek(0, SeekOrigin.Begin);

إظهار كيفية التحقق مما إذا كان المستند محمي كلمة المرور.

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

يظهر كيفية إضافة قسم جديد إلى الكمبيوتر المحمول.

string dataDir = RunExamples.GetDataDir_NoteBook();
   var notebook = new Notebook(dataDir + "Notizbuch Öffnen.onetoc2");
   notebook.AppendChild(new Document(dataDir + "Neuer Abschnitt 1.one"));
   dataDir += @"\AddChildNode_out.onetoc2";
   notebook.Save(dataDir);

يظهر كيفية التحقق من فشل تحميل المستند لأن تنسيق OneNote 2007 غير مدعوم.

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

إظهار كيفية استعادة النسخة السابقة من الصفحة.

string dataDir = RunExamples.GetDataDir_Pages();
   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");

إظهار كيفية استنساخ صفحة

string dataDir = RunExamples.GetDataDir_Pages();
   Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
   var cloned = new Document();
   cloned.AppendChildLast(document.FirstChild.Clone());
   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);

إظهار كيفية تعيين وصف النص للصورة.

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 += "ImageAlternativeText_out.one";
   document.Save(dataDir);

إظهار كيفية الحصول على معلومات ميتا حول صفحة.

string dataDir = RunExamples.GetDataDir_Pages();
   Aspose.Words.Document oneFile = new Aspose.Words.Document(dataDir + "Aspose.one");
   foreach (Aspose.Words.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 يتم تقسيمها بين الصفحات.تظهر العينة كيفية تكوين منطق الانقسام للأشياء الموجودة على فجوات الصفحة.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document(dataDir + "Aspose.one");
   var pdfSaveOptions = new PdfSaveOptions();
   pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(100);
   pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(400);
   dataDir = dataDir + "PageSplittUsingKeepPartAndCloneSolidObjectToNextPageAlgorithm_out.pdf";
   doc.Save(dataDir, pdfSaveOptions);

يظهر كيفية حفظ وثيقة في تنسيق png.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   ImageSaveOptions opts = new ImageSaveOptions(SaveFormat.Png)
   {
      PageIndex = 1
   };
   dataDir += "ConvertSpecificPageToImage_out.png";
   oneFile.Save(dataDir, opts);

إظهار كيفية تحرير تاريخ الصفحة.

string dataDir = RunExamples.GetDataDir_Pages();
   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 > 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");
   }

يظهر كيفية التحقق مما إذا كان المستند يحمي كلمة مرور محددة.

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

إظهار كيفية تطبيق نمط الموضوع الداكن على وثيقة.

string dataDir = RunExamples.GetDataDir_Text();
   Document doc = new Document(Path.Combine(dataDir, "Aspose.one"));
   foreach (var page in doc)
   {
       page.BackgroundColor = Color.Black;
   }
   foreach (var node in doc.GetChildNodes<Aspose.Words.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) <= 30)
       {
           node.ParagraphStyle.FontColor = Color.White;
       }
   }
   doc.Save(Path.Combine(dataDir, "AsposeDarkTheme.pdf"));

يظهر كيفية الانتقال من خلال محتوى الكمبيوتر المحمول.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   string fileName = "Open Notebook.onetoc2";
   try
   {
       var notebook = new Notebook(dataDir + fileName);
       foreach (var notebookChildNode in notebook)
       {
           Console.WriteLine(notebookChildNode.DisplayName);
           if (notebookChildNode is Document)
           {
           }
           else if (notebookChildNode is Notebook)
           {
           }
       }
   }
   catch (Exception ex)
   {
       Console.WriteLine(ex.Message);
   }

إظهار كيفية الحصول على صورة من وثيقة.

string dataDir = RunExamples.GetDataDir_Images();
   Document oneFile = new Document(dataDir + "Aspose.one");
   IList<aspose.note.Image> nodes = oneFile.GetChildNodes<aspose.note.Image>();
   foreach (var image in nodes)
   {
       using (MemoryStream stream = new MemoryStream(image.Bytes))
       {
           using (Bitmap bitMap = new Bitmap(stream))
           {
               bitMap.Save(Path.Combine(dataDir, Path.GetFileName(image.FileName)));
           }
       }
   }

يظهر كيفية حفظ وثيقة في تنسيق PDF.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   PdfSaveOptions opts = new PdfSaveOptions()
   {
       PageIndex = 0,
       PageCount = 1,
   };
   dataDir += "SaveRangeOfPagesAsPDF_out.pdf";
   oneFile.Save(dataDir, opts);

يظهر كيفية حفظ وثيقة في تنسيق PDF باستخدام إعدادات محددة.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document(dataDir + "Aspose.one");
   PdfSaveOptions opts = new PdfSaveOptions()
   {
      ImageCompression = Saving.Pdf.PdfImageCompression.Jpeg,
      JpegQuality = 90
   };
   dataDir += "Document.SaveWithOptions_out.pdf";
   doc.Save(dataDir, opts);

يظهر كيفية إرسال المستند إلى الطابعة باستخدام الحوار القياسي لنظام التشغيل Windows مع الخيارات المحددة.

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

إظهار كيفية الحصول على محتوى من ملف مرفق.

string dataDir = RunExamples.GetDataDir_Attachments();
   Document oneFile = new Document(dataDir + "Sample1.one");
   IList<attachedfile> nodes = oneFile.GetChildNodes<attachedfile>();
   foreach (AttachedFile file in nodes)
   {
       using (Stream outputStream = new MemoryStream(file.Bytes))
       {
           using (System.IO.FileStream fileStream = System.IO.File.OpenWrite(String.Format(dataDir + file.FileName)))
           {
               CopyStream(outputStream, fileStream);
           }
       }
   }

إظهار كيفية الحصول على المعلومات الميتا للصورة.

string dataDir = RunExamples.GetDataDir_Images();
   Document oneFile = new Document(dataDir + "Aspose.one");
   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();
   }

إظهار كيفية الحصول على تاريخ الصفحة.

string dataDir = RunExamples.GetDataDir_Pages();
   Document document = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
   Page firstPage = document.FirstChild;
   foreach (Page pageRevision in document.GetPageHistory(firstPage))
   {
       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();
   }

يظهر كيفية إضافة ملف إلى وثيقة باستخدام مسار الملفات.

string dataDir = RunExamples.GetDataDir_Attachments();
   Document doc = new Document();
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   Outline outline = new Outline(doc);
   OutlineElement outlineElem = new OutlineElement(doc);
   AttachedFile attachedFile = new AttachedFile(doc, dataDir + "attachment.txt");
   outlineElem.AppendChildLast(attachedFile);
   outline.AppendChildLast(outlineElem);
   page.AppendChildLast(outline);
   doc.AppendChildLast(page);
   dataDir += "AttachFileByPath_out.one";
   doc.Save(dataDir);

يظهر كيفية إنشاء وثيقة وتخزينها في تنسيق html باستخدام خيارات الافتراضية.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document();
   Page page = doc.AppendChildLast(new Page());
   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 }
   };
   dataDir = dataDir + "CreateOneNoteDocAndSaveToHTML_out.html";
   doc.Save(dataDir);

يظهر كيفية التحقق مما إذا كانت الصفحة صفحة نزاع (أي أن لديها تغييرات لم يتمكن OneNote من الاندماج تلقائيًا).

string dataDir = RunExamples.GetDataDir_Pages();
   Document doc = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
   var history = doc.GetPageHistory(doc.FirstChild);
   for (int i = 0; i < 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);
       if (historyPage.IsConflictPage)
           historyPage.IsConflictPage = false;
   }
   doc.Save(dataDir + "ConflictPageManipulation_out.one", SaveFormat.One);

يظهر كيفية إضافة صورة من ملف إلى وثيقة تحتوي على خصائص محددة للمستخدم.

string dataDir = RunExamples.GetDataDir_Images();
   Document doc = new Document(dataDir + "Aspose.one");
   Aspose.Note.Page page = doc.FirstChild;
   Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "image.jpg")
      {
         Width = 100,
         Height = 100,
         HorizontalOffset = 100,
         VerticalOffset = 400,
         Alignment = HorizontalAlignment.Right
      };
   page.AppendChildLast(image);

يظهر كيفية إضافة ملف من تدفق إلى وثيقة.

string dataDir = RunExamples.GetDataDir_Attachments();
   Document doc = new Document();
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   Outline outline = new Outline(doc);
   OutlineElement outlineElem = new OutlineElement(doc);
   using (var stream = File.OpenRead(dataDir + "icon.jpg"))
   {
       AttachedFile attachedFile = new AttachedFile(doc, dataDir + "attachment.txt", stream, ImageFormat.Jpeg);
       outlineElem.AppendChildLast(attachedFile);
   }
   outline.AppendChildLast(outlineElem);
   page.AppendChildLast(outline);
   doc.AppendChildLast(page);
   dataDir += "AttachFileAndSetIcon_out.one";
   doc.Save(dataDir);

عندما يتم حفظ صفحات OneNote الطويلة في تنسيق pdf يتم تقسيمها بين الصفحات.تظهر المثال كيفية تكوين منطق الانقسام للأشياء الموجودة على فجوات الصفحة.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document(dataDir + "Aspose.one");
   var pdfSaveOptions = new PdfSaveOptions();
   pdfSaveOptions.PageSplittingAlgorithm = new AlwaysSplitObjectsAlgorithm();
   pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm();
   pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm();
   float heightLimitOfClonedPart = 500;
   pdfSaveOptions.PageSplittingAlgorithm = new KeepPartAndCloneSolidObjectToNextPageAlgorithm(heightLimitOfClonedPart);
   pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(heightLimitOfClonedPart);
   pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(100);
   pdfSaveOptions.PageSplittingAlgorithm = new KeepSolidObjectsAlgorithm(400);
   dataDir = dataDir + "UsingKeepSOlidObjectsAlgorithm_out.pdf";
   doc.Save(dataDir, pdfSaveOptions);

يظهر كيفية إنشاء وثيقة وتخزين في تنسيق html مجموعة محددة من الصفحات.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document();
   Page page = doc.AppendChildLast(new Page());
   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
      }
   };
   dataDir = dataDir + "CreateAndSavePageRange_out.html";
   doc.Save(dataDir, new HtmlSaveOptions
   {
      PageCount = 1,
      PageIndex = 0
   });

إظهار كيفية إنشاء وثيقة تحت عنوان الصفحة.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Aspose.Note.Document doc = new Aspose.Note.Document();
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   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 }
   };
   doc.AppendChildLast(page);
   dataDir += "CreateDocWithPageTitle_out.one";
   doc.Save(dataDir);

يظهر كيفية إضافة صورة من التدفق إلى وثيقة.

string dataDir = RunExamples.GetDataDir_Images();
   Document doc = new Document();
   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"))
   {
       Aspose.Note.Image image1 = new Aspose.Note.Image(doc, "Penguins.jpg", fs)
                                {
                                    Alignment = HorizontalAlignment.Right
                                };
       outlineElem1.AppendChildLast(image1);
   }
   outline1.AppendChildLast(outlineElem1);
   page.AppendChildLast(outline1);
   doc.AppendChildLast(page);
   dataDir = dataDir + "BuildDocAndInsertImageUsingImageStream_out.one";
   doc.Save(dataDir);

يظهر كيفية إضافة صورة من ملف إلى وثيقة.

string dataDir = RunExamples.GetDataDir_Images();
   Document doc = new Document();
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   Outline outline = new Outline(doc);
   OutlineElement outlineElem = new OutlineElement(doc);
   Aspose.Note.Image image = new Aspose.Note.Image(doc, dataDir + "image.jpg")
                               {
                                   Alignment = HorizontalAlignment.Right
                               };
   outlineElem.AppendChildLast(image);
   outline.AppendChildLast(outlineElem);
   page.AppendChildLast(outline);
   doc.AppendChildLast(page);
   dataDir = dataDir + "BuildDocAndInsertImage_out.one";
   doc.Save(dataDir);

إظهار كيفية إنشاء وثيقة مع نص.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document();
   Page page = new Page(doc);
   Outline outline = new Outline(doc);
   OutlineElement outlineElem = new OutlineElement(doc);
   ParagraphStyle textStyle = new ParagraphStyle
   {
      FontColor = Color.Black,
      FontName = "Arial",
      FontSize = 10
   };
   RichText text = new RichText(doc)
   {
      Text = "Hello OneNote text!",
      ParagraphStyle = textStyle
   };
   outlineElem.AppendChildLast(text);
   outline.AppendChildLast(outlineElem);
   page.AppendChildLast(outline);
   doc.AppendChildLast(page);
   dataDir += "CreateDocWithSimpleRichText_out.one";
   doc.Save(dataDir);

يظهر كيفية حفظ وثيقة في تنسيقات مختلفة.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document() { AutomaticLayoutChangesDetectionEnabled = false };
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   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 }
   };
   doc.AppendChildLast(page);
   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) باستخدام ردود الفعل المحددة من قبل المستخدم.

using System.IO;
   using Aspose.Words;
   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 */");
   }

يظهر كيفية ربط الرابط إلى نص.

string dataDir = RunExamples.GetDataDir_Tasks();
   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()
       .Append("This is ", textStyleRed)
       .Append("hyperlink", textStyleHyperlink)
       .Append(". This text is not a hyperlink.", TextStyle.Default);
   OutlineElement outlineElem = new OutlineElement();
   outlineElem.AppendChildLast(text);
   outline.AppendChildLast(outlineElem);
   Title title = new Title() { TitleText = titleText };
   Page page = new Note.Page() { Title = title };
   page.AppendChildLast(outline);
   doc.AppendChildLast(page);
   dataDir = dataDir + "AddHyperlink_out.one";
   doc.Save(dataDir);

إظهار كيفية الوصول إلى محتوى المستند باستخدام زائر.

public static void Run()
   {
       string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
       Document doc = new Document(dataDir + "Aspose.one");
       MyOneNoteToTxtWriter myConverter = new MyOneNoteToTxtWriter();
       doc.Accept(myConverter);
       Console.WriteLine(myConverter.GetText());
       Console.WriteLine(myConverter.NodeCount);
   }
   public class MyOneNoteToTxtWriter : DocumentVisitor
   {
       public MyOneNoteToTxtWriter()
       {
           NodeCount = 0;
           IsSkipText = false;
           Builder = new StringBuilder();
       }
       public string GetText()
       {
           return Builder.ToString();
       }
       private void AppendText(string text)
       {
           if (!IsSkipText)
           {
               Builder.AppendLine(text);
           }
       }
       public override void VisitRichTextStart(RichText run)
       {
           ++NodeCount;
           AppendText(run.Text);
       }
       public override void VisitDocumentStart(Document document)
       {
           ++NodeCount;
       }
       public override void VisitPageStart(Page page)
       {
           ++NodeCount;
           AppendText($"*** Page '{page.Title?.TitleText?.Text ?? "(no title)"}' ***");
       }
       public override void VisitPageEnd(Page page)
       {
           AppendText(string.Empty);
       }
       public override void VisitTitleStart(Title title)
       {
           ++NodeCount;
       }
       public override void VisitImageStart(Image image)
       {
           ++NodeCount;
       }
       public override void VisitOutlineGroupStart(OutlineGroup outlineGroup)
       {
           ++NodeCount;
       }
       public override void VisitOutlineStart(Outline outline)
       {
           ++NodeCount;
       }
       public override void VisitOutlineElementStart(OutlineElement outlineElement)
       {
           ++NodeCount;
       }
       public Int32 NodeCount
       {
           get { return this.nodeCount; }
       }
       private readonly StringBuilder Builder;
       private bool IsSkipText;
       private int nodeCount;
   }

Constructors

الوثيقة ( )

يبدأ مثال جديد من فئة Aspose.Note.Document.إنشاء مستند OneNote الأبيض.

public Document()
   {
   }

الوثيقة ( String )

يبدأ مثال جديد من فئة Aspose.Note.Document.يفتح مستند OneNote الحالي من ملف.

public Document(string filePath)
   {
   }

Parameters

filePath string

مسار الملفات

Exceptions

UnsupportedFileFormatException

لا يتم التعرف على تنسيق الوثيقة أو دعمها.

FileCorruptedException

يبدو أن الوثيقة قد تم تدميرها ولا يمكن تحميلها.

IncorrectPasswordException

يتم تشفير المستند ويحتاج إلى كلمة مرور لفتح، ولكن قدمت كلمة مرور غير صحيحة.

InvalidOperationException

هناك مشكلة مع الوثيقة وينبغي الإبلاغ عنها إلى مطوري Aspose.Note.

IOException

هناك استثناء الإدخال / الخروج.

الوثيقة (String, LoadOptions)

يبدأ مثال جديد من فئة Aspose.Note.Document.يفتح مستند OneNote الحالي من ملف يسمح بتحديد خيارات إضافية مثل كلمة مرور التشفير.

public Document(string filePath, LoadOptions loadOptions)
   {
   }

Parameters

filePath string

مسار الملفات

loadOptions LoadOptions

الخيارات المستخدمة لتحميل وثيقة.يمكن أن تكون صفر.

Exceptions

UnsupportedFileFormatException

لا يتم التعرف على تنسيق الوثيقة أو دعمها.

FileCorruptedException

يبدو أن الوثيقة قد تم تدميرها ولا يمكن تحميلها.

IncorrectPasswordException

يتم تشفير المستند ويحتاج إلى كلمة مرور لفتح، ولكن قدمت كلمة مرور غير صحيحة.

InvalidOperationException

هناك مشكلة مع الوثيقة وينبغي الإبلاغ عنها إلى مطوري Aspose.Note.

IOException

هناك استثناء الإدخال / الخروج.

الوثيقة ( Stream )

يبدأ مثال جديد من فئة Aspose.Note.Document.يفتح مستند OneNote الحالي من تدفق.

public Document(Stream inStream)
   {
   }

Parameters

inStream Stream

من التدفق .

Exceptions

UnsupportedFileFormatException

لا يتم التعرف على تنسيق الوثيقة أو دعمها.

FileCorruptedException

يبدو أن الوثيقة قد تم تدميرها ولا يمكن تحميلها.

IncorrectPasswordException

يتم تشفير المستند ويحتاج إلى كلمة مرور لفتح، ولكن قدمت كلمة مرور غير صحيحة.

InvalidOperationException

هناك مشكلة مع الوثيقة وينبغي الإبلاغ عنها إلى مطوري Aspose.Note.

IOException

هناك استثناء الإدخال / الخروج.

ArgumentException

تدفق لا يدعم القراءة، صفر، أو مغلقة بالفعل.

الوثيقة (Stream, LoadOptions)

يبدأ مثال جديد من فئة Aspose.Note.Document.يفتح مستند OneNote الحالي من تدفق يسمح بتحديد خيارات إضافية مثل كلمة مرور التشفير.

public Document(Stream inStream, LoadOptions loadOptions)
   {
   }

Parameters

inStream Stream

من التدفق .

loadOptions LoadOptions

الخيارات المستخدمة لتحميل وثيقة.يمكن أن تكون صفر.

Exceptions

UnsupportedFileFormatException

لا يتم التعرف على تنسيق الوثيقة أو دعمها.

FileCorruptedException

يبدو أن الوثيقة قد تم تدميرها ولا يمكن تحميلها.

IncorrectPasswordException

يتم تشفير المستند ويحتاج إلى كلمة مرور لفتح، ولكن قدمت كلمة مرور غير صحيحة.

InvalidOperationException

هناك مشكلة مع الوثيقة وينبغي الإبلاغ عنها إلى مطوري Aspose.Note.

IOException

هناك استثناء الإدخال / الخروج.

ArgumentException

تدفق لا يدعم القراءة، صفر، أو مغلقة بالفعل.

Properties

AutomaticLayoutChangesDetectionEnabled

يحصل أو يحدد قيمة تشير إلى ما إذا كان Aspose.Note يقوم بتحديد التغييرات التخطيطية تلقائيًا.القيمة الافتراضية هي “حقيقية”.

public bool AutomaticLayoutChangesDetectionEnabled
   {
      get;
      set;
   }

قيمة الممتلكات

bool

Examples

يظهر كيفية حفظ وثيقة في تنسيقات مختلفة.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document() { AutomaticLayoutChangesDetectionEnabled = false };
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   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 }
      };
   doc.AppendChildLast(page);
   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 { return this.Color; }
      set { this.Color = value; }
   }

قيمة الممتلكات

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

إظهار كيفية الحصول على تنسيق ملف وثيقة.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   var document = new Aspose.Note.Document(dataDir + "Aspose.one");
   switch (document.FileFormat)
   {
       case Aspose.Words.FileFormat.OneNote2010:
           break;
       case Aspose.Words.FileFormat.OneNoteOnline:
           break;
   }

Guid

يحصل على الهوية الفريدة عالميا للموضوع.

public Guid Guid
   {
      get;
   }

قيمة الممتلكات

Guid

Methods

الوصية ( مستندات الزيارة )

يقبل زائر العقد.

public override void Accept(DocumentVisitor visitor)
   {
   }

Parameters

visitor DocumentVisitor

موضوع فئة مشتقة من Aspose.Note.DocumentVisitor.

Examples

إظهار كيفية الوصول إلى محتوى المستند باستخدام زائر.

public static void Run()
   {
       string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
       Document doc = new Document(dataDir + "Aspose.one");
       MyOneNoteToTxtWriter myConverter = new MyOneNoteToTxtWriter();
       doc.Accept(myConverter);
       Console.WriteLine(myConverter.GetText());
       Console.WriteLine(myConverter.NodeCount);
   }
   public class MyOneNoteToTxtWriter : DocumentVisitor
   {
       public MyOneNoteToTxtWriter()
       {
           nodecount = 0;
           mIsSkipText = false;
           mBuilder = new StringBuilder();
       }
       public string GetText()
       {
           return mBuilder.ToString();
       }
       private void AppendText(string text)
       {
           if (!mIsSkipText)
           {
               mBuilder.AppendLine(text);
           }
       }
       public override void VisitRichTextStart(RichText run)
       {
           ++nodecount;
           AppendText(run.Text);
       }
       public override void VisitDocumentStart(Document document)
       {
           ++nodecount;
       }
       public override void VisitPageStart(Page page)
       {
           ++nodecount;
           this.AppendText($"*** Page '{page.Title?.TitleText?.Text ?? "(no title)"}' ***");
       }
       public override void VisitPageEnd(Page page)
       {
           this.AppendText(string.Empty);
       }
       public override void VisitTitleStart(Title title)
       {
           ++nodecount;
       }
       public override void VisitImageStart(Image image)
       {
           ++nodecount;
       }
       public override void VisitOutlineGroupStart(OutlineGroup outlineGroup)
       {
           ++nodecount;
       }
       public override void VisitOutlineStart(Outline outline)
       {
           ++nodecount;
       }
       public override void VisitOutlineElementStart(OutlineElement outlineElement)
       {
           ++nodecount;
       }
       public Int32 NodeCount
       {
           get { return this.nodecount; }
       }
       private readonly StringBuilder mBuilder;
       private bool mIsSkipText;
       private Int32 nodecount;
   }

تداول الخيارات الثنائية ()

يكتشف جميع التغييرات التي تم إجراؤها في ترتيب المستند منذ الاتصال السابق Aspose.Note.Document.DetectLayoutChanges.في الحالة Aspose.Note.Document.AutomaticLayoutChangesDetectionإعدادات محددة، تستخدم تلقائيا في بداية تصدير الوثيقة.

public void DetectLayoutChanges()
   {
   }

Examples

يظهر كيفية حفظ وثيقة في تنسيقات مختلفة.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document() { AutomaticLayoutChangesDetectionEnabled = false };
   Aspose.Note.Page page = new Aspose.Note.Page(doc);
   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
      }
   };
   doc.AppendChildLast(page);
   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");

GetPageالتاريخ(الصفحة)

يحصل على Aspose.Note.PageHistory الذي يحتوي على التاريخ الكامل لكل صفحة عرضت في وثيقة (أولها في المؤشر 0).يمكن الوصول إلى مراجعة الصفحة الحالية باسم Aspose.Note.PageHistory.Current وتحتوي بشكل منفصل عن مجموعة الإصدارات التاريخية.

public PageHistory GetPageHistory(Page page)
    {
    }
I have reformatted the given C# code by:
- Properly indented the method body and comments.
- Added a single space between the opening brace, method name, and opening parenthesis.
- Added a single line between the method signature and its implementation.
- Added two spaces for each level of nesting within the method body for improved readability.

Parameters

page Page

التعديل الحالي لصفحة واحدة.

Returns

PageHistory

صفحة تاريخية

Examples

إظهار كيفية استعادة النسخة السابقة من الصفحة.

string dataDir = RunExamples.GetDataDir_Pages();
   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");

إظهار كيفية تحرير تاريخ الصفحة.

string dataDir = RunExamples.GetDataDir_Pages();
   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 > 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();
   Document doc = new Document(dataDir + "Aspose.one", new LoadOptions { LoadHistory = true });
   var history = doc.GetPageHistory(doc.FirstChild);
   for (int i = 0; i < history.Count; i++)
   {
       var historyPage = history[i];
       Console.Write("    {0}. Author: ", i);
       Console.Write("{1}, ", historyPage.PageContentRevisionSummary.AuthorMostRecent);
       Console.WriteLine("{2:dd.MM.yyyy hh.mm.ss}", historyPage.PageContentRevisionSummary.LastModifiedTime);
       Console.WriteLine(historyPage.IsConflictPage ? ", IsConflict: true" : string.Empty);
       if (historyPage.IsConflictPage)
           historyPage.IsConflictPage = false;
   }
   doc.Save(dataDir + "ConflictPageManipulation_out.one", SaveFormat.One);

استيراد(السير، PdfImportOptions، MergeOption)

استيراد مجموعة من الصفحات من وثيقة PDF المقدمة.

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

Parameters

stream Stream

تدفق مع وثيقة PDF.

importOptions PdfImportOptions

يحدد خيارات كيفية استيراد الصفحات من وثيقة PDF.

mergeOptions MergeOptions

يحدد الخيارات كيفية دمج الصفحات المقدمة.

Returns

Document

إرجاع الإشارة إلى الوثيقة.

استيراد(String, PdfImportOptions, MergeOption)

استيراد مجموعة من الصفحات من وثيقة 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
            .SetTitleText(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"));

استيراد(السير، HtmlImportOptions، MergeOption)

استيراد مجموعة من الصفحات من وثيقة HTML المقدمة.

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

Parameters

stream Stream

سلم مع وثيقة HTML.

importOptions HtmlImportOptions

يحدد خيارات كيفية استيراد الصفحات من وثيقة HTML.

mergeOptions MergeOptions

يحدد الخيارات كيفية دمج الصفحات المقدمة.

Returns

Document

إرجاع الإشارة إلى الوثيقة.

استيراد(String, HtmlImportOptions, MergeOption)

استيراد مجموعة من الصفحات من وثيقة 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)
{
    document = null;
    try
    {
        document = new Document();
        document.Load(stream, options);
        return document.IsEncrypted;
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
    }
    return false;
}

Parameters

stream Stream

من التدفق .

options LoadOptions

خيارات الحمل .

document Document

الوثيقة المحمولة .

Returns

bool

يعود صحيحًا إذا تم تشفير المستند غير صحيح.

Examples

إظهار كيفية التحقق مما إذا كان المستند محمي كلمة المرور.

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

يظهر كيفية التحقق مما إذا كان المستند يحمي كلمة مرور محددة.

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)
{
    document = null;
    try
    {
        document = new Document();
        document.Load(stream, Aspose.Words.FileFormatUtil.DetectEncryptionType(stream), password);
    }
    catch (Exception ex)
    {
        return false;
    }
    return true;
}

Parameters

stream Stream

من التدفق .

password string

كلمة المرور لتشفير وثيقة.

document Document

الوثيقة المحمولة .

Returns

bool

يعود صحيحًا إذا تم تشفير المستند غير صحيح.

Examples

إظهار كيفية التحقق مما إذا كان المستند محمي كلمة المرور.

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

يظهر كيفية التحقق مما إذا كان المستند يحمي كلمة مرور محددة.

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

IsEncrypted (تدفق، خارج المستند)

التحقق مما إذا كان وثيقة من تدفق مصفوفة.للتحقق من ذلك نحن بحاجة إلى تحميل هذه الوثيقة تماما لذلك هذه الطريقة يمكن أن تؤدي إلى عقوبة الأداء.

public static bool IsEncrypted(Stream stream, out Document document)
{
    document = null;
    try
    {
        document = new Document();
        document.Load(stream);
        return document.EncryptionSettings != null && document.EncryptionSettings.IsEncrypted;
    }
    catch
    {
        document = null;
        throw;
    }
}

Parameters

stream Stream

من التدفق .

document Document

الوثيقة المحمولة .

Returns

bool

يعود صحيحًا إذا تم تشفير المستند غير صحيح.

Examples

إظهار كيفية التحقق مما إذا كان المستند محمي كلمة المرور.

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

يظهر كيفية التحقق مما إذا كان المستند يحمي كلمة مرور محددة.

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)
    {
        document = null;
        try
        {
            using (var doc = new Document(File.OpenRead(filePath), options))
            {
                document = doc;
                return false;
            }
        }
        catch (InvalidPasswordException ex)
        {
            document = null;
            return true;
        }
    }

Parameters

filePath string

مسار الملفات

options LoadOptions

خيارات الحمل .

document Document

الوثيقة المحمولة .

Returns

bool

يعود صحيحًا إذا تم تشفير المستند غير صحيح.

Examples

إظهار كيفية التحقق مما إذا كان المستند محمي كلمة المرور.

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

يظهر كيفية التحقق مما إذا كان المستند يحمي كلمة مرور محددة.

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، خارج المستند)

التحقق مما إذا كان المستند من الملف مشفرًا.للتحقق من ذلك نحن بحاجة إلى تحميل هذه الوثيقة تماما لذلك هذه الطريقة يمكن أن تؤدي إلى عقوبة الأداء.

public static bool IsEncrypted(string filePath, out Document document)
{
    document = null;
    try
    {
        Aspose.Words.Document asposeDoc = new Aspose.Words.Document(filePath);
        document = asposeDoc;
        return asposeDoc.ProtectionSettings.EncryptionInfo != null;
    }
    catch (Exception ex)
    {
    }
    document = null;
    return false;
}

Parameters

filePath string

مسار الملفات

document Document

الوثيقة المحمولة .

Returns

bool

يعود صحيحًا إذا تم تشفير المستند غير صحيح.

Examples

إظهار كيفية التحقق مما إذا كان المستند محمي كلمة المرور.

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

يظهر كيفية التحقق مما إذا كان المستند يحمي كلمة مرور محددة.

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، string، out Document)

التحقق مما إذا كان المستند من الملف مشفرًا.للتحقق من ذلك نحن بحاجة إلى تحميل هذه الوثيقة تماما لذلك هذه الطريقة يمكن أن تؤدي إلى عقوبة الأداء.

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

Parameters

filePath string

مسار الملفات

password string

كلمة المرور لتشفير وثيقة.

document Document

الوثيقة المحمولة .

Returns

bool

يعود صحيحًا إذا تم تشفير المستند غير صحيح.

Examples

إظهار كيفية التحقق مما إذا كان المستند محمي كلمة المرور.

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

يظهر كيفية التحقق مما إذا كان المستند يحمي كلمة مرور محددة.

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

مزيج ( غير قابل للتعديل )الخيارات الثنائية)

إرسال مجموعة من الصفحات إلى الوثيقة.

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

الطباعة ( )

طباعة المستند باستخدام الطابعة الافتراضية.

public void Print()
   {
   }

Examples

يظهر كيفية إرسال المستند إلى الطابعة باستخدام الحوار القياسي لنظام التشغيل Windows مع الخيارات الافتراضية.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   var document = new Aspose.Note.Document(dataDir + "Aspose.one");
   document.Print();

يظهر كيفية إرسال المستند إلى الطابعة باستخدام الحوار القياسي لنظام التشغيل Windows مع الخيارات المحددة.

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

طباعة المستند باستخدام الطابعة الافتراضية.

public void Print(PrintOptions options)
   {
   }

Parameters

options PrintOptions

الخيارات المستخدمة في طباعة وثيقة يمكن أن تكون صفر.

الحفاظ على ( 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

لا يتم دعم النموذج المطلوب.

حفظ (String ، SaveFormat)

تخزين مستند OneNote إلى ملف في التنسيق المحدد.

public void Save(string fileName, Aspose.Words.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.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   dataDir += "SaveToImageDefaultOptions_out.gif";
   oneFile.Save(dataDir, SaveFormat.Gif);

Exceptions

IncorrectDocumentStructureException

وتخالف هيكل الوثيقة المواصفات.

UnsupportedSaveFormatException

لا يتم دعم النموذج المطلوب.

حفظ (التيار، SaveFormat)

تخزين وثيقة OneNote إلى تدفق في التنسيق المحدد.

public void Save(Stream stream, SaveFormat format)
   {
   }

Parameters

stream Stream

نظام.IO.Stream حيث سيتم حفظ الوثيقة.

format SaveFormat

النموذج الذي يمكن حفظ الوثيقة.

Examples

يظهر كيفية حفظ وثيقة في تنسيق PDF باستخدام الإعدادات الافتراضية.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   string dataDirWithFileName = dataDir + "SaveWithDefaultSettings_out.pdf";
   oneFile.Save(dataDirWithFileName, SaveFormat.Pdf);

إظهار كيفية حفظ وثيقة إلى تدفق.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document(dataDir + "Aspose.one");
   MemoryStream dstStream = new MemoryStream();
   doc.Save(dstStream, SaveFormat.Pdf);
   dstStream.Seek(0, SeekOrigin.Begin);

إظهار كيفية تطبيق نمط الموضوع الداكن على وثيقة.

string dataDir = RunExamples.GetDataDir_Text();
   Document doc = new Document(Path.Combine(dataDir, "Aspose.one"));
   foreach (var page in doc)
   {
       page.BackgroundColor = Color.Black;
   }
   foreach (var node in doc.GetChildNodes<Aspose.Words.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) <= 30)
       {
           node.ParagraphStyle.FontColor = Color.White;
       }
   }
   doc.Save(Path.Combine(dataDir, "AsposeDarkTheme.pdf"));

Exceptions

IncorrectDocumentStructureException

وتخالف هيكل الوثيقة المواصفات.

UnsupportedSaveFormatException

لا يتم دعم النموذج المطلوب.

حفظ (String, 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.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   dataDir += "SaveToJpegImageUsingSaveFormat_out.jpg";
   oneFile.Save(dataDir, SaveFormat.Jpeg);

يظهر كيفية حفظ المستند كصورة في تنسيق Bmp باستخدام ImageSaveOptions.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   dataDir += "SaveToBmpImageUsingImageSaveOptions_out.bmp";
   oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Bmp));

يظهر كيفية حفظ وثيقة في تنسيق PDF مع ترتيب صفحة الرسالة.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "OneNote.one");
   var dst = Path.Combine(dataDir, "SaveToPdfUsingLetterPageSettings.pdf");
   oneFile.Save(dst, new PdfSaveOptions() { PageSettings = PageSettings.Letter });

يظهر كيفية حفظ وثيقة في تنسيق PDF مع ترتيب الصفحة A4 دون قيود الارتفاع.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "OneNote.one");
   var dst = Path.Combine(dataDir, "SaveToPdfUsingA4PageSettingsWithoutHeightLimit.pdf");
   oneFile.Save(dst, new PdfSaveOptions() { PageSettings = PageSettings.A4NoHeightLimit });

إظهار كيفية حفظ وثيقة كصورة على مقياس رمادي.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   dataDir += "SaveAsGrayscaleImage_out.png";
   oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
   {
      ColorMode = ColorMode.GrayScale
   });

يظهر كيفية حفظ المستند كصورة في تنسيق Tiff باستخدام ضغط PackBits.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));
   var dst = Path.Combine(dataDir, "SaveToTiffUsingPackBitsCompression.tiff");
   oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
                  {
                      TiffCompression = TiffCompression.PackBits
                  });

يظهر كيفية حفظ المستند كصورة في تنسيق Tiff باستخدام ضغط Jpeg.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));
   var dst = Path.Combine(dataDir, "SaveToTiffUsingJpegCompression.tiff");
   oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
   {
      TiffCompression = TiffCompression.Jpeg,
      Quality = 93
   });

يظهر كيفية حفظ المستند كصورة في تنسيق تيف باستخدام ضغط الفاكس CCITT Group 3.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(Path.Combine(dataDir, "Aspose.one"));
   var dst = Path.Combine(dataDir, "SaveToTiffUsingCcitt3Compression.tiff");
   oneFile.Save(dst, new ImageSaveOptions(SaveFormat.Tiff)
   {
      ColorMode = ColorMode.BlackAndWhite,
      TiffCompression = TiffCompression.Ccitt3
   });

يظهر كيفية حفظ وثيقة في تنسيق PDF.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   PdfSaveOptions opts = new PdfSaveOptions()
   {
      PageIndex = 0,
      PageCount = 1,
   };
   dataDir += "SaveRangeOfPagesAsPDF_out.pdf";
   oneFile.Save(dataDir, opts);

يظهر كيفية حفظ وثيقة في تنسيق PDF باستخدام إعدادات محددة.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document doc = new Document(dataDir + "Aspose.one");
   PdfSaveOptions opts = new PdfSaveOptions
   {
      ImageCompression = Saving.Pdf.PdfImageCompression.Jpeg,
      JpegQuality = 90
   };
   dataDir += "Document.SaveWithOptions_out.pdf";
   doc.Save(dataDir, opts);

إظهار كيفية حفظ وثيقة كصورة ثنائية باستخدام طريقة Otsu.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   dataDir += "SaveToBinaryImageUsingOtsuMethod_out.png";
   oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
   {
      ColorMode = ColorMode.BlackAndWhite,
      BinarizationOptions = new ImageBinarizationOptions()
      {
         BinarizationMethod = BinarizationMethod.Otsu,
      }
   });

يظهر كيفية حفظ وثيقة كصورة ثنائية باستخدام الحد الأقصى الثابت.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(dataDir + "Aspose.one");
   dataDir += "SaveToBinaryImageUsingFixedThreshold_out.png";
   oneFile.Save(dataDir, new ImageSaveOptions(SaveFormat.Png)
   {
       ColorMode = ColorMode.BlackAndWhite,
       BinarizationOptions = new ImageBinarizationOptions()
       {
           BinarizationMethod = BinarizationMethod.FixedThreshold,
           BinarizationThreshold = 123
       }
   });

Exceptions

IncorrectDocumentStructureException

وتخالف هيكل الوثيقة المواصفات.

UnsupportedSaveFormatException

لا يتم دعم النموذج المطلوب.

حفظ (دفق، خيارات حفظ)

حفظ مستند OneNote إلى تدفق باستخدام خيارات حفظ المحددة.

public void Save(Stream stream, SaveOptions options)
   {
   }

Parameters

stream Stream

نظام.IO.Stream حيث سيتم حفظ الوثيقة.

options SaveOptions

يحدد الخيارات كيف يتم حفظ المستند في التدفق.

Examples

يظهر كيفية حفظ وثيقة في تنسيق PDF باستخدام الخط الافتراضي المحدد.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(Path.Combine(dataDir, "missing-font.one"));
   string dataDirWithOutputPath = dataDir + "SaveUsingDocumentFontsSubsystemWithDefaultFontName_out.pdf";
   oneFile.Save(dataDirWithOutputPath, new PdfSaveOptions()
   {
       FontsSubsystem = DocumentFontsSubsystem.UsingDefaultFont("Times New Roman")
   });

يظهر كيفية حفظ وثيقة في تنسيق PDF باستخدام الخط الافتراضي من ملف.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   string fontFile = Path.Combine(dataDir, "geo_1.ttf");
   Document oneFile = new Document(Path.Combine(dataDir, "missing-font.one"));
   string outputFile = dataDir + "SaveUsingDocumentFontsSubsystemWithDefaultFontFromFile_out.pdf";
   oneFile.Save(outputFile, new PdfSaveOptions()
                              {
                                FontsSubsystem = DocumentFontsSubsystem.UsingDefaultFontFromFile(fontFile)
                              });

يظهر كيفية حفظ وثيقة في تنسيق pdf باستخدام الخط الافتراضي من تدفق.

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   string fontFile = Path.Combine(dataDir, "geo_1.ttf");
   Document oneFile = new Document(Path.Combine(dataDir, "missing-font.one"));
   string fullDataDir = dataDir + "SaveUsingDocumentFontsSubsystemWithDefaultFontFromStream_out.pdf";
   using (var stream = File.Open(fontFile, FileMode.Open, FileAccess.Read, FileShare.Read))
   {
       oneFile.Save(fullDataDir, new PdfSaveOptions()
       {
           FontsSubsystem = DocumentFontsSubsystem.UsingDefaultFontFromStream(stream)
       });
   }

Exceptions

IncorrectDocumentStructureException

وتخالف هيكل الوثيقة المواصفات.

UnsupportedSaveFormatException

لا يتم دعم النموذج المطلوب.

 عربي