Free Support Forum - aspose.com

Converting HTML file to Doc is adding space

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

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

@TejKamal_Thotakuri

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

@TejKamal_Thotakuri

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