HtmlInsertOptions enumeration
HtmlInsertOptions enumeration
Specifies options for the DocumentBuilder.insertHtml() method.
Members
Name | Description |
---|---|
None | Use the default options when inserting HTML. |
UseBuilderFormatting | Use font and paragraph formatting specified in DocumentBuilder as base formatting for text inserted from HTML. |
RemoveLastEmptyParagraph | Remove the empty paragraph that is normally inserted after HTML that ends with a block-level element. |
PreserveBlocks | Preserve properties of block-level elements. |
Examples
Shows how to allows better preserve borders and margins seen.
const 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.
let insertOptions = aw.HtmlInsertOptions.PreserveBlocks;
let builder = new aw.DocumentBuilder();
builder.insertHtml(html, insertOptions);
builder.document.save(base.artifactsDir + "DocumentBuilder.preserveBlocks.docx");
See Also
- module Aspose.Words