This is a migrated thread and some comments may be shown as answers.

RadGrid Exporting data to PDF

3 Answers 104 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Vitaly
Top achievements
Rank 1
Iron
Iron
Vitaly asked on 09 Oct 2013, 08:42 PM
Good afternoon,
I am trying to exporting RadGrid to PDF and received runtime error:
Invalid XHTML. RadGrid has to render correct XHTML in order to export to PDF. Parse error: '.', hexadecimal value 0x00, is an invalid character. Line 5036, position 159. at line: 1041399P5655380794N112 08/20/2012500209.90

Please help me.

Thanks so much.

3 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 14 Oct 2013, 09:01 AM
Hello Vitaly,

As the exception points out some of the text contains an invalid characters and XHTML validation could not pass. You could try the following RegEx which removes those invalid characters from the text.
public static string RemovesInvalidXhtmlChars(string text)
{
    string re = @"[^\x09\x0A\x0D\x20-\xD7FF\xE000-\xFFFD\x10000-x10FFFF]";
    return Regex.Replace(text, re, "");
}
If that this not helps could you please provide us with the problematic text in order to investigate the issue further.

Regards,
Kostadin
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Pinky
Top achievements
Rank 1
answered on 08 Apr 2016, 08:19 AM

Hi, Im facing similiar problem while exporting RadGrid to excel in WPF and tried above solution by filtering some characters from output, but it does not work.

string re = @"[^\x09\x0A\x0D\x20-\xD7FF\xE000-\xFFFD\x10000-x10FFFF]";

strOutput = Regex.Replace(strOutput, re, "");

Pls suggest further.

0
Stefan Nenchev
Telerik team
answered on 13 Apr 2016, 07:27 AM
Hello Pinky,

Can you please provide us with more information on how the export is set on your end. Are you using the Export method and if so what is the ExportFormat that you have set in order to export the grid to excel? In Q1 2015 we introduced the ExportToXlsx method for the RadGridView, can you please test if the issue is present with it as well? In case the issue is still present, it will be highly appreciated if you can provide us with the implementation from your end -  a sample project that reflects the undesired behavior will be the best case. As this thread is related to the Telerik UI for ASP.NET AJAX suite, I suggest you create another ticket regarding your issue or check the threads in the UI for WPF forum.

Regards,
Stefan Nenchev
Telerik
Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Tags
General Discussions
Asked by
Vitaly
Top achievements
Rank 1
Iron
Iron
Answers by
Kostadin
Telerik team
Pinky
Top achievements
Rank 1
Stefan Nenchev
Telerik team
Share this question
or