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

Free Support Forum - aspose.com

How to get changing style in format condition

I use aspose.cells 8.2.2.


I want to get get changing style in format condition


Workbook wb = new Workbook(“c:/Book1.xlsx”);
Cells cells = wb.getWorksheets().get(0).getCells();
FormatCondition cond = cells.get(“E3”).getFormatConditions().get(0);


This formatCondition only change border style

How can I get these changes without other unchang styles.

Like excel mark 1,2,4 tab in unchanged (clear button is disabled)
and 3 tab is changed.

Hi Xiong,


Thank you for contacting Aspose Support.

Unfortunately, we are not clear about your requirements therefore we would request you to please elaborate your question further, and especially share the snapshots with English text for better understanding of the scenario.

We are sorry for the inconvenience.

In some cells I add condition formats. In these condition formats I only change some style(like border color) and other styles are unchanged.



In current aspose.cells, FormatCondition.getStyle() return all styles that include unchanged styles.

I want to get which styles are changed by condition format.

Hi Xiong,

Thanks for your posting and using Aspose.Cells.

Please try Cell.getDisplayStyle() method for your needs. It will return you current display style of the cell, when the cell is formatted normal or it is conditionally formatted.

I don’t want to get cell’s style.


I just want to know which styles changed in condition format

Like my attachment, I use code:

System.out.println(“First”);
Border border = style.getBorders().getByBorderType(BorderType.RIGHT_BORDER);
System.out.println(border.getLineStyle() + “->” + Integer.toHexString(border.getArgbColor()));
System.out.println(Integer.toHexString(style.getFont().getArgbColor()));

System.out.println();
System.out.println(“Second”);
style = wb.getWorksheets().get(0).getCells().get(“A2”).getFormatConditions().get(1).getStyle();
border = style.getBorders().getByBorderType(BorderType.RIGHT_BORDER);
System.out.println(border.getLineStyle() + “->” + Integer.toHexString(border.getArgbColor()));
System.out.println(Integer.toHexString(style.getFont().getArgbColor()));


It output
First
0->ff000000
0

Second
0->ff000000
ff000000



But in fact, first formatcondtion doesn’t set right border style


I want to know which styles is set in format condition

Hi Xiong,

Thanks for your posting and using Aspose.Cells.

Please use Style.isModified() method for your needs. It will return true, if a particular property has changed or not.

Please see the following code and its console output. I have attached the source Excel file used in this code for your reference.

Java


String filePath = “F:\Shak-Data-RW\Downloads\source.xlsx”;


Workbook workbook = new Workbook(filePath);


Worksheet worksheet = workbook.getWorksheets().get(0);


Cell cell = worksheet.getCells().get(“C3”);


Style st = cell.getDisplayStyle();


boolean ret = st.isModified(StyleModifyFlag.TOP_BORDER);

System.out.println("Top Border Changed: " + ret);


ret = st.isModified(StyleModifyFlag.LEFT_BORDER);

System.out.println("Left Border Changed: " + ret);


ret = st.isModified(StyleModifyFlag.RIGHT_BORDER);

System.out.println("Right Border Changed: " + ret);


ret = st.isModified(StyleModifyFlag.BOTTOM_BORDER);

System.out.println("Bottom Border Changed: " + ret);


Console Output:
Top Border Changed: true
Left Border Changed: true
Right Border Changed: false
Bottom Border Changed: false