Hi,
I have an excel file contains conditional format of VLOOKUP, when put value in the first cell, the border color should turn red for this cell (with conditional format). This is working as expected when I open the file. But when I read the file and get the DisplayStyle() to check the border color, it always shows black.
My code:
File myFile = new File("/.../Book1.xlsx");
LoadOptions loadOptions;
loadOptions = new LoadOptions(LoadFormat.XLSX);
Workbook workbook = new Workbook(myFile.toString(), loadOptions);
Worksheet sheet1 = workbook.getWorksheets().get("Sheet1");
Cell B2 = sheet1.getCells().get("B2");
Style st = B2.getDisplayStyle();
Cell A2 = sheet1.getCells().get("A2");
A2.putValue("myTarget");
assertEquals(Color.getRed(), B2.getDisplayStyle().getBorders().getByBorderType(8).getColor());
The conditional format in B2 cell has VLOOKUP and IF functions. And the VLOOKUP content is in another sheet (Sheet2).
This unit test failed with following message
java.lang.AssertionError:
Expected :com.aspose.cells.Color@ffff0000
Actual :com.aspose.cells.Color@ff000000
And I also checked the boolean value of isModified() for B2 after I put value to A2, it’s false.
B2.getDisplayStyle().isModified(StyleModifyFlag.BOTTOM_BORDER)
Book1.xlsx.zip (7.6 KB)