Free Support Forum - aspose.com

Refresh

i am working with aspose.excel in an asp environment. the problem i have is that i need to be able to open 2 or more sheets in excel, but each sheet needs to be sent individually. basically, a user selects an item for whcih an excel sheet is generated and a sheet is sent via a asp response.output stream. i need to open each item's data in a separate sheet. i have given the sheets a unique name when they are generated, but that does not seem to do it. first excel sheet is shown, but subsequent ones do not add a sheet. nor do they refresh excel data (i.e. overwrite the original), unless i save the sheet locally. since saving the sheet does result in my code showing a new sheet, i know that the correct data is being sent out. i can even close the browser, restart the browser navigatet to the page with excel view, click on my generate excel report button and i still will not get a new sheet, so i do not think it is a caching problem...

This message was posted using Aspose.Live 2 Forum

Hi,

Thanks for considering Aspose.

Well, I don't find any problem with number of sheets in workbook. Since you are using some older version of Aspose.Excel which is now renamed to become Aspose.Cells now. The problem does not seems to be with the component. Any how could you give a try using the latest version of Aspose.Cells (4.4.1): http://www.aspose.com/community/files/51/aspose.cells/default.aspx.

If you still find the problem, could you create a sample project (with code and files etc.) with template file to reproduce the issue here. We will check it soon.

Thank you.

And by the way ... what happens in a desktop application: you may try to create a test console application, adds different worksheets with data filled and saved it to check if it works fine.

Thank you.

I am pretty sure it is Internet Explorer caching issue. Firefox works flawlessly w/o any code changes, and does exactly what is expected - new sheet for every “donwload” button click on the web page. My box has IE7, I will try another PC with IE6 as IE6 support is a must. It is actually quite bizarre - there are several Excel downloads, essentially cut-and-paste code, but in IE some downloads always work, some never work - only the 1st download works, other downloads fail to open an additional sheet. I am currently trying various header cache settings in an attempt to turn off caching in IE, but so far nothing seems to work. I know it is not an Aspose problem, but perhaps a workaround / cache settings are known to someone…

Please install all patches of windows and IE. It may solve your problem. And you can try to save the file into MemoryStream and set http headers with your own code:

//Saves file to memory

MemoryStream stream = new MemoryStream();

workbook.Save(stream, FileFormatType.Default);

//Following is Aspose code to send file to client browser, you can try to use you own code to set http headers to see if your problem can be solved

response.ContentType = "application/vnd.ms-excel";

//This is same as OpenInExcel option

response.AddHeader( "content-disposition","attachment; filename=book1.xls");

//This is same as OpenInBrowser option

//response.AddHeader( "content-disposition","inline; filename=book1.xls");

response.BinaryWrite(stream.ToArray());

Thanks, that is exactly the code we are using. We have traced the problem down to how our portal handles caching - it messes around with the headers in the pages and removes caching headers from the pages. Also, a second issue is how IE verses Firefox handles attachment naming (IE preserves names, Firefox adds a suffix to the attachment name and increments the suffix). The end result is that Firefox hands off a new sheet with a unique name to Excel, while with IE we (a) end up caching at the client level and (b) even when the attachement gets pas t the caching problem, IE re-use the same attachment name which in turn appears to prevent Excel from opening a new worksheet. It looks similar to the generally known issue with IE caching of FTP sites but made worse because the portal removes the headers that we put in to prevent client side caching.