SaveType.OpenInExcel

If I google “Aspose cells number format”, I get taken to this address.

http://www.aspose.com/demos/.net-components/aspose.cells/vb.net/quick-start/formatting/number-formatting.aspx

There I find the code:
workbook.Save(“NumberFormatting.xls”, FileFormatType.Excel97To2003, SaveType.OpenInExcel, System.Web.HttpContext.Current.Response)



On my system SaveType is not declared.

I am importing Aspose.Cell and System, as per your example.

Also, obviously, there is no “SaveType” parameter in the workbook.Save command.

I am using a recent version of Cells (one or two months old).

What am I doing wrong?

Many thanks

Richard



Hi,

Please use this code to save your file in XLS or in XLSX format in Response stream.

C#


//Save file and send to client browser using selected format
if (yourFileFormat == “XLS”)
{
workbook.Save(HttpContext.Current.Response, “output.xls”, ContentDisposition.Attachment, new XlsSaveOptions(SaveFormat.Excel97To2003));

}
else
{
workbook.Save(HttpContext.Current.Response, “output.xlsx”, ContentDisposition.Attachment, new OoxmlSaveOptions(SaveFormat.Xlsx));
}

HttpContext.Current.Response.End();

Hi Richard,

I think you might be using the wrong dll of Aspose.Cells. When you use our product in a a web application, please use the Aspose.Cells.dll from the net2.0 folder in the “/bin” directory. I think you are using the ClientProfile version of Aspose.Cells Assembly. For your information, the dll in net3.5_ClientProfile directory is used only for the console application with Net frame client profile as the target framework of vs.net. Please check your project, it is possible that your project is referencing this dll. For complete reference, please read the readme.txt file in the bin directory.

Let us know if you still have any confusion.

Also, check the Saving Files document for your complete reference about Workbook.Save() different overloaded versions of methods:

(Note: please check the sub-topic “3. Saving file to Response Object” especially in the document)

Thank you.