SaveFormat
Contents
[
Hide
]XpsSaveOptions.SaveFormat property
Specifies the format in which the document will be saved if this save options object is used. Can only be Xps.
public override SaveFormat SaveFormat { get; set; }
Examples
Shows how to limit the headings’ level that will appear in the outline of a saved XPS document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// Insert headings that can serve as TOC entries of levels 1, 2, and then 3.
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading1;
Assert.True(builder.ParagraphFormat.IsHeading);
builder.Writeln("Heading 1");
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading2;
builder.Writeln("Heading 1.1");
builder.Writeln("Heading 1.2");
builder.ParagraphFormat.StyleIdentifier = StyleIdentifier.Heading3;
builder.Writeln("Heading 1.2.1");
builder.Writeln("Heading 1.2.2");
// Create an "XpsSaveOptions" object that we can pass to the document's "Save" method
// to modify how that method converts the document to .XPS.
XpsSaveOptions saveOptions = new XpsSaveOptions();
Assert.AreEqual(SaveFormat.Xps, saveOptions.SaveFormat);
// The output XPS document will contain an outline, a table of contents that lists headings in the document body.
// Clicking on an entry in this outline will take us to the location of its respective heading.
// Set the "HeadingsOutlineLevels" property to "2" to exclude all headings whose levels are above 2 from the outline.
// The last two headings we have inserted above will not appear.
saveOptions.OutlineOptions.HeadingsOutlineLevels = 2;
doc.Save(ArtifactsDir + "XpsSaveOptions.OutlineLevels.xps", saveOptions);
See Also
- enum SaveFormat
- class XpsSaveOptions
- namespace Aspose.Words.Saving
- assembly Aspose.Words