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

Radgrid.ExportToExcel With DataList

1 Answer 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roger Barnes
Top achievements
Rank 1
Roger Barnes asked on 30 Apr 2010, 03:10 PM

I've got a RadGrid that contains multiple DataList in a template column, most all the values are numeric, but not all.  I can export to excel, and most everything is correct, however in my situation, I need different formats for the cells, depending on the datalist.

This is my export secion

        gv.ExportSettings.FileName = Format(Now(), "MMddyyyy")  
        gv.ExportSettings.IgnorePaging = True 
        gv.ExportSettings.ExportOnlyData = False 
        gv.ExportSettings.OpenInNewWindow = True 
        gv.ExportSettings.HideStructureColumns = True 
        gv.MasterTableView.ExportToExcel()  
 

Example Output

From the sample, which is linked to above, I need a different format on the numeric values for SP, CFM, BHP and Sone, which I have working on the screen.  The issue is when I export to excel trailing 0's on the decimal fields are chopped off.  If it's whole number, the trailing 0's aren't chooped off.  Per the link to the Example output,
SP cell c1 should be 0.000 cell K1 should be 1.000, always contain three decimals
BHP cell c6 should be 1.370, always contain three decimals

The Radgrid is a copy of the grid shown on the screen, I need slightly different formating when exported versus what's shown on the screen.  I've wired up the ExcelExportCellFormatting event to gv
AddHandler gv.ExcelExportCellFormatting, AddressOf Me.gv_ExcelExportCellFormatting  
 
 

 

 

I can get the individual datalist in this event, but how do I apply a specific format to the Cells within the Datalist whenexported to Excel?

Hopefully I've provided enough info to get some assistance here, of not let me know and I'll try respond with additional info.

Thanks in Advance

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 05 May 2010, 04:11 PM
Hello Roger,

Please download the attached project and let me know if you need further assistance.

I also recommend you examine the following link:
Word/Excel export (HTML-based)

Best regards,
Daniel
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
Grid
Asked by
Roger Barnes
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or