Free Support Forum -

Font Format lost on InsertHTML


I'm currently working on a project using Aspose.Word where we set up word documents with placeholders (e.g <#BAP#> ) that are either replaced or where HTML is inserted into so as to produce database driven documents.

However, we have a problem with the "InsertHTML" method which loses the formatting of the document placeholder font on some occassions.

On almost all occassions the insertion works except for 1 field on a particular document where the format reverts from Tahoma 9 to Times New Roman 9. All HTML formatting is preserved (i.e. Italics etc. ).

I have checked the font collection just before issuing the InsertHTML which indicates that the current font is Tahoma. However, after insertion this becomes Times New Roman.

The code is as follows:

if(oBuilder.MoveToBookmark("BAP", true, true))
oBuilder.InsertHtml(GetXMLHTML(xmlDoc, "ProductText", "BAP" )); // Get and Insert HTML at the BookMark preserving font format
iReplacements = oDestination.Range.Replace("<#BAP#>", "", false, false); // Remove BookMark

The GetXMLHTML returned HTML is:


The first dedicated textbook for undergraduate students studying courses in personal finance.  Covering both theory and practice, Personal Financial Planning goes beyond existing product-based regulatory guidebooks and consumer guides to personal finance. This book enables students to gain a greater breadth and understanding of all aspects of personal finance from both an academic and practical perspective.

The author combines technical detail with a discursive analysis of the economic, social and regulatory environment in which financial planning, as a blend of services and products, is delivered in the first decade of the twenty-first century.


Please note:

1.This field and the same HTML works on other documents.
2. When the

tags are removed the font seems to be preserved.

3. The previous version of Aspose.Word is being used to the current Aspose.Words, since the project is now in test/source control.

Your help would be greatly appreciated as the project is being held up because of this.

Many thanks


Thanks for the detailed report. Please also attach the problematic document to let us reproduce the issue.

Many thanks.

I've attached the document and the field in question is <#BAP#> which is accessed via the "BAP" bookmark.

The BAP field's style is Heading 3 which seems to be incorrect. Just make it Normal (if font properties reset, just make them Tahoma 9 pt again). Please find attached.

Many Thanks Dmitry that’s sorted our problem out.