I’m currently migrating our code from Aspose.Cells 2.2.1 to version 8.0.1 and I have a couple of questions:
1. FileFormatType.EXCEL2007 is not available… EXCEL_2007_XLSX is deprecated… So I guess I should use: XLSX?
2. AutoFilter.setRange(CellArea cellArea) is not available anymore… The http://www.aspose.com/docs/display/cellsjava/How+to+Migrate+to+Aspose.Cells+7.0.0+or+Higher documentation doesn’t list this… how do I go about and change the code so it does the same in 8.0.1 ? Is there a CellArea to range String converter or something?
3. cell.getStyle().getNumberFormatType() == NumberFormatType.NUMBER; does not seem to be supported anymore? How do I work around this in 8.0.1? cell.getNumberCategoryType() == NumberCategoryType.NUMBER; ?
Jeroen van der Grift
public void setRange(int row, int startColumn, int endColumn)
Sets the range to which the specified AutoFilter applies.
row- Row index.
startColumn- Start column index.
endColumn- End column Index.
So if old code says:
sheet.getAutoFilter().setRange(CellArea.createCellArea(0, 0, rowCount, columnCount - 1));
I do this now as follows:
String from = CellsHelper.cellIndexToName(0,0);
String to = CellsHelper.cellIndexToName(rowCount, columnCount - 1);
sheet.getAutoFilter().setRange(from + “:” + to);
is that correct?
The code does cell.setValue("", false); … 8.0.1 does not have the boolean parameter.
Can I just remove it or what did that boolean do exactly in 2.2.1? Do I need to do something extra in 8.0.1 to mimic that behaviour?
Hi… I seem to have detected a discrepancy when upgrade from 2.2.1 to 8.0.1 that I can’t explain…
There is a test which compares the getStringValue of a Cell with the expected String value “€ 5,01”… when I inspect the Cell it is listed like this: Aspose.Cells.Cell [ B6; ValueType : IsNumeric; Value : € 5,01 ; Formula:=SUM(B2:B4) ]
The test fails because there is a space character postfixed to the output of the getStringValue call (as you see above in between the 1 and the ;).
Is this possibly a regression/bug in 8.0.1?
Oke… I have attached two output files generated with aspose… filename should make clear which version was used…
The unit test code used to read the attached files… is (more or less) the same for both versions:
Workbook wbActualResult = new Workbook(filePath);
Worksheet sheet = wbActualResult.getWorksheets().get(“data”);
Cells actualCells = sheet.getCells();
The assert from the unit test:
Assert.assertEquals(“€ 5,01”, actualCells.get(5, 1).getStringValue());
On 2.2.1 getStringValue() returns the expected string… on 8.0.1 "€ 5,01 " is returned (space character postfixed).
Ah ok… thanks… I’ll check the release notes and write some javadoc this is changed but correct behavior!