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

Free Support Forum - aspose.com

Preserve white space when loading HTML document

Hi,


I have been using the aspose library to convert a .dox to .html. In the rendered HTML, I get this whitespaced span:

Then I load back the .html file using Document doc = new Document (filepath). And this whitespace is lost in my document object, therefore is not rendered when I save my document back as .docx.

Is there an option somewhere to preserve the whitespace on loading the HTML ?
Cheers,

Hi Boris,

Thanks for your inquiry. Please note that Aspose.Words mimics the same behavior as MS Word does. If you load the same html document in MS Word, you will get the same output.

It would be great if you please share your input Word document along with output HTML here for testing. I will investigate the issue and provide you more information.

Please note that a common character entity used in HTML is the non breaking space ( ). Remember that browsers will always truncate spaces in HTML pages. If you write 10 spaces in your text, the browser will remove 9 of them. To add real spaces to your text, you can use the   character entity.

Hi Tahir,


Find enclosed the document I use. I tried to saved it from Word in the html format, then opened it back in Word, and the white spaces where preserved.

Now re your last comment, I don’t need to open the html in a browser, I will manipulate the content in the html, and then convert it back to Word using Aspose.

I have played with the Interop libraries before, and before loading a document you can actually set the doc options to explicitly preserve the white spaces. Maybe that where you need to look at.

Cheers,
Boris

Hi Boris,

Thanks for sharing the detail.

I
have tested the scenario and have managed to reproduce the same issue
at my side. For the sake of correction, I have logged this problem in
our issue tracking system as WORDSNET-10039. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-10039) have been fixed in this .NET update and this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.