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

PDF Export fails with special characters in data

4 Answers 355 Views
Grid
This is a migrated thread and some comments may be shown as answers.
don
Top achievements
Rank 1
don asked on 27 Dec 2007, 10:58 PM
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

4 Answers, 1 is accepted

Sort by
0
plamen
Top achievements
Rank 1
answered on 03 Jan 2008, 01:28 PM
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 />
    }
0
soumen
Top achievements
Rank 1
answered on 04 Sep 2015, 09:25 AM
Thanks John
0
soumen
Top achievements
Rank 1
answered on 04 Sep 2015, 09:31 AM

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.

 

 

 

0
Eyup
Telerik team
answered on 08 Sep 2015, 07:34 AM
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
Tags
Grid
Asked by
don
Top achievements
Rank 1
Answers by
plamen
Top achievements
Rank 1
soumen
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or