Free Support Forum - aspose.com

getStringValue() throws exception with Euro Currency Cellformat

Hi,

Using Aspose cells for Java version 7.0.1.5, I’m getting a problem when reading a spreadsheet with Euro values. The problem can be reproduced with the following code and the attached file.

import java.io.FileInputStream;
import java.io.FileNotFoundException;

import com.aspose.cells.Cells;
import com.aspose.cells.CellsHelper;
import com.aspose.cells.Workbook;

public class AsposeTestFormatError
{
public static void main(String[] args) throws FileNotFoundException, Exception
{
new AsposeTestFormatError().run();
}
public void run() throws FileNotFoundException, Exception{
System.out.println("Using Aspose version "+CellsHelper.getVersion());
Workbook wb=new Workbook(new FileInputStream(“C:\Aspose euro test.xls”));
String s = wb.getWorksheets().get(0).getCells().get(0, 0).getStringValue();
System.out.println(s);
}
}

The output is:
Using Aspose version 7.0.1.5
Exception in thread “main” java.lang.IllegalArgumentException: Malformed pattern “#,##0.00’ '€40”
at java.text.DecimalFormat.applyPattern(Unknown Source)
at java.text.DecimalFormat.(Unknown Source)
[…]
at com.aspose.cells.Cell.getStringValue(Unknown Source)
at com.du.sjk.scrap.AsposeTestFormatError.run(AsposeTestFormatError.java:20)
at com.du.sjk.scrap.AsposeTestFormatError.main(AsposeTestFormatError.java:14)

This only seems to happen with Euro (France) but I haven’t tested all formats.

Thanks in advance for your help in this matter,

Simon Kelly
Agentrics LLC

Hi,


I have tested your issue with latest version/fix i.e. v7.0.1.6: Please download: Aspose.Cells for Java v7.0.1.6
It works fine.

Please try it and let us know if it works fine.

Thank you.

Yes I can confirm this latest version has fixed the issue. Thanks!