HtmlLoadOptions.ConvertSvgToEmf

HtmlLoadOptions ConvertSvgToEmf property. Gets or sets a value indicating whether to convert loaded SVG images to the EMF format. Default value is false and if possible loaded SVG images are stored as is without conversion.

HtmlLoadOptions.ConvertSvgToEmf property

Gets or sets a value indicating whether to convert loaded SVG images to the EMF format. Default value is false and, if possible, loaded SVG images are stored as is without conversion.

public bool ConvertSvgToEmf { get; set; }

Remarks

Newer versions of MS Word support SVG images natively. If the MS Word version specified in load options supports SVG, Wordize will store SVG images as is without conversion. If SVG is not supported, loaded SVG images will be converted to the EMF format.

If, however, this option is set to true, Wordize will convert loaded SVG images to EMF even if SVG images are supported by the specified version of MS Word.

Examples

Shows how to convert SVG objects to EMF format when importing HTML documents.

string html =
    @"<html>
        <svg xmlns='http://www.w3.org/2000/svg' width='500' height='40' viewBox='0 0 500 40'>
            <text x='0' y='35' font-family='Verdana' font-size='35'>Hello world!</text>
        </svg>
    </html>";
MemoryStream htmlStream = new MemoryStream(Encoding.UTF8.GetBytes(html));

HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();
// Instruct Wordize to convert SVG images to EMF meta-files upon loading HTML document.
htmlLoadOptions.ConvertSvgToEmf = true;

Converter.Create()
    .From(htmlStream, htmlLoadOptions)
    .To(ArtifactsDir + "HtmlLoadOptions.ConvertSvgToEmf.docx")
    .Execute();

See Also