if(rect!=null){
hitMerge = true;
right = Utils.getCell(_sheet, _row, rect.getRight());
}
if (right != null) {
CellStyle style = right.getCellStyle();
if (style != null){
int bb = style.getBorderRight();
//String color = BookHelper.indexToRGB(_book, style.getRightBorderColor());
String color = BookHelper.colorToHTML(_book, style.getRightBorderColorColor());
hitRight = appendBorderStyle(sb, "right", bb, color);
}
}
}
Cell next = null;
//if no border for target cell,then check is this cell in a merge range
//if(true) then try to get next cell after this merge range
//else get next cell of this cell
if(!hitRight){
int c = hitMerge?rect.getRight()+1:_col+1;
next = Utils.getCell(_sheet, _row, c);
//find the right cell of merge range.
if(next!=null){
CellStyle style = next.getCellStyle();
if (style != null){
int bb = style.getBorderLeft();//get left here
//String color = BookHelper.indexToRGB(_book, style.getLeftBorderColor());
//ZSS-34 cell background color does not show in excel
String color = style.getFillPattern() != CellStyle.NO_FILL ?
BookHelper.colorToHTML(_book, style.getLeftBorderColorColor()) : null;
hitRight = appendBorderStyle(sb, "right", bb, color);
}
}
}
//border depends on next cell's background color
if(!hitRight && next !=null){
CellStyle style = next.getCellStyle();
if (style != null){
//String bgColor = BookHelper.indexToRGB(_book, style.getFillForegroundColor());
//ZSS-34 cell background color does not show in excel
String bgColor = style.getFillPattern() != CellStyle.NO_FILL ?
BookHelper.colorToHTML(_book, style.getFillForegroundColorColor()) : null;
if (BookHelper.AUTO_COLOR.equals(bgColor)) {
bgColor = null;
}
if (bgColor != null) {
hitRight = appendBorderStyle(sb, "right", CellStyle.BORDER_THIN, bgColor);
}
}
}
//border depends on current cell's background color
if(!hitRight && _cell !=null){
CellStyle style = _cell.getCellStyle();
if (style != null){
//String bgColor = BookHelper.indexToRGB(_book, style.getFillForegroundColor());
//ZSS-34 cell background color does not show in excel
String bgColor = style.getFillPattern() != CellStyle.NO_FILL ?
BookHelper.colorToHTML(_book, style.getFillForegroundColorColor()) : null;
if (BookHelper.AUTO_COLOR.equals(bgColor)) {
bgColor = null;
}
if (bgColor != null) {
hitRight = appendBorderStyle(sb, "right", CellStyle.BORDER_THIN, bgColor);