XLSX mis-interpreting characters

Hi,


We have an existing XLSX file (attached in zip file) which Aspose seems to not be able to save properly. The attached spreadsheet named “original” can be opened just fine in Excel. However, once Aspose touches it, we run into problems.

If I simply try to open this file as a Workbook object and save it, retaining the XLSX format, there appear to be invalid characters being created by Aspose. After Aspose saves the file, if you try to open it in Excel, you will be greeted with a message saying you need to try to recover the file and that it has removed parts - invalid XML characters within the comments. I have attached a sample file (aptly named “broken.xlsx”) that is the result output of the following Java code:

Workbook test = new Workbook(“C:\WIP\original.xlsx”);
test.save(“C:\WIP\broken.xlsx”);

I have updated to the latest version of Java Aspose.Cells library (released May 17th, 2012), and I have tried clearing all comments from the original spreadsheet. I took the original file and I deleted all the sheets and then created a single blank sheet - the Aspose save process still broke the file. It’s like there is some attribute in this particular spreadsheet (original.xlsx) that isn’t tied to the worksheets themselves which is causing the problem with Aspose.

Is there any insight as to what Aspose could be choking up on here? This is going to be a major roadblock for us if Aspose is going to continue to have this conversion issue.


Hi,

Thanks for your posting and using Aspose.Cells for Java.

We were able to notice the problem so we have logged your issue in our database.

We will look into your issue and once this issue is resolved or we have some other update relating to it, we will let you know asap.

This issue has been logged as CELLSJAVA-40210.

just wanted to give an update:


I was able to circumvent most of my issues using the aspose worksheet’s copy method and was able to get all my sheets except 1 to read in correctly with Aspose.

I was able to isolate the problem to the worksheet tab named “Data” - it is the last sheet in the “original.xlsx” file.

That sheet has formulas which I believe are causing the issue. So perhaps there is a bug in how Aspose tries to copy formulas over.

Hi,


Thanks for sharing valuable information.

As we logged your issue so this information may help a bit. We are already working over your issue to figure it out and you can expect a fix within 2-3 days or so after our extensive testing.

Thank you.

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


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

Hi,


I downloaded the update and it does appear to have fixed the open/save issue.

However, what I am seeing now is that it does not work with the WorkSheet.copy() method. The first 8 worksheets all copy just fine, but the 9th one named “Data” (which is what we were having the initial issue with saving), is not copying at all.

The following code yields no exceptions/errors, but it also outputs nothing to the final spreadsheet:

Workbook test = new Workbook(“C:\WIP\original.xlsx”);
Workbook newBook = new Workbook();
newBook.getWorksheets().get(0).copy(test.getWorksheets().get(9));
newBook.save(“C:\WIP\does_not_work.xlsx”);

Regards

Hi

The 9th worksheet is a veryhidden worksheet (please check the Worksheet.VisibilityType), not the worksheet “Data”. So an exception will be thrown when saving a workbook which does not contain any visible worksheet.

If you want to copy the worksheet “Data”,please use the following code:

C#


Workbook test = new Workbook(@“D:\FileTemp\original.xlsx”);

Workbook newBook = new Workbook();

newBook.Worksheets[0].Copy(test.Worksheets[“Data”]);

newBook.Save(@“D:\FileTemp\does_not_work.xlsx”);

That seems to work, thank you