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

Free Support Forum - aspose.com

Extra spaces are created after DOC to HTML conversion using C#


Please find the word document and HTML document from the attachment.

When I am converting from word to HTML one extra span tag is creating some space between Alert and Test words ( in the HTML page).

In the word document the formatting is same for both the lines, even though the spacing issue arised for the first line in the HTML document which is undesired.

Please help me, how to remove the extra space created by tag.


kesava M.

Hi Kesava,

Thanks for your query. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSNET-6597 in our issue tracking system. 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.

For a workaround, please use the following code snippet.

Document doc = new Document(MyDir + "dummy.doc");

NodeCollection runs = doc.GetChildNodes(NodeType.Run, true);

foreach (Run run in runs)


if (run.Range.Text.Contains(ControlChar.Tab) == true)

run.Text = run.Text.Replace("\t", "");


doc.Save(MyDir + "AsposeOut.html");

Hi Tahir,

Thanks, but the problem is, the above code is replacing all the tab spaces. Please find the attached documents. Also I observed that aspose words is adding one extra tab space for every tab space.

In the attached dummy.doc I added one tab space intentionally between Test and HTML words at third line. The workaround you suggested is removing that intentional tab space also which is undesired.

I think aspose should remove

  1. Extra tab space between Alert and Test Words at line 1 and 3 in HTML document attached.
  2. It should not remove the intentional tab space between Test and Html words at line 3

Kindly suggest a solution for this.


Kesava M

Hi Kesava,

Thanks for sharing the information. Our development team will look into this issue and you will be updated via this forum thread once this issue is resolved.

We appreciate your patience.

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

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