I have a simple page using a GridWeb control. The control may be empty allowing the user to create a sheet from scratch and save it. So far no problem. I also allow the user to upload a file that I first save and then use ImportExcelFile to load the GridWeb.
I have been able to use this latter technique with files that were created from scratch using the GridWeb, as well as a few others than I created from scratch using Excel 2003.
However several spreadsheets will not display. These I got from various sources. In fact the one attached that won't load was created using Cells with the following statement:
workbook.Save(filePath, new XlsSaveOptions(SaveFormat.Excel97To2003));
I get no errors; just nothing displayed.
I have attached 2 files. Their names indicate which one works and which one does not.
The GridWeb decalaration:
<acw:GridWeb ID="GridWeb1" runat="server" Height="400px" Width="1200px" PresetStyle="Colorful2"
ShowLoading="false" OnSaveCommand="GridWeb1_SaveCommand" EnableClientColumnOperations="true"
EnableClientMergeOperations="true" EnableClientResizeColumnRow="true" EnableClientRowOperations="true"
MaxColumn="50" MaxRow="500" ShowCommandBarAtTop="true" ShowContextMenu="true" OnCustomCommand="GridWeb1_CustomCommand"
ShowTabBar="false" EnablePaging="false" ShowSaveButton="false" ShowSubmitButton="false" ShowUndoButton="false">
<CustomCommandButtons>
<acw:CustomCommandButton ID="cmdSave" Text="Save" Command="cmdSave" ImageUrl="Images/24x24 save.png" ToolTip="Save and leave sheet open" Width="26px">
</acw:CustomCommandButton>
<acw:CustomCommandButton ID="cmdSave2" Text="Save" Command="cmdSave" ImageUrl="Images/spreadSave.png" ToolTip="Save and leave sheet open" Width="45px">
</acw:CustomCommandButton>
<acw:CustomCommandButton ID="cmdSaveClose" Text="Save & Close" Command="cmdSaveClose" ImageUrl="Images/24x24 file_apply.png" ToolTip="Save and close sheet" Width="26px">
</acw:CustomCommandButton>
<acw:CustomCommandButton ID="cmdSaveClose2" Text="Save & Close" Command="cmdSaveClose" ImageUrl="Images/spreadSaveClose.png" ToolTip="Save and close sheet" Width="92px">
</acw:CustomCommandButton>
<acw:CustomCommandButton ID="cmdClose" Text="Close" Command="cmdClose" ImageUrl="Images/24x24 file_cancel.png" ToolTip="Close sheet (unsaved changes will be lost)" Width="26px">
</acw:CustomCommandButton>
<acw:CustomCommandButton ID="cmdClose2" Text="Close" Command="cmdClose" ImageUrl="Images/spreadClose.png" ToolTip="Close sheet (unsaved changes will be lost)" Width="40px">
</acw:CustomCommandButton>
</CustomCommandButtons>
</acw:GridWeb>
The code behind that loads the GridWeb:
protected void loadSheet()
{
String docFileName = Session["currentWorksheetGUID"].ToString() + ".xls";
String docURL = Server.MapPath(@"~\Worksheets\") + docFileName;
if (File.Exists(docURL))
GridWeb1.WebWorksheets.ImportExcelFile(docURL);
}
Any ideas?
Thanks
Jim