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

Free Support Forum - aspose.com

Character references parsed incorrectly by Aspose Cells for Java

Aspose Cells for Java parses XML character reference incorrectly. Please look at following code and attached xlsx files:
package com.xmlintl.tools;

import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;

import com.aspose.cells.Workbook;

public class AsposeCellsTest
{
    public static void main(String[] args) throws Exception
    {
        try(InputStream input = Files.newInputStream(Paths.get("C:/test/test.xlsx")))
        {
            Workbook workbook = new Workbook(input);
            workbook.save("C:/test/test-result.xlsx");
        }
    }
}

After opening the resulting file, you will see that the emoji in cell from the second row has been saved as:

🌾 test

while it should be saved (and displayed in the Excel file) as a character:

:ear_of_rice: test

I find this as a bug in Aspose Cells for Java.

It is caused by the fact that the text in cell from row 2 is saved in the xlsx file (xl\sharedStrings.xml) as:
🌾 test
but this is correct way of saving it in XML file.

I also expect that the method Cell::getStringValue will return:
:ear_of_rice: test”
for cells from row 1 and 2. Currently it does return:
“🌾 test”
for the cell from second row.test.zip (13.0 KB)

@wjeczalik

Thanks for using Aspose APIs.

Please share the screenshot of your input Excel file and the output Excel file, I have also attached the output Excel file generated at my end. Please also share its screenshot at your end.

Download Links:
output Excel file.zip (6.4 KB)
sc.png (32.6 KB)

Java

Workbook workbook = new Workbook(dirPath + "test.xlsx");
workbook.save(dirPath + "out.xlsx");

Screenshot

Below you can find screenshots of input (on the left) and output (on the right).
diff.png (17.2 KB)

As you can see in the output, content of cell A2 is changed.

@wjeczalik

Thanks for considering Aspose API.

We were able to observe the issue and logged it in our database for investigation and for a fix.

This issue has been logged as

  • CELLSJAVA-42374 - Character references parsed incorrectly by Aspose Cells

I see that the issue has been resolved, in what version of Aspose Cells for Java the fix will be available?

@wjeczalik,

Yes, your issue is marked as Resolved. You may expect the fix in the next few days (2-3 days or so) after performing QA and incorporating other enhancements.

Once the fix is available for public use, we will share the Download link here.

Keep in touch.

Thank you.

@wjeczalik

Please download and try the following fix and let us know your feedback.

It works fine, thank you.
@shakeel.faiz Will you merge this fix to older versions or it will be available only in the newest release?

@wjeczalik,

Good to know that your issue is sorted out by the new fix/version.

Well, the fixes are created based on latest APIs set only.

Thank you.

The issues you have found earlier (filed as CELLSJAVA-42374) have been fixed in Aspose.Cells for Java 17.9.