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

Export to Excel in Q3 2012

1 Answer 92 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Rieni De Rijke
Top achievements
Rank 1
Rieni De Rijke asked on 22 Oct 2012, 09:15 AM
Export from RadGridView til Excel is still a bit strange:

I used the Telerik Wpf example "Word, Excel, CSV Export.

1. I choose "Excel" and I save te file as ExcelTest.xls
- I get a warning about the format when opening the file in Excel
- Most of the data is changed to text/string.
2. I choose "Excel" and I save te file as ExcelTest.xml
- I get a warning about the format when opening the file in Excel
- Most of the data is changed to text/string.
3. I choose "ExcelML" and I save te file as ExcelTest.xml
- All the data is changed to text/string.

What I expected is:
- No warning from Excel about the format.
- Numbers stay numbers, dates stay dates, money stays money... and so on.

What am I doing wrong?

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 23 Oct 2012, 08:36 AM
Hello,

This warning message would be an expected one. Generally RadGridView can export to HTML and ExcelML - in both cases not native for Excel 2007. In case of HTML export you will get such warning, however if you export to ExcelML with XML extension you will not get it. 

The type of the exported values will be string if you have applied a string formatting, otherwise the type will be the type of the data. 

Lets say you have formatted a Double value. In order to export them as Double for example, you will need to change the type of the data to be exported. For that  purpose, you should subscribe for the ElementExporting event of the GridView and return a Double value to be exported. 

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Tags
GridView
Asked by
Rieni De Rijke
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or