Free Support Forum - aspose.com

File is empty on response

Hello,

I have the following proble with Aspose.Cells Excel generator and ASP.NET. When I create Excel file from template, fill it my data and trying to seve it to Response I receive empty file on client side. To save it I use following code:

wbDesigner.Save(“WebsiteUsageStat_” + DateTime.Now.ToString(“MMddyyyy”) + “.xls”,SaveType.OpenInExcel, FileFormatType.Excel97, Page.Response);

Also following method didn’t help:

Response.ContentType = “application/vnd.ms-excel”;
Response.AddHeader(“Content-Disposition”, String.Format(“attachment;filename={0}”, “WebsiteUsageStat_” + DateTime.Now.ToString(“MMddyyyy”) + “.xls”));
Response.BinaryWrite(wbDesigner.Workbook.SaveToStream().ToArray());
Response.Flush();
Response.Close();

How can I solve this problem?

Thanks.

Hi,

It might be a problem with HTTP compression. Could you check for your reference:

http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/httpsssl-issue.html

Thank you.

Hello,

As you can see in my post we tryed the method discribed in reference you’ve posted, it didn’t help. Bowser receives excel file, but it’s with zelo length. Browser receives even correct content length, but do not receives file.

Thanks.

Hi,

Well, it's strange that you got blank workbook in the browser, what happens when you simply save the file clicking on the Save button instead of Open button on the download dialog box. Is the file fine with all the data when you open the file into MS Excel manually after saving the file. For your info, I don't find any problem that you have talked about. Could you run our featured demos: http://www.aspose.com/demos/aspose.cells/default.aspx if they work fine on the your client side. I think you may also try to run these demos locally on your system (these demos are automatically installed on your system when you intall Aspose.Cells.msi) and check if they work fine.

And by they way do you save the file two times or more than two times altoghether in your code. For your info, after calling Workbook.Save() method, all the data, objects related the workbook would be null, so, aparently there is no meaning the second saving altogether. Therefore, if you want to save the book two times, you do need to intialize / fill the data related objects before calling the Save() method. We should be greatful if you would create a sample demo application and post it here for further investigation.

Thank you.