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

Free Support Forum - aspose.com

Inserting HTML code with URL does not work properly

It seems that using URLs inside HTML-code doesn’t work properly.

I
want to insert html code that contains an url-link into a word document. After using builder.insertHTML inner address of url will be changed to + inner address of url-link.

Here
is the corresponding code:

Document doc;
DocumentBuilder builder;

try
{
doc = new Document();
builder = new DocumentBuilder(doc);
String htmlText = “

<a href=“www.cursor.de”>CURSOR web;

”;
builder.insertHtml(htmlText);

doc.save(“c:\Temp\ASPOSE URL per HTML.doc”);
}
catch (Exception e)
{

}

Result after inserting html:

Address of URL-Link = “c:\Temp\www.cursor.de

I
would have expected “
www.cursor.de


Thanks
a lot.

Sincerely,
Matthias Schlosser

Hello

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

Thank you for reporting this problem to us. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed.

Best regards,

Hello!

I’m a developer from Aspose.Words project team. Thank you for your inquiry.

I have analysed issue, and became clear, that this behaviour is standard. By design Aspose.Words strive to support HTML 4.01 standart. Which describes that the “href” value of element is based on the URI format:
http://www.w3.org/TR/1999/REC-html401-19991224/struct/links.html#adef-href
URI format is described in documents RFC (RFC 1630, RFC 2396, RFC 3986 is current):
http://tools.ietf.org/html/rfc3986
By documents URI string format is correspond to “:” (protocol prefix is required).
As a workaround you can use “http://” prefix in links.

In conclusion, i note that a similar behavior is present in Internet Explorer, Mozilla FireFox, Opera, and Microsoft Word.

Regards, Andrey Kamimura.