We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

ThreadAbortException when calling Aspose.Cells.Workbook.Save


I am making a call similar to the one below:

Aspose.Cells.Workbook m_excel = ;
m_excel.Save(string.Format(“erpt{0}.xls”, DateTime.Today.Second), Aspose.Cells.SaveType.OpenInBrowser, Aspose.Cells.FileFormatType.Excel2003, HttpContext.Current.Response);

When the Save is executed, I get the following error message:

exception System.Threading.ThreadAbortException: Thread was being aborted.
at System.Threading.Thread.AbortInternal()
at System.Threading.Thread.Abort(Object stateInfo)
at System.Web.HttpResponse.End()
at Aspose.Cells.Worksheets.?(String ?, SaveType ?, FileFormatType ?, HttpResponse ?)
at Aspose.Cells.Workbook.Save(String fileName, SaveType saveType, FileFormatType fileFormatType, HttpResponse response)

I am currently using version I
was using Aspose.Excel prior to this and the same code worked perfectly
fine. I recently migrated to Aspose.Cells.

Is there anything I can do?


It seems that this problem is caused by Aspose.Cells internally calls Response.End method. I remove it in this attached fix. Please try it.


The ThreadAbortException has disappeared now. However, instead of having the Excel show up in the new window, I get two Microsoft Excel error pop-ups:

Error 1: Could not open https://…/RunReport.aspx
Error 2: Microsoft Office Excel cannot access the file ‘https://…/RunReport.aspx’ There are several possible reasons:

- The file name or path does not exist.
- The file is being used by another program.
- The workbook you are trying to save has the same name as a currently open workbook.

I did a little digging and found this: http://support.microsoft.com/?kbid=323308

It mentions “Cache-control:no-store” and “Cache-control:no-cache”. This causes trouble with https. When I add ““BypassSSLNoCacheCheck”=Dword:00000001” to my registry, I am able to view the Excel in the new window.

This Cache-control and use of https may be causing the problem. Are there any differences between Aspose.Excel and Aspose.Cells pertaining to setting Cache-control?


To make Aspose.Cells working with http compression, we add this cache-control settings in http headers.

You can save Excel file to memory stream first then send it to client browser using your own code. Please check:



In Aspose.Excel, the API for:

DateTime.Today.Second), Aspose.Cells.SaveType.OpenInBrowser,
Aspose.Cells.FileFormatType.Excel2003, HttpContext.Current.Response);

works fine. After we upgraded to Aspose.Cells, this API no longer works the same way. Shouldn’t Aspose.Cells be backwards compatible? The page you pointed me to requires us to change our code in many places where it used to work perfectly fine.

Yes, you are right. Please try this attached version.

Thank you for the new version. Everything is working fine again. And thank you for the quick responses.

I have a workbook I am trying to save.

I am calling this method:
workbook.Save(stream, FileFormatType.Excel2003);

When adding about 40000 rows it works.
When adding about 45000 rows it fails with the following message :

System.Threading.ThreadAbortException: Thread was being aborted.

at Aspose.Cells.Cells.xe4ebd02b119fd6bb(xaae832abae2edf07 xcf18e5243f8d5fd3, FileFormatType xab59d5b558cd3dde)

at Aspose.Cells.Cells.xc26afd5362f5c1ec(xaae832abae2edf07 xcf18e5243f8d5fd3, FileFormatType xab59d5b558cd3dde)

at Aspose.Cells.Worksheet.xc26afd5362f5c1ec(xaae832abae2edf07 xcf18e5243f8d5fd3)

at Aspose.Cells.Worksheets.x668135b31fe5c8d9(xaae832abae2edf07 xcf18e5243f8d5fd3)

at Aspose.Cells.Worksheets.x806178efa0bb6fcf(FileFormatType xab59d5b558cd3dde)

at Aspose.Cells.Workbook.Save(Stream stream, FileFormatType fileFormatType)

When saving with the following method:
workbook.Save(stream, FileFormatType.Excel2000);

both cases work.

Any idea why?


EDIT: I am using version of Aspose.Cells


I don't find any problem / error you have mentioned.

Following is my sample code. The task takes about 33 seconds on my pc with normal configurations and the output file is about 11MB.

Workbook workbook = new Workbook();
Worksheet ws = workbook.Worksheets[0];

for (int row=0;row<45000;row++)
for (int col =0;col< 10; col++ )
ws.Cells[row,col].PutValue(row.ToString() + "," + col.ToString());


workbook.Save("E:\\test\\out_testAspose1.xls", FileFormatType.Excel2003);

Could you try the latest version attached @ the thread: <A href="</A></P> <P>Thank you.</P>

Thanks, it works in the latest release