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

Grid .. Flawed/poor export to html/pdf and Excel.

1 Answer 147 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Imran
Top achievements
Rank 1
Imran asked on 04 Aug 2010, 04:04 AM
I have experimented with the export functionality of Radgrid to html , pdf and Excel.
In my opinion its not worth putting it to the production version.

Export to PDF just jumbles up the columns if wrap text is set in the column. It should have exported "what you see is what you get" ... Infragistics control do that and they this functionality working fine for the last two years....

Export to Excel screws up the Date type columns.  .e.g the date column having value as 2007/12/01 is exported as 39417 .. no idea what it is ??
In export to html it just appends time to it also.. just as 12:00 AM etc
I am attaching the screenshots of original grid and then the export to each format as explained above...

Telerik should have tested it thoroughly and added good documentation and examples...

1 Answer, 1 is accepted

Sort by
0
Martin Vasilev
Telerik team
answered on 06 Aug 2010, 04:05 PM
Hello Imran,

Thank you for your feedback.

I did not manage to reproduce overlapped columns shown in your exported pdf screenshot. Could you give me more details as to what grid and export settings you are using? Also, I would like to note you that ExportToPDF has a lot of properties and formatting event, which give possibility to tune it up depending of the custom scenario. In your case you can try to use FitToPageWidth and Scale properties to size the table more  precisely.

As to the formatting issues, we do not exports exactly what you see, since we want to preserve the actual data which grid contains. It is up to you to made any appropriate additional formatting to match your requirements and take in consideration format specifics for the different file types. For that propose we offer various possibilities:

To make a custom formatting of date time values in ExportToExcelML you should use column's ExcelExportType and ExcelExportFormatString:
 
this.radGridView1.MasterTemplate.Columns["date"].ExcelExportType = DisplayFormatType.Custom;
this.radGridView1.MasterTemplate.Columns["date"].ExcelExportFormatString = "dd.MM.yyyy";

To format data value in html export you can use HtmlCellFormatting event:
void htmlExporter_HTMLCellFormatting(object sender, HTMLCellFormattingEventArgs e)
{
    //format datetime value
    if (e.GridColumnIndex == 5 && !String.IsNullOrEmpty(e.InnerCellValue.ToString()))
    {
        e.HTMLCellElement.Value = ((DateTime)e.InnerCellValue).ToString("dd/MM/yyyy");                
    }
}

I look forward to your pdf export details. I will be glad to investigate further described issue.

Regards,
Martin Vasilev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Imran
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Share this question
or