Free Support Forum - aspose.com

File error: data may have been lost when using any of Copy method on worksheet

Hi Aspose team,

I got a problems and i couldn’t fix it for a whole day. I think it dues to Aspose library error. I really need it in urgent. So if anyone know it please help me. I’m very gratefull for that

This is the simple code I have

//Create a new Workbook.
Workbook wb = new Workbook();
//Open an existing excel file.
wb.Open(@“C:\test.xls”);

//Create a Worksheets object with reference to
//the sheets of the Workbook.
Worksheets sheets = wb.Worksheets;

//Copy data to a new sheet from an existing
//sheet within the Workbook.

sheets.AddCopy(0);

//Save the excel file.

wb.Save(@“C:\FinalBook.xls”, FileFormatType.Default);

After running this code. I try to open the FinalBook.xls and got the alert “File error: the data may have been lost” sometimes this error crack my computer, sometimes after recieving this message everything just normal.

I’ve tried in many way to copy a content of a sheet but I always got that error. Please help me.

Moreover, I’m using the Aspose.Cells.dll in .NET framework 3.5

Hi,

Could you post your template file here to reproduce the issue. We will check and figure it out soon.

And which version of Aspose.Cells you are using?

Thank you.

Hi Amjad Sahi,

Thank you for your quick reply. I’m using the Aspose.Cells version 4.4.0.0

And I attach here the excel template. it’s just an simple excel file

Please check for me. Thank you

Hi,

I tried with the lastest version (4.4.1) and it works fine.

Kindly try the attached version.

Thank you.

Hi Amjad,

Thank you very much, this version work very well. This error is no longer existed.

You’re my hero :wink:

Thi Thi