Unwanted Paragraph when using InsertHTML

Hello,

Ektron, Inc. recently purchased your Aspose.Words component and we’re using it on a fairly large project. The issue I’m currently having is with the behavior of the InsertHTML function. The HTML that I’m feeding to the function in this particular case is very simple, as follows:

This is some text

So, when this string is inserted into the word document, there is a paragraph being appended to the end which can be seen when the “show formatting” option is selected in Word. The paragraph symbol shows up at the end and there is clearly a paragraph break present.

The main issue with this is that we’re doing round trips from the word doc to HTML and back to the word doc. If we don’t strip the paragraph tags, they will continue to append each time we do a trip. We can’t strip them because there are cases in which a paragraphs are intentional.

Is this behavior intentional? If so, why is that? Either way, is there
any possibility that we could get some kind of a hot fix that doesn’t
behave this way?

Thank you very much for your time!

Hi
Thanks for your request. Could you please provide me code example that will allow me to reproduce your problem. I tried to use the following code for testing and I have no paragraph break after strong text in the output document.

// Create a new document
Document doc = new Document();
// Create an instance of Document builder that is used to build document
DocumentBuilder builder = new DocumentBuilder(doc);
// Write some text
builder.Write("Text before strong ");
// Insert html 
builder.InsertHtml("<b>Strong text</b>");
// Write some text
builder.Write("Text after strong");
// Save an output document
doc.Save("out.doc");

Also note that tag is represented in word document as Run but not as Paragraph.
Best regards.

Alexey,

Thanks for the response. I did another test after seeing your post and it’s working now. The only difference between my original tests and the latest working test is that we just upgraded to version 4.4.3.0.

I’m wondering if maybe there was some change in the new version that affected the behavior of the InsertHTML function? At any rate, it seems to be working now so we’ll go with this.

Thanks again!