Completed
Last Updated: 15 Sep 2015 06:42 by ADMIN
ADMIN
Dess | Tech Support Engineer, Principal
Created on: 09 Dec 2013 10:37
Category: GridView
Type: Bug Report
0
FIX. RadGridView - GridPdfExport Exception is thrown when exporting
To reproduce: 
-add a RadGridView and a RadButton; 
Use the following code: 
public Form1() { InitializeComponent(); List<Item> list = new List<Item>() { new Item(1, "<AUD#F-DC>") }; radGridView1.DataSource = list; } public class Item { public int ID { get; set; } public string Title { get; set; } public Item(int iD, string title) { this.ID = iD; this.Title = title; } } private void Form1_Load(object sender, EventArgs e) { this.employeesTableAdapter.Fill(this.nwindDataSet.Employees); } private void radButton1_Click(object sender, EventArgs e) { ExportToPDF pdfExporter = new ExportToPDF(this.radGridView1); pdfExporter.PdfExportSettings.Title = "My PDF Title"; pdfExporter.PdfExportSettings.PageWidth = 297; pdfExporter.PdfExportSettings.PageHeight = 210; pdfExporter.PageTitle = "temp"; pdfExporter.FitToPageWidth = true; pdfExporter.SummariesExportOption = SummariesOption.ExportAll; pdfExporter.ExportVisualSettings = true; try { pdfExporter.RunExport(@"..\..\..\pdfExport.pdf"); } catch (IOException ex) { RadMessageBox.Show(this, ex.Message, "I/O Error", MessageBoxButtons.OK, RadMessageIcon.Error); } }

Workaround: 
pdfExporter.HTMLCellFormatting += pdfExporter_HTMLCellFormatting; 
private void pdfExporter_HTMLCellFormatting(object sender, HTMLCellFormattingEventArgs e) { string val = e.HTMLCellElement.Value; e.HTMLCellElement.Value = val.Replace("<", "&lt;").Replace(">", "&gt;"); }
0 comments