Free Support Forum -

Extra line break added at beginning and end of HTML

When converting any .doc file to an .html file, I always encounter the following tag forcing line breaks:

<p style=“font-size:11pt; line-height:115%; margin:0pt 0pt 10pt”><span style=“font-family:Calibri; font-size:11pt”> 

Because of this, when I try to make a round trip back to .doc, I get extra lines saved in the edited .doc file.

Any hints/help?


Hi Troy,

Thanks for your inquiry. Could you please attach your input Word document here for testing? I will investigate the issue on my side and provide you more information.


I’ve narrowed the issue down.

for (Section section : document.getSections())

The above code removes all headers except for the first page so that the HTML output only contains one header. However, if no header exists a newline is appended and therefore causes my issue. Is there a nicer way to output header (perhaps hidden) to HTML?

As you requested, my test document is also attached.


I did remove that for loop, but I still appear to receive new lines at the end of my document.


Hi Troy,

Thanks for sharing the document. Perhaps, you’re using an older version of Aspose.Words; as with Aspose.Words v11.11.0, I am unable to reproduce this problem on my side. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v11.11.0 and let us know how it goes on your side. I hope, this will help. I have attached the output HTML file with this post.