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

export to ecxcel is giving some message with aspx page

1 Answer 125 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Krishna
Top achievements
Rank 1
Krishna asked on 25 Mar 2009, 10:56 PM
Hi team,

I am using below code to export to excel.. with version 2008.3.1125.35
                grdData.Rebind();
                grdData.ExportSettings.IgnorePaging = true;
                grdData.ExportSettings.FileName = "KIPReport";
                grdData.ExportSettings.ExportOnlyData = true;
                grdData.MasterTableView.ExportToExcel();


there is a warning message with the name of aspx page as below

---------------------------
Microsoft Office Excel
---------------------------
The file you are trying to open, 'Results.aspx', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?
---------------------------
Yes   No  
---------------------------

is there any way i can get rid of this message .. if not at least it should give the file name i specified in the code

Thanks
-Krishna

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 26 Mar 2009, 04:17 AM
Hi Krishna,

You might receive the following dialog box message when you try to save files with Office 2007:
"The file you are trying to open, 'filename.xls', is in a different format than specified by the file extension. Verify that the file is not corrupted and is from a trusted source before opening the file. Do you want to open the file now?"

  I have read it some where in the forums that this message cannot be avoided since RadGrid has no way of knowing that the Office used to open the export is 2007. Since Microsoft have implemented some format optimizations which they claim lead to smaller file sizes among other things, Office 2007 tries to be smart and always warn that the document is not being exported in their new format. You can simply ignore it and click the Yes button to open the file. You can then save the file with a .xlsx extension instead of a .xls extension and next time you open the file locally, you will not receive this warning.

Regards
Shinu


Tags
Grid
Asked by
Krishna
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or