Problem opening downloaded excel file into a different version of excel

I am downloading an excel file from a server onto a browser machine. The downloaded excel file opens on Excel 2002 (SP3). But when i try to open that file on some other machine having Excel 2000 or Excel 2003, it doesn't get open on those machines. The excel application crashes there after. I am writing the following code to save my excel file onto client's machine.

HttpContext.Current.Response.ContentType = "application/xls";

HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=JobProfiles.xls");

workbook.Save("JobProfiles.xls", SaveType.OpenInExcel, FileFormatType.Default, HttpContext.Current.Response);

Hi,

Thanks for considering Aspose.

Please do one of the following options:

1. Please eliminate the first two lines of your code and only use the line: workbook.Save("JobProfiles.xls", SaveType.OpenInExcel, FileFormatType.Default, HttpContext.Current.Response); This line sets the contents types and add Response header to write the file data into MS Excel.

2. You may also try, here is an example:

Workbook workbook = new Workbook();

workbook.Worksheets[0].Cells["A1"].PutValue("Hello World!");

MemoryStream ms = new MemoryStream();

workbook.Save(ms, FileFormatType.Default);

byte[] data = ms.ToArray();

this.Context.Response.Clear();

this.Context.Response.ContentType = "application/vnd.ms-excel";

this.Context.Response.AddHeader("content-disposition", "attachment; filename=JobProfiles.xls");

this.Context.Response.OutputStream.Write(data, 0, data.Length);

this.Context.Response.End();

Which version of Aspose.Cells you are using, Kindly use the latest version (4.2.0.0).

Thank you.

Hi,

Thanx for your quick reply.

I have tried both of the options suggested by you. But the problem still persists. The version of Aspose.cells, which i am using is 4.1.1.0. May be because of this i am facing this problem. I will have to check out.