PDF Export fails with special characters in data

5 posts, 0 answers
  1. don
    don avatar
    34 posts
    Member since:
    Aug 2007

    Posted 27 Dec 2007 Link to this post

    Dear Telerik,

    I am using RadGrid Prometheus to export a report to PDF. One of my data test data elements contains lots of special characters to make sure the application handles that data correctly. Here is that data item:

    Dev /Item\3!@#$%^&amp;*(){}[];:'",<.>?/~`

    It shows fine in the grid, but on export to PDF, I get this error:

    Error Description: Invalid XHTML. RadGrid has to render correct XHTML in order to export to PDF.

    Parse error:

    Name cannot begin with the '.' character, hexadecimal value 0x2E. Line 1230, position 44.



    Do I have to manually trap and convert these somehow to make them work?

    Thanks,

    Don
  2. John
    John avatar
    416 posts
    Member since:
    Oct 2006

    Posted 03 Jan 2008 Link to this post

    hi

    you can use ItemDataBound event handler to replace "<" with &lt; and ">" - &gt;


    Here is example:
    ----
        void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridDataItem)
            {
                GridDataItem gridDataItem = (GridDataItem)e.Item;
                gridDataItem["Column_0"].Text = gridDataItem["Column_0"].Text.Replace("<", "&lt;");
                gridDataItem["Column_0"].Text = gridDataItem["Column_0"].Text.Replace(">", "&gt;");
            }

    -----

    Hope this helps...
    <John:Peel />
        }
  3. soumen
    soumen avatar
    5 posts
    Member since:
    Aug 2015

    Posted 04 Sep 2015 in reply to John Link to this post

    Thanks John
  4. soumen
    soumen avatar
    5 posts
    Member since:
    Aug 2015

    Posted 04 Sep 2015 Link to this post

    I have a  telerik rad grid which is containing a title in which having a character ">", I have replaced ">" by "&gt" . Now when I want to export  the grid into pdf format it is displaying "&gt" instead of ">". How can i replace "&gt" by ">"  in Pdf.

    please give me a suggestion.

     

     

     

  5. Eyup
    Admin
    Eyup avatar
    3320 posts

    Posted 08 Sep 2015 Link to this post

    Hi Soumen,

    You can use the ItemCommand event handler provided by RadGrid to achieve this requirement:
    Dim isExporting As Boolean = False
    Protected Sub dgColors_ItemCommand(sender As Object, e As GridCommandEventArgs)
        If e.CommandName = RadGrid.ExportToPdfCommandName Then
            isExporting = True
            ' use this variable to determine whether the > should be changed to &gt or not
        End If
    End Sub

    Hope this helps.

    Regards,
    Eyup
    the Telerik team
    Instantly find answers to your questions at the new Telerik Support Center
Back to Top