HtmlSaveOptions.FontsFolder property

Specifies the physical folder where fonts are saved when exporting a document to HTML. Default is an empty string.

public string FontsFolder { get; set; }


When you save a Document in HTML format and ExportFontResources is set to true, Aspose.Words needs to save fonts used in the document as standalone files. FontsFolder allows you to specify where the fonts will be saved and FontsFolderAlias allows to specify how the font URIs will be constructed.

If you save a document into a file and provide a file name, Aspose.Words, by default, saves the fonts in the same folder where the document file is saved. Use FontsFolder to override this behavior.

If you save a document into a stream, Aspose.Words does not have a folder where to save the fonts, but still needs to save the fonts somewhere. In this case, you need to specify an accessible folder in the FontsFolder property or provide custom streams via the FontSavingCallback event handler.

If the folder specified by FontsFolder doesn’t exist, it will be created automatically.

ResourceFolder is another way to specify a folder where fonts should be saved.


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 = "",
    ImagesFolderAlias = "",
    ResourceFolderAlias = "",
    ExportOriginalUrlForLinkedImages = true

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

See Also