Processes the XHTML string and inserts it into the specified Word document as formatted text after the given WordWriter Element using the given NamedStyle. Returns the last Element inserted into the document.

public SoftArtisans.OfficeWriter.WordWriter.Element InsertHTML(System.String xhtml, SoftArtisans.OfficeWriter.WordWriter.Document doc, SoftArtisans.OfficeWriter.WordWriter.NamedStyle style, SoftArtisans.OfficeWriter.WordWriter.Element insertAfterElement)
Public Function InsertHTML(ByVal xhtml As String, ByVal doc As SoftArtisans.OfficeWriter.WordWriter.Document, ByVal style As SoftArtisans.OfficeWriter.WordWriter.NamedStyle, ByVal insertAfterElement As SoftArtisans.OfficeWriter.WordWriter.Element) As SoftArtisans.OfficeWriter.WordWriter.Element

A well-formed fragment of an xhtml document.

a WordWriter document object into which content will be inserted.

(Optional) a user-specified WordWriter style that contains the font to use when inserting text.

The WordWriter element after which the contents of the xhtml will be inserted.

The last Element inserted into the document.


//--- Create a new WordWriter document.
WordApplication wApp = new WordApplication();
Document doc = wApp.Create();

//--- Create the HTMLToWord object.
HTMLToWord h2w = new HTMLToWord();

//--- The XHTML to insert into the WordWriter document.
string xhtml = "<h1>Greetings</h1><p><b>Hello</b>, <i>world</i>!</p>";

//--- Create a style that uses a red Arial 11 point font.
NamedStyle myStyle = doc.Styles[NamedStyle.BuiltIn.Normal];
Font myFont = myStyle.Font;
myFont.Name = "Arial";
myFont.Size = 11;
myFont.Color = System.Drawing.Color.Red;
myStyle.Font = myFont;

//--- Insert the XHTML at the end of the WordWriter document.
Element lastInsertedElement = h2w.InsertHTML(xhtml, doc, myStyle, table);

'--- Create a new WordWriter document.
Dim wApp As New WordApplication()
Dim doc As Document = wApp.Create()

'--- Create the HTMLToWord object.
Dim h2w As New HTMLToWord()

'--- The XHTML to insert into the WordWriter document.
Dim xhtml As String = "<h1>Greetings</h1><p><b>Hello</b>, <i>world</i>!</p>"

'--- Insert the XHTML at the end of the WordWriter document.
Dim lastInsertedElement As Element = h2w.InsertHTML(xhtml, doc, null, doc)