I'm exporting to excel... it exports fine...
But when I open the file I get an MS Error
THE FILE YOU ARE TRYING TO OPEN TEST.XLS IS IN A DIFFERANT FORMAT THAN SPECIFIED BY THE FILE EXTENSION....
Any ideas? How I can I get rid of this msg?
thanks again
21 Answers, 1 is accepted
You get this message since the file is not in the default Excel format (XLSX) - most probably HTML. If you export the grid to ExcelML you will not get this message.
Regards,Vlad
the Telerik team
The following does not work... I even tried changing the the extension to xlsx
Any ideas... thanks
System.Windows.Forms.
SaveFileDialog saveDialog = new System.Windows.Forms.SaveFileDialog();
saveDialog.Filter =
"Excel files (*.xls) |*.xls|All files (*.*)|*.*";
saveDialog.DefaultExt =
"xls";
saveDialog.FilterIndex = 1;
if (saveDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
using (Stream stream = saveDialog.OpenFile())
{
GridViewExportOptions options = new GridViewExportOptions()
{
Format =
ExportFormat.ExcelML,
ShowColumnHeaders =
true,
ShowColumnFooters =
true,
ShowGroupFooters =
true,
};
grid.Export(stream, options);
}
}
You can check our demo for more info. The file is saved as xml. The example is for Silverlight however the code for WPF is the same.
Best wishes,Vlad
the Telerik team
I get the same message running the Silverlight export demo from your site as are my users.
What version of Excel are you opening the file in?
I'm using Office2007
thanks
You get this with ExcelML exporting?
Best wishes,Vlad
the Telerik team
It exports but I get the message on 5 differant PC.. even when running your SL demo from the web.
Can you tell me what is the extension of the exported file from our demo?
Regards,Vlad
the Telerik team
Hi..
It defaults to .XLS…
Just tried it on a vista machine… same issue
thanks
You have not selected ExcelML from the combo. Please try again our demo and check the code for more info.
I've attached a screenshot.
Greetings,
Vlad
the Telerik team
What's the purpose of XLS... if it doesn't work and you have to use XML?
thanks
I have the same issue when trying to open a .xls file exported by the RadGridView. Is there a way to avoid this warning message?
Here are the export options I'm using:
new GridViewExportOptions() |
{ |
Format = ExportFormat.ExcelML, |
ShowColumnHeaders = true, |
ShowColumnFooters = true, |
ShowGroupFooters = false, |
}); |
Thanks in advance,
Wagner
When you export with the ExcelML format, the correct extension is .xml, not .xls. That is why Excel complains.
Best wishes,Yavor Georgiev
the Telerik team
Thanks in advance,
Wagner
This file (with ExcelML content) will be recognized automatically as MS Excel file.
Kind regards,Vlad
the Telerik team
and used xml extension, had no problems double clicking on the file and it opened in excel without the error messages.datagrid.Export(stream,
new
GridViewExportOptions()
{
Format = ExportFormat.ExcelML,
ShowColumnHeaders =
true
,
ShowColumnFooters =
true
,
ShowGroupFooters =
false
,
});
[QCVG: Key=Chicago, IL; ItemCount=3; HasSubgroups=False; ParentGroup=[QCVG: Key=Root; ItemCount=7; HasSubgroups=True; ParentGroup=null];]; (unless I set ShowGroupFooters=false)
However, the real problem is that the grouping value is not displayed in my Excel file.
You should use the ElementExporting event to set cell values for group footers as shown in our demo.
Best wishes,Vlad
the Telerik team
Indeed the group row header will appear in the exported file (only the header however without aggregates). You can check the demo for reference - the WPF version is exactly the same.
Best wishes,Vlad
the Telerik team
I ran the Telerik demo, grouped by Name and exported to ExcelML. Then I double-clicked on the file to load it into Excel. Here is what I got (see screendump). I cannot see the group header. Can you? I can see a group FOOTER, but no HEADER. (I tried it in both the WPF and Silverlight demos just in case they were different - neither worked. The screendump is the WPF version.)
Hope you can help.
Unfortunately ExcelML does not support this. Please use HTML exporting instead.
Greetings,Vlad
the Telerik team