Inserting HTML string to Word template does not render the HTML as desired

I am attempting to generate a PDF from a word doc using aspose.Words and cannot get the HTML string value to render/format correctly upon report generation. I have tried altering the expression tag in the template to be <<[html_text_expression] -html>> and <<html [html_text_expression]>> as described here: Aspose Inserting Dynamic HTML and this does not seem to work. Any thoughts on what I can try?

@precisesystems Could you please provide your HTML string here for testing? We will check the issue and provide you more information.

Thank you, we are storing the below HTML as a string in our database and wish for it to render in our report

<h2>Look Here</h2><p>Here is some test <strong><u>WYSIWYG </u></strong>description data</p><ul><li>looks cool</li><li>let&#39;s you format text and output as HTML yay!</li></ul>

@precisesystems As I can see HTML is inserted properly on my side. Here is a simple code I used for testing:

string html = @"<h2>Look Here</h2><p>Here is some test <strong><u>WYSIWYG </u></strong>description data</p><ul><li>looks cool</li><li>let&#39;s you format text and output as HTML yay!</li></ul>";

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Write("<<[html_text_expression] -html>>");

ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, html, "html_text_expression");

doc.Save(@"C:\Temp\out.docx");

Here is the output: out.docx (8.1 KB)

We need to utilize the template control rather than appending the HTML to the end of the document as we have multiple instances where HTML needs to be inserted scattered throughout our document template, surrounded by other template fields, of which are populated with dynamic data

@precisesystems Yes, I understand, that in real scenario there are other first and text around the field. The provided code simply demonstrates how to insert HTML upon building a report. You can modify the code like this to see how HTML is inserted between some text:

string html = @"<h2>Look Here</h2><p>Here is some test <strong><u>WYSIWYG </u></strong>description data</p><ul><li>looks cool</li><li>let&#39;s you format text and output as HTML yay!</li></ul>";

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Write("Some Text before <<[html_text_expression] -html>> Some text after");

ReportingEngine engine = new ReportingEngine();
engine.BuildReport(doc, html, "html_text_expression");

doc.Save(@"C:\Temp\out.docx");

Or you can create template in MS Word and put <<[html_text_expression] -html>> placeholder in any place in the document and builder the report from the template.

If you still encounter problems with inserting HTML, please provide your template, sample data source and code that will allow us to reproduce the problem. The problematic output produced on your side might be also useful for the problem analysis. We will check your scenario on our side and provide you more information.

in the process of compiling examples we create a new template with a table with a single cell (as per our in use template) and the data was displayed correctly. We then deleted and readded the existing single cell tables to our template and the field correctly displayed. Are there any properties of a table that could cause this? Or is it possible that, if the table was copy and pasted, there is something corrupted about that object within the template itself?

@precisesystems Unfortunately, it is not quite clear what the problem is and how to reproduce it. If possible, please attach your template, data source, code, problematic and expected output documents here for testing. Or create a console application that will allow us to reproduce the problem. Unfortunately, it is difficult to say what might cause the problem without ability to reproduce this problem on our side.