RadGrid Exporting data to PDF

4 posts, 0 answers
  1. Vitaly
    Vitaly  avatar
    68 posts
    Member since:
    Aug 2011

    Posted 09 Oct 2013 Link to this post

    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.
  2. Kostadin
    Kostadin avatar
    1686 posts

    Posted 14 Oct 2013 Link to this post

    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.

    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.
  3. DevCraft R3 2016 release webinar banner
  4. Pinky
    Pinky avatar
    1 posts
    Member since:
    Mar 2016

    Posted 08 Apr in reply to Kostadin Link to this post

    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.

  5. Stefan Nenchev
    Stefan Nenchev avatar
    236 posts

    Posted 13 Apr Link to this post

    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.

    Stefan Nenchev
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top