I’m currently in the progress of moving our document generation process over to Aspose. So far everything works fine. I’ve now found a thing where I need your help.
I have a table and want to insert HTML into a cell. So far inserting HTML works. But when looking at the document I see a paragraph break after my inserted HTML.
I’ve attatched the HTML-Code and a screenshot showing the cell including word’s control characters.
How can I prevent the last paragraph break? Please help me!
Thanks for your inquiry. You see an additional paragraph because there is a paragraph in your HTML. For example if you insert the following HTML, you will not see any additional paragraphs.
builder.InsertHtml("<span>this is simple test</span>");
But if in there is a paragraph in your HTML, then you will see a paragraph in the output document. For instance:
builder.InsertHtml("<p><span>this is simple test</span></p>");
In this case, you can just remove the current paragraph of DocumentBuilder:
builder.InsertHtml("<p><span>this is simple test</span></p>");
if(!builder.CurrentParagraph.HasChildNodes)
builder.CurrentParagraph.Remove();
But in this case, after removing the current paragraph of DocumentBuilder, you should move DocumentBuilder cursor somewhere and then continue using it.