3 Answers, 1 is accepted
0

Brian
Top achievements
Rank 1
Iron
Iron
answered on 20 Dec 2017, 03:06 PM
Here is the exact code I have tried. I also noticed that it will not export as an xml extension, it exports as xls even though I have the file name specified.
private void radBtnExcel_Click(object sender, EventArgs e)
{
ExportData();
}
void ExportData()
{
//ExportToExcelML exporter = new ExportToExcelML(radGv);
var excelML = new ExportToExcelML(radGv);
excelML.ExportVisualSettings = true;
radGv.Columns["Success Ratio"].ExcelExportType = DisplayFormatType.Custom;
radGv.Columns["Success Ratio"].ExcelExportFormatString = "0:#0.000%; (0000#);none";
excelML.SheetMaxRows = ExcelMaxRows._1048576;
excelML.RunExport("c:\\#support\\CTCStatistics.xml");
}
0
Accepted
Hello Brian,
Thank you for writing.
It appears that the number format you are using is not valid for Excel. You can try this way:
Additionally, you can also check the following article: https://support.office.com/en-us/article/Create-or-delete-a-custom-number-format-78f2a361-936b-4c03-8772-09fab54be7f4.
Regarding the extension of the exported file, you can you can set the FileExtension property:
I also recommend switching the GridViewSpreadExport class as it is using the spread processing libraries and it can directly export in the .xlsx format: https://docs.telerik.com/devtools/winforms/gridview/exporting-data/spread-export.
I hope this helps. Should you have further questions please do not hesitate to write back.
Regards,
Hristo
Progress Telerik
Thank you for writing.
It appears that the number format you are using is not valid for Excel. You can try this way:
this
.radGridView1.Columns[0].ExcelExportType = Telerik.WinControls.UI.Export.DisplayFormatType.Custom;
this
.radGridView1.Columns[0].ExcelExportFormatString =
"#0.000%; (0000#);"
;
Additionally, you can also check the following article: https://support.office.com/en-us/article/Create-or-delete-a-custom-number-format-78f2a361-936b-4c03-8772-09fab54be7f4.
Regarding the extension of the exported file, you can you can set the FileExtension property:
ExportToExcelML exporter =
new
ExportToExcelML(
this
.radGridView1);
exporter.FileExtension =
"xml"
;
I also recommend switching the GridViewSpreadExport class as it is using the spread processing libraries and it can directly export in the .xlsx format: https://docs.telerik.com/devtools/winforms/gridview/exporting-data/spread-export.
I hope this helps. Should you have further questions please do not hesitate to write back.
Regards,
Hristo
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0

Brian
Top achievements
Rank 1
Iron
Iron
answered on 02 Jan 2018, 02:21 PM
That did the trick. Appreciate the help.