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

Free Support Forum - aspose.com

Saving an Excel worksheet causes thread abort exception

Hi,

I am using cells version 7 dll. While taking out the worksheets Gateway II and Gateway III of the attached file and saving them as separte files, we are getting thread abort exception. can you please investigate and provide the solution what is causing it and how to remedy it. Gateway I worksheet and saviing it as separte file works fine. Thank you.

Hi,

Please see the code below, I have tested it with latest version:
Aspose.Cells
for .NET v7.1.2.5

and it is working fine.

I have attached the output file for your reference.

The code removes all the worksheets except the desired one.

Please also see the screenshot.

C#

string filePath = @“F:\Gateway±+Summary+Sheet.xls”;


Workbook workbook = new Workbook(filePath);


//Move the worksheet at index 0

Worksheet worksheet = workbook.Worksheets[“Gateway III”];

worksheet.Move(0);



//Remove all other worksheets

int idx = 0;


while (workbook.Worksheets.Count > 1)

{

workbook.Worksheets.RemoveAt(1);

}



//Save the workbook

workbook.Save(filePath + “.out.xls”);


Screenshot:

You said The code removes all the worksheets except the desired one

What you mean by that? Some worksheets aren’t working.

Hi,

Please see my above post.

I have tried all of your worksheets now, and they are all working. I have attached them.

Please check and let me know if you find any error.