We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Hyperlink with the multiple query string parameters in AppendHTML throws error

We are trying create a word document using Syncfusion DocIO

We have a problem with the rendering of HTML when using the AppendHTML() method when the HTML text contains a hyperlink with more than one querystring parameters.

example :

When the HTML is of the form

'This is a sample HTML link Google Search
which is causing the error'

throws an error that the HTML is not in the correct format

but works fine if the HTML is of the form

'This is a sample HTML link Google Search
which is causing the error'

with only one query string parameter

We are using code as below

WTableRow tableRow = new WTableRow(document);
WTableCell tableCell = new WTableCell(document);
table.Rows.Add(tableRow);
tableRow.Cells.Add(tableCell);
IWParagraph para = tableCell.AddParagraph();
para.AppendHTML();


Any idea how the above issue can be solved is greatly appreciated

-Suman





5 Replies

SP Suman Pendyala December 20, 2011 01:40 AM UTC

Sorry there is correction to the post , the hyperlink in the first case was
http://www.google.com.sg/search?hl=en&source=hp&q=google&gbv=2
with multiple query string parameters

and the in second case it is
http://www.google.com.sg/search?hl=en
with only one query string parameter



PR Poornima R Syncfusion Team December 20, 2011 05:26 AM UTC

Hi Suman,


Thank you for your interest in Syncfusion Products.

Regarding the mentioned “Exception issue on appending the Html code (Hyperlink with multiple queries) using AppendHtml() method”:
Currently DocIO supports Html code or Html file that is XHTML 1.0 complaint. Here the provided html code is not XHTML1.0 complaint. Please find the html code from below and this code fails online W3c validation (http://validator.w3.org/check). According to XHTML1.0 standard any html code starting with & character is considered as an Html entity (such as &   etc). In the below html code, “&source” is considered as an invalid html entity causing the mentioned validation fail. Hence the mentioned exception issue (in AppendHtml() method) is the expected behavior of DocIO and not an issue with DocIO.

Html Code:
Google
Google

For more information about support XHTML elements and attributes, please refer the below link.

http://help.syncfusion.com/ug_94/Reporting/DocIO/ASP.NET/default.htm?turl=Documents%2F4427importingxhtml.htm


Please let us know if you have any questions.

Regards,
Poornima





PR Poornima R Syncfusion Team December 20, 2011 05:28 AM UTC

Hi Suman,


Please ignore my previous update.

Regarding the mentioned “Exception issue on appending the Html code (Hyperlink with multiple queries) using AppendHtml() method”:
Currently DocIO supports Html code or Html file that is XHTML 1.0 complaint. Here the provided html code is not XHTML1.0 complaint. Please find the html code from below and this code fails online W3c validation (http://validator.w3.org/check). According to XHTML1.0 standard any html code starting with & character is considered as an Html entity (such as &   etc). In the below html code, “&source” is considered as an invalid html entity causing the mentioned validation fail. Hence the mentioned exception issue (in AppendHtml() method) is the expected behavior of DocIO and not an issue with DocIO.

Html Code:
http://www.google.com.sg/search?hl=en&source=hp&q=google&gbv=2

For more information about support XHTML elements and attributes, please refer the below link.
http://help.syncfusion.com/ug_94/Reporting/DocIO/ASP.NET/default.htm?turl=Documents%2F4427importingxhtml.htm


Please let us know if you have any questions.

Regards,
Poornima





SP Suman Pendyala December 20, 2011 04:27 PM UTC

Hi Poornima,

So what is the solution you recommend for given issue?

Regards,
Suman



PR Poornima R Syncfusion Team December 21, 2011 08:28 AM UTC

Hi Suman,

Thank you for your update.

For your requirement of “Preserving multiple query hyperlinks in Html to Doc conversion without any exception”, please try replacing the invalid symbol & in the hyperlink with its equivalent html entity (&_amp ;( with underscore removed)) in the input html code. We have prepared the sample illustrating the same. Please find the sample from the below link. Try running the sample and let us know if this helps you.

Sample:
Sample53959409.zip


Please let us know if you have any questions.

Regards,
Poornima




Loader.
Live Chat Icon For mobile
Up arrow icon