public void SaveToExcel(Stream fileStream)
{
GridViewExportOptions exportOptions = new GridViewExportOptions();
exportOptions.Format =
ExportFormat.ExcelML;
exportOptions.ShowColumnHeaders =
true;
exportOptions.Encoding =
Encoding.UTF8;
using (fileStream)
{
if (fileStream.CanWrite)
Export(fileStream, exportOptions);
}
}
First scenario:
When the user uses this, he gets a dialog box that offers one file type - Excel 97-2003. (in ExcelML)
The file is saved and appears on disk as an xls file.
The user opens the file in Excel 2003 (no warnings from Excel) and creates a pivot table.
User clicks "Save" - Excel gives no warnings.
User closes Excel. File still appears on disk as an xls file.
User starts Excel and opens file: Receives message that there was a problem with a pivot table. Pivot table is gone and user has lost hours of work.
**************************************
Second scenario:
User exports another GridView to a new file.
Opens file in Excel 2003 (no warnings)
User creates pivot table.
User clicks "Save As" (instead of "Save")
User choses to save in xls format.
Closes Excel.
Opens Excel and opens the file - no warnings and the pivot table is there. File is unharmed.
So there is a workaround but the users don't like it very much, and there's still too much potential for error.
Thanks,
Mike