Templated formatting being ignored using importResultSet


I have a pre-formatted xlt template and dump data to it using importResultSet(). After writing the data, the number columns have the correct format assigned to them (from the xlt), but the contents of the cells are not formatted to that cell's style. Instead I get the usual "number formatted as text" warning. If I hit F2 to edit the cell and then hit return, the cell correctly auto-formats using it's assigned style.

I've seen this before, so I'm not sure if this is an Excel bug or an Aspose issue...


We got the cells to format properly by not using the importResultSet. We have to write each cell indivually, making to sure to apply the cell's Style first, then writing the number. This gave us the expected output.



Please try this fix.

If the error still occurs,please post the JDBC types with following codes.

ResultSetMetaData meta = rs.getMetaData();

columnNum = meta.getColumnCount();

for(int i = 1; i <= columnNum; ++i)System.out.println(meta.getColumnType(i ));


The new jar did the same thing. The rs column type comes back as 3 (DECIMAL). It is MS SQL Server 2000 and a 'money' data type. The xlt cells (and column) are formatted as Number with 2 decimal plasces, comma as a separator, and parens for negatives.


Our developers are on their Chinese National Day holidays so this issue will be checked at the start of next week.

If the column data type is string, the data saved in MS Excel will show "Number stored as Text" warning if it's something like "3".



Please try this fix.


The formatting worked great. However, I am getting a Null value run-time error when I call the function.

cells.importResultSet(linesRS, 1, 0, false);

The relevant stack trace:
Exception in thread "main" java.lang.IllegalArgumentException: Invalid value: null
at com.aspose.cells.Cell.setValue(Unknown Source)
at com.aspose.cells.Cells.importResultSet(Unknown Source)
at com.aspose.cells.Cells.importResultSet(Unknown Source)
at mil.fmsuite.finplan.Mechanized.export(Mechanized.java:334)