DocumentBuilderInsertHtml Method (String, Boolean)
Inserts an HTML string into the document.

Namespace: Aspose.Words
Assembly: Aspose.Words (in Aspose.Words.dll) Version: 19.10
Syntax
public void InsertHtml(
	string html,
	bool useBuilderFormatting
)

Parameters

html
Type: SystemString
An HTML string to insert into the document.
useBuilderFormatting
Type: SystemBoolean
A value indicating whether formatting specified in DocumentBuilder is used as base formatting for text imported from HTML.
Remarks

You can use InsertHtml to insert an HTML fragment or whole HTML document.

Remarks

When useBuilderFormatting is false, DocumentBuilder formating is ignored and formatting of inserted text is based on default HTML formatting. As a result, the text looks as it is rendered in browsers.

When useBuilderFormatting is true, formatting of inserted text is based on DocumentBuilder formatting, and the text looks as if it were inserted with Write(String).

Examples
Inserts HTML into a document using. The current document formatting at the insertion position is applied to the inserted text.
[C#]

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);
builder.InsertHtml(
    "<P align='right'>Paragraph right</P>" + "<b>Implicit paragraph left</b>" +
    "<div align='center'>Div center</div>" + "<h1 align='left'>Heading 1 left.</h1>", true);

doc.Save(ArtifactsDir + "DocumentBuilder.InsertHtml.doc");
See Also