Free Support Forum -

Converting HTML file to Doc is adding space

Lot of empty space is getting added when converting html to word.
Attached same for (667.9 KB)

Is there a way to remove all empty space and fill the empty space with next text as in Zip


Thanks for your inquiry. The empty space in your document is due to column and page breaks. Please use the following code example to get the desired output. Hope this helps you.

Document doc = new Document(MyDir + "Source.html");
doc.Range.Replace(ControlChar.ColumnBreak, "", new FindReplaceOptions());
doc.Range.Replace(ControlChar.PageBreak, "", new FindReplaceOptions());
doc.Save(MyDir + "18.9.docx");

Thanks you .
That worked like a charm


Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.