Hi all,

Is it possible to have two kinds of borders to a single cell using POI? I
wrote all sides border to a cell, and now require a thick border in the
bottom for those cells. When the thin border is written, the thick border
disappears or if i write the thick border first, the thin border disappears.

I have written the following methods to draw borders.

*For All Sides Thin Border-*

 public void setAllSidesBorder(HSSFWorkbook hwb, HSSFSheet sheet,
                                  HSSFCellStyle cellStyle, int rowNum,
                                  int cellStart, int CellEnd) {
        HSSFCellStyle cellStyleBotBord = hwb.createCellStyle();
        if (cellStyle != null) {
            cellStyleBotBord.cloneStyleFrom(cellStyle);
        }
        cellStyleBotBord.setBorderLeft(HSSFCellStyle.BORDER_THIN);
        cellStyleBotBord.setBorderBottom(HSSFCellStyle.BORDER_THIN);
        cellStyleBotBord.setBorderRight(HSSFCellStyle.BORDER_THIN);
        cellStyleBotBord.setBorderTop(HSSFCellStyle.BORDER_THIN);
        row = getRowObject(sheet, rowNum);
        for (int j = cellStart; j <= CellEnd; j++) {
            cell = getCellObject(row, j);
            cell.setCellStyle(cellStyleBotBord);
        }
    }


*For bottom Thick border - *

public void setBottomThickBorder(HSSFWorkbook hwb, HSSFSheet sheet,
                                     HSSFCellStyle cellStyle, int rowno,
                                     int cellStart, int CellEnd) {
        HSSFCellStyle cellStyleBotBord = hwb.createCellStyle();
        if (cellStyle != null) {
            cellStyleBotBord.cloneStyleFrom(cellStyle);
        }
        cellStyleBotBord.setBorderBottom(HSSFCellStyle.BORDER_THICK);
        row = getRowObject(sheet, rowno);
        cell = getCellObject(row, cellStart);
        cell.setCellStyle(cellStyleBotBord);
        for (int i = cellStart + 1; i < CellEnd; i++) {
            cell = getCellObject(row, i);
            cell.setCellStyle(cellStyleBotBord);
        }
        cell = getCellObject(row, CellEnd);
        cell.setCellStyle(cellStyleBotBord);
    }

Plz help me out...

Thanks,
Harsha



--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/Problem-in-Cell-Borders-tp5710683.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to