HtmlSaveOptions.ExportRelativeFontSize

HtmlSaveOptions ExportRelativeFontSize property. Specifies whether font sizes should be output in relative units when saving to HTML MHTML or EPUB. Default is false.

HtmlSaveOptions.ExportRelativeFontSize property

Specifies whether font sizes should be output in relative units when saving to HTML, MHTML or EPUB. Default is false.

public bool ExportRelativeFontSize { get; set; }

Remarks

In many existing documents (HTML, IDPF EPUB) font sizes are specified in relative units. This allows applications to adjust text size when viewing/processing documents. For instance, Microsoft Internet Explorer has “View->Text Size” submenu, Adobe Digital Editions has two buttons: Increase/Decrease Text Size. If you expect this functionality to work then set ExportRelativeFontSize property to true.

Wordize document model contains and operates only with absolute font size units. Relative units need additional logic to be recalculated from some initial (standard) size. Font size of Normal document style is taken as standard. For instance, if Normal has 12pt font and some text is 18pt then it will be output as 1.5em. to the HTML.

When this option is enabled, document elements other than text will still have absolute sizes. Also some text-related attributes might be expressed absolutely. In particular, line spacing specified with “exactly” rule might produce unwanted results when scaling text. So the source documents should be properly designed and tested when exporting with ExportRelativeFontSize set to true.

Examples

Shows how to configure Wordize to export relative font sizes to HTML.

HtmlSaveOptions htmlSaveOptions = new HtmlSaveOptions();
htmlSaveOptions.ExportRelativeFontSize = true;

Converter.Create()
    .From(MyDir + "Simple.docx")
    .To(ArtifactsDir + "HtmlSaveOptions.ExportRelativeFontSize.html", htmlSaveOptions)
    .Execute();

See Also