//--- 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);
|