Class SaveOptions

Class SaveOptions

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

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

public abstract class SaveOptions
   {
       private bool _htmlOutput;
       private string _outputFilePath;
       private bool _encodingDetected;
       private Encoding _encoding;
       private int _defaultFontSize;
       private Unit _defaultFontSizeUnit;
       public bool HtmlOutput
       {
           get { return _htmlOutput; }
           set { _htmlOutput = value; }
       }
       public string OutputFilePath
       {
           get { return _outputFilePath; }
           set { _outputFilePath = value; }
       }
       public bool EncodingDetected
       {
           get { return _encodingDetected; }
           set { _encodingDetected = value; }
       }
       public Encoding Encoding
       {
           get { return _encoding; }
           set { _encoding = value; }
       }
       public int DefaultFontSize
       {
           get { return _defaultFontSize; }
           set { _defaultFontSize = value; }
       }
       public Unit DefaultFontSizeUnit
       {
           get { return _defaultFontSizeUnit; }
           set { _defaultFontSizeUnit = value; }
       }
   }

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)

یک مثال جدید از کلاس Aspose.Note.Saving.saveOptions آغاز می شود.

protected SaveOptions SaveOptions(SaveFormat saveFormat)
   {
   }

Parameters

saveFormat SaveFormat

ذخیره سازی فرمت

Properties

FontsSubsystem

دریافت یا تنظیم تنظیمات فونت برای استفاده در حالی که صرفه جویی

public FontsSubsystem FontsSubsystem { get; set; }

ارزش املاک

FontsSubsystem

Examples

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

string dataDir = RunExamples.GetDataDir_LoadingAndSaving();
   Document oneFile = new Document(Path.Combine(dataDir, "missing-font.one"));
   string dataDirWithOutput = dataDir + "SaveUsingDocumentFontsSubsystemWithDefaultFontName_out.pdf";
   oneFile.Save(dataDirWithOutput, 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 dataDirWithOutputPath = dataDir + "SaveUsingDocumentFontsSubsystemWithDefaultFontFromFile_out.pdf";
   oneFile.Save(dataDirWithOutputPath, 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)
       });
   }

PageCount

دریافت یا تنظیم تعداد صفحات برای ذخیره.به طور پیش فرض System.Int32.MaxValue است.این به این معنی است که تمام صفحات این سند بازگردانده خواهد شد.

public int PageCount
   {
      get;
      set;
   }

ارزش املاک

int

Examples

نشان می دهد که چگونه یک سند را در فرمت 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);

نشان می دهد که چگونه برای ایجاد یک سند و ذخیره در فرمت 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
   });

PageIndex

دریافت یا قرار دادن شاخص صفحه اول برای ذخیره.به طور پیش فرض 0.

public int PageIndex
   {
      get;
      set;
   }

ارزش املاک

int

Examples

نشان می دهد که چگونه یک سند را در فرمت 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);

نشان می دهد که چگونه یک سند را در فرمت 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 = dataDir + "Document.SaveWithOptions_out.pdf";
   doc.Save(dataDir, opts);

نشان می دهد که چگونه برای ایجاد یک سند و ذخیره در فرمت 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();
   Document doc = new Document();
   Page page = new Page();
   Title title = new Title();
   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;
   page.Title = title;
   outlineElem.AppendChildLast(text);
   outline.AppendChildLast(outlineElem);
   page.AppendChildLast(outline);
   doc.AppendChildLast(page);
   dataDir = dataDir + "CreateDocWithFormattedRichText_out.one";
   doc.Save(dataDir);

SaveFormat

فرمت که در آن اسناد ذخیره می شود را دریافت کنید.

public SaveFormat GetSaveFormat()
   {
      return this.SaveFormat;
   }

ارزش املاک

SaveFormat

 فارسی