Free Support Forum -

How to add a tab to Doc

I am converting HTML to DOC using aspose words java.

Detecting empty space in my HTML, can i create a new tab in the paragraphs and add the same to the DOC?

If so please guide me how i can add the tabs to the paragraphs in DOC.


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. Could you please attach your input and output documents here for testing? I will check the problem on my side and provide you more information.

Best regards,

This is my HTML,



When i convert the above HTML as DOC i want to replace the 13 continuous " " into TAB in DOC. I want to insert a TAB in the the Word DOC instead of the white space presently put by aspose. I want to preserve TAB as tab in DOC & not as white space.

I am attaching the DOC(both input & output) i got in conversion. Please help to add TAB to the o/p DOC instead of this white space(”&nbsp") because TAB present in original file is lost in this conversion.

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. You can try using the following code:

Document doc = new Document("docwithouttaboutput.doc");

doc.DefaultTabStop = 72;

doc.Range.Replace("\x00a0\x00a0\x00a0\x00a0\x00a0\x00a0\x00a0\x00a0\x00a0\x00a0\x00a0\x00a0\x00a0", "\t", true, false);


But you should note, all paragraphs in your document can have different TabStop settings. In my code, DefaultTabStop has been specified for whole document.

Best regards,

I am sorry, but couldn’t understand your code sample.
i am converting HTML to DOC, but in the above code sample you provided both the input & output are doc.

Please help me, what i have to do to get TAB in DOC when i convert HTML to DOC as it was in the original input document.

Should i also, make changes in code for conversion of DOC to HTML too to achieve in conversion from HTML to DOC?

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

There is no direct way to achieve what you need. But using the code from my previous post you can replace 13 " " with “tab”.

Please just change the first line:

Document doc = new Document("in.html");

Where in.html it is your HTML.

Best regards,

Thanks for your reply, with “\t” i am able to add a tab in a DOC.

But problem persists. “\x00a0” does not seem to represent or identify a " " in the DOC.

So i am not able to replace the   Please help me out on how to replace  .


<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. Non-Breaking Characters are represented as "\x00a0" in Word document. Please see the following link:

Best regards,