We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Paragraph space after value is changed after calling InsertDocument using Java

HI,

I am formatting a template (replacing some token) document with some data ( data will be contains headings and paragraphs). All the paragraph adding using InsertDocument method. And inserting as DESTINATION_FORMAT. For paragraph I am using NORMAL style and for heading HEADING_1. And I am taking all the style from respective style.

While downloading the file all the style not coming from destination. For paragraph (NORMAL style) getting a space after value 12pt. But my NORMAL style paragraph space after valuer is 0pt (if i change the value to any other value result will be same)

Attaching the source code and output and input file DocumentInsertSpaceAfterIssue.zip (106.6 KB)

@Gptrnt

The shared output and expected output Word documents are quite different. Please check your documents and share the expected output document.

The space after for Normal style in output and template documents is 0. You have shared your complete project. Please create a simple Java application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing. We will investigate the issue and provide you more information on it.

Hi Tahir,

Sorry for the mistake. I am attaching zip with source code, input, output and expected output.
DocumentInsertSpaceAfterIssue.zip (71.8 KB)

@Gptrnt

Thanks for sharing the documents. Could you please share the simplified code example to reproduce this issue at our end? You may share detail about your use case. We will review the whole code and provide you more information on this issue.

Hi,

Any update for this issue ?

@Gptrnt

We are checking your code project and finding the root cause of this issue. There are many classes and methods in your project. It would be great if you please share some detail in steps that what your code project does. It will help us to find the issue.

We are working over your project and will get back to you soon with our findings.

@Gptrnt

Please note that Aspose.Words mimics the behavior of MS Word. We have worked with your shared project and like to share with you that the issue you are facing is not a bug in Aspose.Words’ API.

In your code, you are creating HTML document from HTML fragment. The paragraph of this document has space after value 12. Your project inserts this document into template document. If you perform the same scenario using MS Word, you will get the same output.

In your case, we suggest you please get the space after value of ‘Normal’ style and apply to imported HTML document. Hope this helps you.

Hi,
I am converting html to document by byte array inputstream. So I can’t change the document space after value before loading the html. So i have to go each paragraph and have to change the space after value. Is there any other alternative solution for this issue ?

@Gptrnt

In your code, you are importing HTML into Aspose.Words’ DOM. Please set the desired space after in imported HTML document to get the desired output. You can iterate over paragraph nodes or set the space after value for ‘Normal’ style.