HtmlInsertOptions enumeration

HtmlInsertOptions enumeration

Specifies options for the DocumentBuilder.insertHtml() method.

Members

NameDescription
NoneUse the default options when inserting HTML.
UseBuilderFormattingUse font and paragraph formatting specified in DocumentBuilder as base formatting for text inserted from HTML.
RemoveLastEmptyParagraphRemove the empty paragraph that is normally inserted after HTML that ends with a block-level element.
PreserveBlocksPreserve 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