XamlFlowSaveOptions Class

Can be used to specify additional options when saving a document into the XamlFlow or XamlFlowPack format.

ExpandedInheritance Hierarchy

Namespace:  Aspose.Words.Saving
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.10.0

ExpandedSyntax

public class XamlFlowSaveOptions : SaveOptions

The XamlFlowSaveOptions type exposes the following members.

ExpandedConstructors

  NameDescription
Public methodCode exampleXamlFlowSaveOptions
Initializes a new instance of this class that can be used to save a document in the XamlFlow format.
Public methodCode exampleXamlFlowSaveOptions(SaveFormat)
Initializes a new instance of this class that can be used to save a document in the XamlFlow or XamlFlowPack format.

ExpandedProperties

  NameDescription
Public propertyCode exampleDefaultTemplate
Gets or sets path to default template (including filename). Default value for this property is empty string (Empty).
(Inherited from SaveOptions.)
Public propertyDml3DEffectsRenderingMode
Gets or sets a value determining how 3D effects are rendered.
(Inherited from SaveOptions.)
Public propertyCode exampleDmlEffectsRenderingMode
Gets or sets a value determining how DrawingML effects are rendered.
(Inherited from SaveOptions.)
Public propertyCode exampleDmlRenderingMode
Gets or sets a value determining how DrawingML shapes are rendered.
(Inherited from SaveOptions.)
Public propertyCode exampleImageSavingCallback
Allows to control how images are saved when a document is saved to XAML.
Public propertyCode exampleImagesFolder
Specifies the physical folder where images are saved when exporting a document to XAML format. Default is an empty string.
Public propertyCode exampleImagesFolderAlias
Specifies the name of the folder used to construct image URIs written into an XAML document. Default is an empty string.
Public propertyCode exampleMemoryOptimization
Gets or sets value determining if memory optimization should be performed before saving the document. Default value for this property is false.
(Inherited from SaveOptions.)
Public propertyCode examplePrettyFormat
When true, pretty formats output where applicable. Default value is false.
(Inherited from SaveOptions.)
Public propertyCode exampleSaveFormat
Specifies the format in which the document will be saved if this save options object is used. Can only be XamlFlow.
(Overrides SaveOptionsSaveFormat.)
Public propertyCode exampleTempFolder
Specifies the folder for temporary files used when saving to a DOC or DOCX file. By default this property is null and no temporary files are used.
(Inherited from SaveOptions.)
Public propertyCode exampleUpdateFields
Gets or sets a value determining if fields of certain types should be updated before saving the document to a fixed page format. Default value for this property is true.
(Inherited from SaveOptions.)
Public propertyCode exampleUpdateLastPrintedProperty
Gets or sets a value determining whether the LastPrinted property is updated before saving.
(Inherited from SaveOptions.)
Public propertyCode exampleUpdateLastSavedTimeProperty
Gets or sets a value determining whether the LastSavedTime property is updated before saving.
(Inherited from SaveOptions.)
Public propertyCode exampleUpdateSdtContent
Gets or sets value determining whether content of StructuredDocumentTag is updated before saving.
(Inherited from SaveOptions.)
Public propertyCode exampleUseAntiAliasing
Gets or sets a value determining whether or not to use anti-aliasing for rendering.
(Inherited from SaveOptions.)
Public propertyCode exampleUseHighQualityRendering
Gets or sets a value determining whether or not to use high quality (i.e. slow) rendering algorithms.
(Inherited from SaveOptions.)

ExpandedMethods

  NameDescription
Public methodEquals (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Public methodToString (Inherited from Object.)

ExpandedExamples

Shows how to print the filenames of linked images created during conversion of a document to flow-form .xaml.
public void ImageFolder()
{
    // Open a document which contains images
    Document doc = new Document(MyDir + "Rendering.docx");

    ImageUriPrinter callback = new ImageUriPrinter(ArtifactsDir + "XamlFlowImageFolderAlias");

    XamlFlowSaveOptions options = new XamlFlowSaveOptions
    {
        SaveFormat = SaveFormat.XamlFlow,
        ImagesFolder = ArtifactsDir + "XamlFlowImageFolder",
        ImagesFolderAlias = ArtifactsDir + "XamlFlowImageFolderAlias",
        ImageSavingCallback = callback
    };

    // A folder specified by ImagesFolderAlias will contain the images instead of ImagesFolder
    // We must ensure the folder exists before the streams can put their images into it
    Directory.CreateDirectory(options.ImagesFolderAlias);

    doc.Save(ArtifactsDir + "XamlFlowSaveOptions.ImageFolder.xaml", options);

    foreach (string resource in callback.Resources)
        Console.WriteLine($"{callback.ImagesFolderAlias}/{resource}");
}

/// <summary>
/// Counts and prints filenames of images while their parent document is converted to flow-form .xaml.
/// </summary>
private class ImageUriPrinter : IImageSavingCallback
{
    public ImageUriPrinter(string imagesFolderAlias)
    {
        ImagesFolderAlias = imagesFolderAlias;
        Resources = new List<string>();
    }

    void IImageSavingCallback.ImageSaving(ImageSavingArgs args)
    {
        Resources.Add(args.ImageFileName);

        // If we specified a ImagesFolderAlias we will also need to redirect each stream to put its image in that folder
        args.ImageStream = new FileStream($"{ImagesFolderAlias}/{args.ImageFileName}", FileMode.Create);
        args.KeepImageStreamOpen = false;
    }

    public string ImagesFolderAlias { get; }
    public List<string> Resources { get; }
}

ExpandedSee Also