ResourceFolderAlias

HtmlSaveOptions.ResourceFolderAlias property

Specifies the name of the folder used to construct URIs of all resources written into an HTML document. Default is an empty string.

public string ResourceFolderAlias { get; set; }

Remarks

ResourceFolderAlias is the simplest way to specify how URIs for all resource files should be constructed. Same information can be specified for images and fonts separately via ImagesFolderAlias and FontsFolderAlias properties, respectively. However, there is no individual property for CSS.

ResourceFolderAlias has lower priority than FontsFolderAlias and ImagesFolderAlias. For example, if both ResourceFolderAlias and FontsFolderAlias are specified, fonts’ URIs will be constructed using FontsFolderAlias, while URIs of images and CSS will be constructed using ResourceFolderAlias.

If ResourceFolderAlias is empty, the ResourceFolder property value will be used to construct resource URIs.

If ResourceFolderAlias is set to ‘.’ (dot), resource URIs will contain file names only, without any path.

Examples

Shows how to set folders and folder aliases for externally saved resources that Aspose.Words will create when saving a document to HTML.

Document doc = new Document(MyDir + "Rendering.docx");

HtmlSaveOptions options = new HtmlSaveOptions
{
    CssStyleSheetType = CssStyleSheetType.External,
    ExportFontResources = true,
    ImageResolution = 72,
    FontResourcesSubsettingSizeThreshold = 0,
    FontsFolder = ArtifactsDir + "Fonts",
    ImagesFolder = ArtifactsDir + "Images",
    ResourceFolder = ArtifactsDir + "Resources",
    FontsFolderAlias = "http://example.com/fonts",
    ImagesFolderAlias = "http://example.com/images",
    ResourceFolderAlias = "http://example.com/resources",
    ExportOriginalUrlForLinkedImages = true
};

doc.Save(ArtifactsDir + "HtmlSaveOptions.FolderAlias.html", options);

See Also