XpsSaveOptionsSaveFormat Property

Specifies the format in which the document will be saved if this save options object is used. Can only be Xps.

Namespace:  Aspose.Words.Saving
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public override SaveFormat SaveFormat { get; set; }

Property Value

Type: SaveFormat
Examples
Shows how to save a document to the XPS format in different ways.
// Open the document
Document doc = new Document(MyDir + "Rendering.docx");

// Save document to file in the XPS format with default options
doc.Save(ArtifactsDir + "Rendering.SaveAsXps.DefaultOptions.xps");

// Save document to stream in the XPS format with default options
FileStream docStream = new FileStream(ArtifactsDir + "Rendering.SaveAsXps.FromStream.xps", FileMode.Create);
doc.Save(docStream, SaveFormat.Xps);
docStream.Close();

// Save document to file in the XPS format with specified options
// Render 3 pages starting from page 2; pages 2, 3 and 4
XpsSaveOptions xpsOptions = new XpsSaveOptions();
xpsOptions.SaveFormat = SaveFormat.Xps;
xpsOptions.PageIndex = 1;
xpsOptions.PageCount = 3;

// All paragraphs in the "Heading 1" style will be included in the outline but "Heading 2" and onwards won't
xpsOptions.OutlineOptions.HeadingsOutlineLevels = 1;

doc.Save(ArtifactsDir + "Rendering.SaveAsXps.PartialDocument.xps", xpsOptions);
See Also