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."
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.