When using InsertHtml the headings are not created with the correct font face or size. The font colour is correct but not the face or size. I have a sample project if that will help
var templatePath = Directory.GetCurrentDirectory().Replace(@"bin\Debug", "") + @"Templates\Template.docx";
// Read in the account's template
if (File.Exists(templatePath) == false)
{
throw new FileNotFoundException();
}
var doc = new Document();
var builder = new DocumentBuilder(doc);
// Create the table of contents
builder.InsertTableOfContents("\\o \"1-3\" \\h \\z \\u");
builder.InsertBreak(BreakType.PageBreak);
// Insert HTML paragraphs
builder.StartBookmark("section_1");
builder.InsertHtml("<h1>Section 1</h1><h2>Subsection 1.1</h2><p>Content for subsection 1.1.</p><h2>Subsection 1.2</h2><p>Content for subsection 1.2.</p>");
builder.EndBookmark("section_1");
builder.StartBookmark("section_2");
builder.InsertHtml("<h1>Section 2</h1><h2>Subsection 2.1</h2><p>Content for subsection 2.1.</p><h2>Subsection 2.2</h2><p>Content for subsection 2.2.</p>");
builder.EndBookmark("section_2");
// Update the table of contents
doc.UpdateFields();
// Merge the document into the template... perserve style
Document templateDocument;
using (Stream stream = File.OpenRead(templatePath))
{
templateDocument = new Document(stream);
}
templateDocument.RemoveAllChildren();
templateDocument.AppendDocument(doc, ImportFormatMode.UseDestinationStyles);
var outputPath = string.Format(@"{0}Output\{1:yyyy-MM-dd-hh-mm-ss-tt}.docx", Directory.GetCurrentDirectory().Replace(@"bin\Debug", ""), DateTime.Now);
if (File.Exists(outputPath) == true)
{
throw new IOException("File Exists");
}
templateDocument.Save(outputPath);