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

Free Support Forum - aspose.com

Style isModified() and borders


I’m using Aspose.Cells 8.0.1, and I’m trying to see if a style has borders defined or not, doing:


I’ve tried with different files and I always get false there. If I get the borders with style.getBorders(), I see the border color and style correctly identified, so it seems that isModified() is broken for borders.

I’m attaching the file I used, but as I said, I’ve tried with different ones with the same result.

Is this known, or can this be fixed in a new version?

Thanks in advance.


Thanks for your file.

Well, the Style.isModified() boolean method is used if respective attribute in the Style/ formattings (including borders type) is changed or not. So, you should not check borders by this method, you may check whether borders type is NONE to detect specific borders etc. as you are already doing via Style.getBorders().

Thank you.

Hi, thanks for your response.

isModified() is the only reliable way I’ve found to know if a parameter has been set or not in an style after loading a file, like the font.

Can you explain exactly what this method does, so I know when to use it? The documentation is empty, so it’s a bit useless.

Thank you.


Well, generally, isModified() is used to detect if any attribute related to style/formatting is modified or not. For example, you might have changed the style/formatting dynamically after loading the template file and later you need to know if you change any attribute in the style.

Could you provide us your complete sample code/ program (runnable) here to show the issue on our end, we will check it soon.

Thank you.

According to your explanation, isModified() only returns true when you change something after loading a file?

If I understood you correctly, that’s not what I’m seeing here. If you load the file I uploaded, and call isModified() for things like FONT_COLOR or FONT_FAMILY, you’ll see that it returns true for some cells.

Unfortunately, I cannot upload my code and I don’t have time right now to create an example, but I’ll use a check on the border style instead of the isModified() one (although that’s not technically correct. You can have a border with style “none” that has been modified, i.e. the border itself has been set in the file. The end result will be the same, but as I said, not technically correct).

Thank you.


Could you give more details which cells the isModified() method returns true for Font attributes. I have evaluated your scenario/ case a bit using the following sample code with your template file, it returns true which is fine here:
Sample code:

Workbook b = new Workbook(“another.xls”);

Cell cell = b.getWorksheets().get(0).getCells().get(“F4”);
Style style = cell.getStyle();
boolean check = style.isModified(StyleModifyFlag.LEFT_BORDER);
System.out.println(check); //false --Ok

check = style.isModified(StyleModifyFlag.FONT_FAMILY);
System.out.println(check); //false --Ok
check = style.isModified(StyleModifyFlag.FONT_COLOR);
System.out.println(check); //false --Ok

And, we will further evaluate your issue on our end. We will get back to you soon.

Thank you.

Thanks for using Aspose.Cells.
Style.isModified() method is designed for the style of ConditionalFormattings. It denotes whether one property of the style of ConditionalFormattings should be used for rendering the cell when the ConditionalFormattings is applied on a cell. It cannot be taken as the basis for judging whether there is one property for the style.
Take the border as example, user can specify the border as NONE explicitly when defining the ConditionalFormattings, thus Style.isModified() will return true for this border but in fact no border will be applied on the cell when applying this ConditionalFormatting on a cell.


For the document I uploaded, I get isModified() == true for FONT_WEIGHT, FONT_STYLE and FONT_WEIGHT for the style returned when doing Workbook.getStyleInPool() for the styles 33, 34, 35… and more.

If “isModified()” is the wrong call to use, how can I check if a user has specified a value for a style? Right now, I’m getting the right values, except for borders.


Thanks for your posting and using Aspose.Cells.

As a workaround, you can first create a Default Style using Workbook.createStyle() method and then compare this Style object with the Style object retrieved from Cell.getStyle() method. It’s comparison will let you know that what attributes of Style object has been modified.