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

ExportToExcelML Creating bad files?

4 Answers 212 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Hannah
Top achievements
Rank 2
Hannah asked on 22 Jun 2013, 12:01 AM
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)


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?  

4 Answers, 1 is accepted

Sort by
0
Hannah
Top achievements
Rank 2
answered on 26 Jun 2013, 03:51 PM
At this point I'll add, I'd be happy with a simply confirmation that this does or does not happen to anyone else.  lol  There has to be someone that could add to this, no?

Thanks all!
0
Ivan Petrov
Telerik team
answered on 26 Jun 2013, 03:51 PM
Hi Wayne,

Thank you for writing.

You are the first to report such an issue. I tried to reproduce it but I was not able to. I would kindly ask you to send some more information on your case. Which version did you upgrade from and to, what data do you export, a sample exported file might help as well. If you are able to reproduce the issue in a sample project and send it to me I will be able to investigate the issue further.

Looking forward to your reply.

Regards,
Ivan Petrov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Anwar
Top achievements
Rank 1
answered on 02 Jul 2013, 08:55 AM
Hi,

I'm having the same problem. The exported file is not saved as .xls and keep on saved as an xml
0
Ivan Petrov
Telerik team
answered on 05 Jul 2013, 09:56 AM
Hello Anwar,

Thank you for writing.

We have accumulated all the information regarding exporting RadGridView to xls/xlsx and ways to avoid the message that appears when an exported file is opened into a Knowledge Base article which you can find by following this link.

I hope this will be useful. Should you have further questions, I would be glad to help.

Regards,
Ivan Petrov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINFORMS.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
GridView
Asked by
Hannah
Top achievements
Rank 2
Answers by
Hannah
Top achievements
Rank 2
Ivan Petrov
Telerik team
Anwar
Top achievements
Rank 1
Share this question
or