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

Free Support Forum - aspose.com

Convert the border and color to HTML

Hi,

We need to get the information if the cell has border and which color /font, etc style be displayed in html.
Seems that
Java API provides
cell.getDisplayStyle().getBorders().getByBorderType(com.aspose.cells.BorderType.TOP_BORDER).getLineStyle() ---- if “0” seems “no border” , otherwise has border,
about the color, very confused, how to convert ThemeColor/Color.

We need to do something like this in html

one
two
three

So need to know the color value for bgcolor in HTML.

Could you provide a example for
(1)check if the cell has border
(2)border type (font?)
(3)border color value to be used in HTML

Many thanks!

Ruhong

@ruhongcai,

For whether the border exists, you should check the value of LineStyle, if it is CellBorderType.NONE (currently it is defined as constant value 0, however, it is always better for you to use the defined constant instead of the integer value). For color, you may use Border.Color attribute, it will return the correct color for theme color too. If you need to know the theme color, then you may use Border.ThemeColor. For border type, you may choose the proper element in html according to Border.LineStyle too, such as, CellBorderType.DOUBLE, DOTTED,…etc. Also, you have to write your own code by yourself accordingly to implement your solution for html.

Thank you very much!

Ruhong

@ruhongcai,

You are welcome.