如何在Apache POI中将Paddig top属性添加到XLS的表格单元格

时间:2018-08-07 13:08:33

标签: java apache-poi

/*This is the code where iamunable to implement, and it is extaracted from apache poi .hssf*/

/ *      *处理fo:table-cell。此方法使用提取的信息创建HSSFCell      *来自fo:table-cell。      * @param tableCell对象代表fo:table-cell信息。      * /

    public void tableCellBegin(TableCell tableCell) {
    nInline = 0;
    if (in_headerfooter == -1) {
        resetCurrentCellStyle();
        currentCell = currentRow.createCell(cellIndex);
        resetCurrentCellStyle();
        int numColsSpanned =
            tableCell.properties.get("number-columns-spanned").getNumber().intValue();

        int numRowsSpanned =
            tableCell.properties.get("number-rows-spanned").getNumber().intValue();

/ * padding属性在此处启用* /

private boolean isValidBorderAndPadding(BorderAndPadding bap){
    boolean validBAP = false;

    if(bap.getBorderStyle(BorderAndPadding.TOP) != 0 
            || bap.getBorderStyle(BorderAndPadding.BOTTOM) != 0
            || bap.getBorderStyle(BorderAndPadding.LEFT) != 0
            || bap.getBorderStyle(BorderAndPadding.RIGHT) != 0){
        validBAP = true;
    }
    /* iam trying to enable padding properties in the below code by placing true in  getpaddingTop(true)*/
    if(bap.getPaddingTop(false) != 0
            || bap.getPaddingBottom(false) != 0
            || bap.getPaddingLeft(false) != 0
            || bap.getPaddingRight(false) != 0){
        validBAP = true;
    }

    return validBAP;
}
}   

0 个答案:

没有答案