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

Free Support Forum - aspose.com

DOCX to HTML conversion issue with hyperlink containing special characters using C#

Hi Aspose guys,

I had some hyperlinks with special characters in docx file, such as:

  • Anchor name: ES91e95d95_02b8_4d60_a308_2c186171e1fe
  • tooltip: Digitar no campo User o valor nhap da
    tavo ne &*()^%$#@:<>?{} +| .

When I used Aspose word to convert docx to html, the anchor was generated incorrectly(). It contained “%3C%3E?%7B%7D +%7C”.

Would you please share with me why “%3C%3E?%7B%7D_+%7C” was inserted. And how to fix it?

Thanks and regards

Hi Vuong,

Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 10.8.0, I was unable to reproduce this issue on my side. Moreover, I would suggest you please visit the following link for downloading and using the latest version of Aspose.Words:

https://downloads.aspose.com/words/net
Also, I have attached the input DOCX and output HTML files i.e. generated on my side here for your reference.

Please let me know if I can be of any further assistance.

Best Regards,

Hi awais.hafeez,

Here is not my issue.
I inserted a hyperlink to document by Microsoft.Office.Interop.Word API; like this:

Word.Range range = this.Application.Selection.Range;
object subAddress = Utility.RewriteBookmarkName(stepId);
object screenTip = ObjectModel.Steps[stepId].DisplayText;
range.Hyperlinks.Add(range, ref missing, ref subAddress, ref screenTip, ref missing, ref missing);

Where,
subAddress : value of a bookmark(ES91e95d95_02b8_4d60_a308_2c186171e1fe)
screenTip: its value is "nhap da tavo ne &*()^%$#@:<>?{}_+|"

Then I used aspose.word to convert doc file to html. I got the issue.
Would you please investigate it again.

Thanks for any help

Hi Vuong,


Thank you for the additional information. Could you please attach your Word document (DOC file) that was generated by using Microsoft.Office.Interop.Word API here for testing? I will investigate the issue on my side and provide you more information.

Best Regards,

Hi awais.hafeez,

Here is my word and html files.

The last hyperlink is incorrect, it contains special characters in URL

Thanks and regards

Hi
Vuong,


Thanks for your inquiry. I found that, prior converting this Words document to HTML format, the special characters e.g. %3C were already present in the address field of last Word Hyperlink as can be seen below :


In this case, Aspose.Words does nothing with hyperlink addresses upon converting Word documents to HTML. So href addresses must be the same as in the input Word document.

Please let me know if I can be of any further assistance.

Best Regards,