Class SaveOptions

Class SaveOptions

ชื่อพื้นที่: Aspose.Note.Saving การประกอบ: Aspose.Note.dll (25.4.0)

คลาสพื้นฐานที่อธิบายตัวเลือกการบันทึกเอกสารสําหรับรูปแบบที่เฉพาะเจาะจง

public abstract class SaveOptions

Inheritance

object SaveOptions

Derived

HtmlSaveOptions , ImageSaveOptions , OneSaveOptions , PdfSaveOptions

อนุญาโตตุลาการ

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

Constructors

SaveOptions(SaveFormat)

เปิดตัวตัวอย่างใหม่ของ Aspose.Note.SavingOptions คลาส

protected SaveOptions(SaveFormat saveFormat)

Parameters

saveFormat SaveFormat

การประหยัดรูปแบบ

Properties

FontsSubsystem

รับหรือตั้งค่าตัวอักษรที่จะใช้ในขณะที่บันทึก

public FontsSubsystem FontsSubsystem { get; set; }

คุณสมบัติมูลค่า

FontsSubsystem

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 โดยใช้ตัวอักษรที่กําหนดเองจาก Stream

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

PageCount

รับหรือตั้งค่าจํานวนหน้าที่จะบันทึก โดยเริ่มต้นคือ System.Int32.MaxValueซึ่งหมายความว่าหน้าทั้งหมดของเอกสารจะถูกนําเสนอ

public int PageCount { get; set; }

คุณสมบัติมูลค่า

int

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

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

แสดงวิธีการสร้างเอกสารและบันทึกในรูปแบบ 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
                                                                                                             });

PageIndex

รับหรือตั้งค่าดัชนีของหน้าแรกเพื่อบันทึก โดยเริ่มต้นเป็น 0.

public int PageIndex { get; set; }

คุณสมบัติมูลค่า

int

Examples

แสดงวิธีการบันทึกเอกสารในรูปแบบ 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);

แสดงวิธีการบันทึกเอกสารในรูปแบบ 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);

แสดงวิธีการสร้างเอกสารและบันทึกในรูปแบบ 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 Document();

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

                                                                   // Initialize Title class object
                                                                   Title title = new Title();

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

                                                                   RichText titleText = new RichText() { ParagraphStyle = defaultTextStyle }.Append("Title!");
                                                                   Outline outline = new Outline()
                                                                                         {
                                                                                             VerticalOffset = 100,
                                                                                             HorizontalOffset = 100
                                                                                         };
                                                                   OutlineElement outlineElem = new OutlineElement();

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

                                                                   TextStyle textStyleForOneNoteWord = new TextStyle
                                                                                                           {
                                                                                                               FontColor = Color.Green,
                                                                                                               FontName = "Calibri",
                                                                                                               FontSize = 10,
                                                                                                               IsItalic = true,
                                                                                                           };

                                                                   TextStyle textStyleForTextWord = new TextStyle
                                                                                                        {
                                                                                                            FontColor = Color.Blue,
                                                                                                            FontName = "Arial",
                                                                                                            FontSize = 15,
                                                                                                            IsBold = true,
                                                                                                            IsItalic = true,
                                                                                                        };

                                                                   RichText text = new RichText() { ParagraphStyle = defaultTextStyle }
                                                                                       .Append("Hello", textStyleForHelloWord)
                                                                                       .Append(" OneNote", textStyleForOneNoteWord)
                                                                                       .Append(" text", textStyleForTextWord)
                                                                                       .Append("!", TextStyle.Default);

                                                                   title.TitleText = titleText;

                                                                   // Set page title
                                                                   page.Title = title;

                                                                   // 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 + "CreateDocWithFormattedRichText_out.one";
                                                                   doc.Save(dataDir);

SaveFormat

ได้รับรูปแบบที่เอกสารจะถูกบันทึกไว้

public SaveFormat SaveFormat { get; }

คุณสมบัติมูลค่า

SaveFormat

 แบบไทย