HtmlInsertOptions

HtmlInsertOptions enumeration

Specifies options for the InsertHtml method.

[Flags]
public enum HtmlInsertOptions

Values

NameValueDescription
None0Use the default options when inserting HTML.
UseBuilderFormatting1Use font and paragraph formatting specified in DocumentBuilder as base formatting for text inserted from HTML.
RemoveLastEmptyParagraph2Remove the empty paragraph that is normally inserted after HTML that ends with a block-level element.
PreserveBlocks4Preserve properties of block-level elements.

Examples

Shows how to allows better preserve borders and margins seen.

const string html = @"
    <html>
        <div style='border:dotted'>
        <div style='border:solid'>
            <p>paragraph 1</p>
            <p>paragraph 2</p>
        </div>
        </div>
    </html>";

// Set the new mode of import HTML block-level elements.
HtmlInsertOptions insertOptions = HtmlInsertOptions.PreserveBlocks;

DocumentBuilder builder = new DocumentBuilder();
builder.InsertHtml(html, insertOptions);
builder.Document.Save(ArtifactsDir + "DocumentBuilder.PreserveBlocks.docx");

See Also