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

Email RadGrid Export To Excel with ExcelXlsx ExportType

2 Answers 131 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Louis
Top achievements
Rank 1
Louis asked on 01 Dec 2015, 03:01 PM

I'm using the ExportType.ExcelXslx to export my grid as "Xslx" file, It's working well.

Unfortunatly, when I try to export the grid as Excel file to an email, the Excel file is corrupt.

I get the e.ExportOutput and get bytes from en AsciiEncoding like I did with ExcelML export type in the GridExporting method.

var gridMemoryStream = new MemoryStream(new ASCIIEncoding().GetBytes(e.ExportOutput));

 

What's the proper way to get the "Xlsx" file from an RadGrid at the ExportExcel() without file corruption ?

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Kostadin
Telerik team
answered on 04 Dec 2015, 08:15 AM
Hi Louis,

I test the provided sample but I used a FileStream and save the exported file on the server. When I open the file no error message is thrown. Could you please verify that you did not receive a corrupted file when you are using the built-in export and download the document? Also you can try using the following approach to get the byte array instead using an AsciiEncoding.
Encoding.GetEncoding(1252).GetBytes(e.ExportOutput);

Regards,
Kostadin
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Louis
Top achievements
Rank 1
answered on 10 Dec 2015, 01:24 PM
Thanks for the quick anwser !
Tags
Grid
Asked by
Louis
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Louis
Top achievements
Rank 1
Share this question
or