Paragraph Formatting with insertHtml

Hi,

I’m facing an issue with paragraph formatting when I use the insertHtml method with the DocumentBuilder object. The paragraphs in the HTML have top margin of 2pt which is fine but the bottom margin becomes “Auto” which becomes around 10pt but I want the bottom margin to be 2pt as well. Is there a way to configure this formatting?

Hello

Thanks for your inquiry. Could you please attach your HTML and expected output document here for testing? I will check them and provide you more information.
Best regards,

Thanks for the quick reply. I’m using very simple html (in addition to a few complex ones), something like

None Found

No

The template which I’m using is attached. The generated report is also attached (report_9138171593873532152.doc). The red portions of the generated document shows the problematic areas. MS Word shows the style of those paragraphs as “Normal”. If you check the template, the formatting of “Normal” style has paragraph spacing at 2pt for both top and bottom. But when I use insertHtml, that formatting gets ignored. If in MS Word I apply the “Normal” style to those paragraphs again the spacing becomes 2pt. Also if you check the generated document, there are additional styles added by Aspose named “Normal_0”, “Normal_1”, “Normal_2” etc.

Hello

Thank you for additional information. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is resolved.
As a workaround you can try using builder.Writeln method instead of InsertHtml. Or you can write the code which will loop through all paragraphs with “Normal” style applied and set Spacing After manually.
Best regards,

Thanks Andrey for you reply. Unfortunately I cannot use the solution you are proposing as I’ll have some very complex html as well in which I can’t insert each line using writeln method. I guess I’ll have to wait for the fix. Also is the “Normal_0” “Normal_1” style names related to this problem or a different problem?

Hello

Thank you for additional information. You still can try using the second way to work this problem around, write the code which will loop through all paragraphs with “Normal” style applied and set Spacing After manually.
Regarding styles, I cannot reproduce this problem on my side. I use this code for testing:

Document doc = new Document("C:\\Temp\\is1_template.doc");
DocumentBuilder builder = new DocumentBuilder(doc);
builder.MoveToDocumentStart();
builder.InsertHtml("<p>Test</p>");
doc.Save("C:\\Temp\\out.doc");

The output document has just one “Normal” style. How can I reproduce this problem?
Also I do not think that this problem is related to the original.
Best regards,

Thanks for your reply Andrey. I’m not sure why the style name problem is appearing. I’ll have to do some testing to see when this problem occurs. I’ll let you know my findings

The issues you have found earlier (filed as WORDSNET-4692) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.