Seems that since I've upgraded the ExportToExcelML command has been failing on me. It creates a file no problem, but I'm getting an "Excel cannot open the file 'blah.xlsx' because the file format or file extension is not valid." error.
Here is what I'm doing (and this worked prior to the recent upgrade)
Anyone else experiencing the same issue?
Here is what I'm doing (and this worked prior to the recent upgrade)
void
btnExportExcel_Click(
object
sender, EventArgs e)
{
this
.SaveFileDialog.Filter =
"Excel Workbook (*.xlsx) |*.xlsx|Excel 97-2003 Workbook (*.xls)|*.xls"
;
if
(
this
.SaveFileDialog.ShowDialog() == DialogResult.OK)
{
ExportToExcelML exporter =
new
ExportToExcelML(
this
.dgResults);
exporter.HiddenColumnOption = Telerik.WinControls.UI.Export.HiddenOption.DoNotExport;
exporter.ExportVisualSettings =
true
;
exporter.SheetName =
this
.GridTitle;
if
(Path.GetExtension(
this
.SaveFileDialog.FileName) ==
".xls"
)
{
exporter.FileExtension =
"xls"
;
exporter.SheetMaxRows = ExcelMaxRows._65536;
}
else
{
exporter.FileExtension =
"xlsx"
;
exporter.SheetMaxRows = ExcelMaxRows._1048576;
}
try
{
this
.lblReady.Text =
"Exporting to Excel..."
;
this
.StatusStrip.Refresh();
using
(
new
UtilLib.Winforms.WaitCursor())
{
exporter.RunExport(
this
.SaveFileDialog.FileName);
}
}
catch
(Exception ex) { UtilLib.Winforms.Feedback.DisplayError(ex); }
finally
{
this
.lblReady.Text =
"Ready"
;
}
}
}
Anyone else experiencing the same issue?