Export to excel error

Hi

I am unable to export to excel using Aspose.cells fro .Net in fire fox.

Please see the attached error message

Error Message:

c:\DOCUMEN~1\CEW~1\Locals~1\Temp\Muuk.xls could not be saved, because the source file could not be read.
Try again later or contact an administrator.

Please some one can help in this regards?

Hi,



Please download and use the latest version: Aspose.Cells for .NET v7.2.1.5

If you still find any issue, kindly do create a sample project (with template files), zip it and post it here to reproduce the issue on our end. We will look into your issue soon.

By the way, the issue might be related to the rights, please make sure that you have sufficient rights to read/write the files to your specified locations.

Thank you.

Hi Amjad,
Thanks a lot for your prompt reply.
I have used the new version of Aspose cells dll and i have received the same error that i have attached in the first post.
Please find the attached sample code as zip format.I am using the same piece of code in my application.
Please go thru my code and find if there any thing i have missed there.

Please note that this was used to work as expected with the old version without any issues.This error is coming recently only.And also same code is working in my Dev environment.i hosted the site in my local and its working fine as well.But where as in case of live environment i am getting that error.

In LIVE also it was working fine earlier.But recently i am facing this error.Cold you please tell me what went wrong in this case?

I look forward for your replay


Thanks a lot

Hi,


I have run your project/sample code, it works absolutely fine. Please find attached the output file that is generated running your sample code.

I think it might be some configuration or rights issues on your live server. Please make sure that you have administrative rights on the server. I think to confirm your issue, you may run a simple code (via System.IO + Response APIs) without using Aspose.Cells APIs and check if you get the similar issue.
e.g (Please simply open/save a file)

FileStream fs1 = new FileStream(“d:\Book1.xlsx”, FileMode.Open, FileAccess.Read);
byte[] data1 = new byte[fs1.Length];
fs1.Read(data1, 0, data1.Length);
this.Response.ContentType = “application/xlsx”;
Response.AddHeader( “content-disposition”,“inline; filename=outBook1.xlsx”);
Response.BinaryWrite(data1);
Response.End();


By the way, do you use Partial trust or medium trust level/mode on your live server. If this is the case, please see the document for your reference:
http://www.aspose.com/docs/display/cellsnet/Declaration



Thank you.

Hi Amjad,

I have tried without Aspose using the sample code that you given.its working fine with that code.
If I use Aspose again getting the same error.I think this is something related to Aspose only.

I have hosted the application in IIS 7 in LIVE server.Could you please tell me that what type of trust level that Aspose expects?And also tell me how to set the trust level accordingly


Thanks,

Hi,

Please try running your application in a Full Trust level and see if it resolves your error.

Please see these articles how to set the trust level in a web.config file

ASP.NET Trust Levels and Policy Files
How To: Use Medium Trust in ASP.NET 2.0

Hi Amjad,

Currently i am using Full Trust level only.I tried with other trust level but that doesn’t helped me.
No configuration changes are done on LIVE server and earlier its used to work but now this facing this error.I have hosted this application in different servers to test this issue and receiving the same error from all the servers.
Could you please tell me why this is not working now all of sudden?


Thanks

Hi,


As I told you earlier, I could not find the issue using your sample code in my environment (OS Win7.0, VS.NET 2008, browser: Google Chrome), I attached the generated file in my previous post which is fine.
Moreover, you only try to use Full Trust level and complete administrative rights on the server.
Our hundreds of clients are using our Aspose.Cells for .NET in their diverse web environments with success, I could not find one client to find such an issue as you encounter.

I am not sure why you got this issue on your live server and not on your desktop/developer environment, May be you may try to compare the configurations and settings of the live server (e.g OS, .NET framework, IIS settings etc.) with your development server(where everything works fine).

We will look into your issue we could trace your issue. If we found any clue, we will let you know here.
BTW, you may write your live server details here.

Hi,


As a side note, could you try to save save the Excel file to MemoryStream, then export the stream to Response object if it works fine in your live Server.

Thank you.

Dear Amjad,

This issue is with Fire Fox and Google Chrome.Its working fine in IE.

Live Environment Configuration:
OS:Windows Server 2008
IIS:IIS 7
Trust Level:Full Trust

My only question to you is,If I use .Net file stream its working fine in all the browser.But where as in case of ASPOSE ,Its not working Firefox and Chrome

I hope this will help you to trace this issue.
Please let me know you need any other information to trace this issue

Thanks
Nagamani

Hi,

a) Please call Response.End after calling workbook.Save method:

C#


wb.Save(this.Response, “AlertSummary.xls”, Aspose.Cells.ContentDisposition.Inline, new Aspose.Cells.XlsSaveOptions(Aspose.Cells.SaveFormat.Excel97To2003));

Response.End();


b) If Response.End() still does not workbook, please save the workbook to stream, then export it by Response, see the following code:

C#
MemoryStream ms = new MemoryStream();
wb.Save(ms, new Aspose.Cells.XlsSaveOptions(Aspose.Cells.SaveFormat.Excel97To2003)); ;

this.Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("content-disposition", "inline; filename=AlertSummary.xls");
Response.BinaryWrite(ms.ToArray());

Response.End();