Space in a Word to HTML doc after removing breaks

Hi Aspose Support,

We are using Aspose Words to convert a Word to a HTML document then display it in a frame.

We have a problem with the rendering of the html, concerning the page/section break suppression, mention in this thread Aspose.Words for .NET|Documentation.

I attach to this post the document I used for that and the result test. (50.3 KB)

When we use MS word to save the document as HTML (example: word_to_html.htm), we get a document with little spacing between “page”.

When we use Aspose Words to save the same document without suppressing the breaks, the rendering has big space (aspose_doc_no_remove.html).

When we use Aspose Words to save the same document suppressing the breaks, the rendering doesn’t have big space but there is little space after the “break part” (aspose_doc_remove_break.html), looks like this space is due to the html structure of the document.

Is it possible de get rid of the space after removing a break?


Yes, you can remove the empty space (paragraphs) from the document. Could you please ZIP and attach your expected output document here for our reference? We will then provide you more information about your query along with code.

Hi @tahir.manzoor,

For the exemple of what we try to do, I attached 3 documents: (77.1 KB)

  • the original one
  • one convert to html by MS Word (word_to_html.htm)
  • one convert to html by Aspose Words (aspose_to_html.html)

We need a rendering like MS Word rendering of the html.

You can see the difference at paragraph 8 and 15, when using Aspose, there is a space where the page “split” (the html div separation) unlike MS Word rendering.

Do you have an idea to fix that?


We have converted the shared document to HTML using following code example and have not found the shared issue. Please check the attached output HTML. (4.3 KB)

Could you please share the code example to reproduce this issue at our end? We will investigate the issue and provide you more information on it.

Document document = new Document(MyDir + "document.docx");
document.Save(MyDir + "19.6.html");

Hi @tahir.manzoor,

I found out why we have a problem rendering the document, we use the Save(String, SaveOptions) with HtmlFixedSaveOptions which doesn’t render like we wish.

I tried rendering with HtmlSaveOptions and it fix our problem.

Thx for the help anyway


It is nice to hear from you that your problem has been resolved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.