Saving to Excel97To2003 cause error when opening .xls file

Hi,

The above version is now older.

Please download the latest version from this link:
Aspose.Cells
for .NET v7.2.0.4

I have users that use Blackberries and open Excel documents with Documents to Go. When I send out Excel files with the xlsx extension they are unable to open the document. They get a message that states "This file cannot be opened because it is not a valid MS Excel 97-2008 file."

If I save the file as xls extension they can open these now with this version.

Also, if I open the file on my desktop and save the file as .xlsx and send it out the Blackberry users can open my version, but not the one from Cells.

Any ideas?

Hi,

Please note, Xlsx is a newer format i.e Ms-Excel 2007/2010 format.

But the Xls is an older format i.e Ms-Excel 2003 format.

So if you want to generate your file in Xlsx format, you will have to save your workbook like this.

C#


workbook.Save(“output.xlsx”, SaveFormat.Xlsx);

I agree about the newer format, but in a previous version of Aspose.Cells I was able to save as workbook.Save(“output.xlsx”, SaveFormat.Xlsx); and the files could be opened on the Blackberries. With version 7.2.0.4 all files that are sent in xlsx format throw the error I stated previously.

Hi,

Thanks for your feedback.

I have generated the output.xlsx file using the following code with the latest version at my end.

Please download it and try opening it at your end in Blackberries and let me know your feedback.

C#


Workbook workbook = new Workbook();


workbook.Save(“output.xlsx”, SaveFormat.Xlsx);

This didn't work either. Got the same error message. I've attached a picture of the error message.

I previously had version 5.3.0 and it worked with no issues. With xlsx files.

Hi,

Thanks for your testing and providing us a screenshot of error.

I have logged it as a bug in our database. Development team will look into it and fix the problems.

Once, the issue is fixed or we have any other update for you, we will let you know asap.

This issue has been logged as CELLSNET-40640.

Hi,

Please set OoxmlSaveOptions.ExportCellName property.

C#


Workbook workbook = new Workbook();

OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();

saveOptions.ExportCellName = true;

workbook.Save(@“D:\FileTemp\dest.xlsx”, saveOptions);

This didn’t fix the issue on my end. Still get the same error.

Hi,

Thanks for your feedback.

It’s strange that you still get the issue. I have logged your comment in our database against the issue id: CELLSNET-40640 for investigation.

We will get back to you asap.

Hi,

For your issue, please create two simple xlsx files, one is created by 5.3.0 and can work. Another is created by the latest version and cannot work. We will look into them to figure the issue out.

Sorry for the delay. Here are to two files you requested.

The file labeled with 5.3 is from version 5.3.0 and works on our Blackberries in Sheets to Go.

The file labeled with 7.2.0.4 is from version 7.2.0.4 and does not work on our Blackberries in Sheets to Go.

Here is the code used for each file:

Aspose.Cells.

License l = new License();

l.SetLicense(

@".\Aspose.Cells.lic");

Workbook wb = new Workbook();

Worksheet ws = wb.Worksheets[0];

ws.Cells[0, 0].PutValue(

"This is a test");

ws.Cells[1, 0].PutValue(1);

ws.Cells[2, 0].PutValue(2);

ws.Cells[3, 0].PutValue(3);

ws.Cells[4, 0].PutValue(4);

ws.Cells[5, 0].PutValue(5);

ws.Cells[6, 0].PutValue(6);

ws.Cells[1, 1].PutValue(2);

ws.Cells[2, 1].PutValue(3);

ws.Cells[3, 1].PutValue(4);

ws.Cells[4, 1].PutValue(5);

ws.Cells[5, 1].PutValue(6);

ws.Cells[6, 1].PutValue(7);

ws.Cells[7, 0].PutValue(

"Finished");

wb.Save(@".\ApsoseTest.7.2.0.4.xlsx", SaveFormat.Xlsx);

Hi,


Thank you for providing us the supporting files. We have forwarded this information to our concerned developers and will get back to you once we get update about it.

We appreciate your continuous feedback

Hi,


By the way, could you add a few lines to your code and check if it works fine now:

Updated Sample code:

License l = new License();

l.SetLicense(

@".\Aspose.Cells.lic");

Workbook wb = new Workbook();

Worksheet ws = wb.Worksheets[0];

ws.Cells[0, 0].PutValue(

“This is a test”);

ws.Cells[1, 0].PutValue(1);

ws.Cells[2, 0].PutValue(2);

ws.Cells[3, 0].PutValue(3);

ws.Cells[4, 0].PutValue(4);

ws.Cells[5, 0].PutValue(5);

ws.Cells[6, 0].PutValue(6);

ws.Cells[1, 1].PutValue(2);

ws.Cells[2, 1].PutValue(3);

ws.Cells[3, 1].PutValue(4);

ws.Cells[4, 1].PutValue(5);

ws.Cells[5, 1].PutValue(6);

ws.Cells[6, 1].PutValue(7);

ws.Cells[7, 0].PutValue(

“Finished”);


OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();

saveOptions.ExportCellName =
true;

wb.Save(

@".\ApsoseTest.7.2.0.4.xlsx", saveOptions);


I made the changes as instructed and I still get the same error message as before.

I'm also attaching the new file.

Hi,


Thanks for providing us the new file (after adding the suggested lines to your source code).

I have reopened your issue again. We will look into it. Once we have any update, we will let you know here.

Thank you.

Hi,

We have fixed this issue.

Please download and try the latest fix: Aspose.Cells for .NET v7.2.1.1

This did fix my issue. I just want to point out to anyone reviewing this thread that the following lines of code still cause the error:

OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();

saveOptions.ExportCellName =
true;

wb.Save(
@".\ApsoseTest.7.2.1.1.xlsx", saveOptions);

change to:

wb.Save(@".\AsposeTest.7.2.1.1.xlsx");

Thank you for your help,

Duel

Hi,

It’s strange, it caused you error.

I have run your code and found that no error occurred using the following code on the latest version:

Aspose.Cells for .NET 7.2.1


It will create a file in the current working directory, you can find the current directory using the following property i.e System.Environment.CurrentDirectory .

C#


Workbook wb = new Workbook();


OoxmlSaveOptions saveOptions = new OoxmlSaveOptions();


saveOptions.ExportCellName = true;


wb.Save(@“.\ApsoseTest.7.2.1.1.xlsx”, saveOptions);


The issues you have found earlier (filed as CELLSNET-40640) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.