org.apache.poi.ss.usermodel.CellStyle.getBorderBottomEnum()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.4k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中org.apache.poi.ss.usermodel.CellStyle.getBorderBottomEnum()方法的一些代码示例,展示了CellStyle.getBorderBottomEnum()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CellStyle.getBorderBottomEnum()方法的具体详情如下:
包路径:org.apache.poi.ss.usermodel.CellStyle
类名称:CellStyle
方法名:getBorderBottomEnum

CellStyle.getBorderBottomEnum介绍

[英]get the type of border to use for the bottom border of the cell
[中]获取用于单元格底部边框的边框类型

代码示例

代码示例来源:origin: looly/hutool

/**
 * 合并单元格,可以根据设置的值来合并行和列
 * 
 * @param sheet 表对象
 * @param firstRow 起始行,0开始
 * @param lastRow 结束行,0开始
 * @param firstColumn 起始列,0开始
 * @param lastColumn 结束列,0开始
 * @param cellStyle 单元格样式,只提取边框样式
 * @return 合并后的单元格号
 */
public static int mergingCells(Sheet sheet, int firstRow, int lastRow, int firstColumn, int lastColumn, CellStyle cellStyle) {
  final CellRangeAddress cellRangeAddress = new CellRangeAddress(//
      firstRow, // first row (0-based)
      lastRow, // last row (0-based)
      firstColumn, // first column (0-based)
      lastColumn // last column (0-based)
  );
  if (null != cellStyle) {
    RegionUtil.setBorderTop(cellStyle.getBorderTopEnum(), cellRangeAddress, sheet);
    RegionUtil.setBorderRight(cellStyle.getBorderRightEnum(), cellRangeAddress, sheet);
    RegionUtil.setBorderBottom(cellStyle.getBorderBottomEnum(), cellRangeAddress, sheet);
    RegionUtil.setBorderLeft(cellStyle.getBorderLeftEnum(), cellRangeAddress, sheet);
  }
  return sheet.addMergedRegion(cellRangeAddress);
}

代码示例来源:origin: looly/hutool

/**
 * 合并单元格,可以根据设置的值来合并行和列
 * 
 * @param sheet 表对象
 * @param firstRow 起始行,0开始
 * @param lastRow 结束行,0开始
 * @param firstColumn 起始列,0开始
 * @param lastColumn 结束列,0开始
 * @param cellStyle 单元格样式,只提取边框样式
 * @return 合并后的单元格号
 */
public static int mergingCells(Sheet sheet, int firstRow, int lastRow, int firstColumn, int lastColumn, CellStyle cellStyle) {
  final CellRangeAddress cellRangeAddress = new CellRangeAddress(//
      firstRow, // first row (0-based)
      lastRow, // last row (0-based)
      firstColumn, // first column (0-based)
      lastColumn // last column (0-based)
  );
  if (null != cellStyle) {
    RegionUtil.setBorderTop(cellStyle.getBorderTopEnum(), cellRangeAddress, sheet);
    RegionUtil.setBorderRight(cellStyle.getBorderRightEnum(), cellRangeAddress, sheet);
    RegionUtil.setBorderBottom(cellStyle.getBorderBottomEnum(), cellRangeAddress, sheet);
    RegionUtil.setBorderLeft(cellStyle.getBorderLeftEnum(), cellRangeAddress, sheet);
  }
  return sheet.addMergedRegion(cellRangeAddress);
}

代码示例来源:origin: zerouwar/Octopus

public static void setMergeRegion(Sheet sheet, int row, int lastRow, int col, int lastCol, CellStyle cellStyle) {
  int i = sheet.addMergedRegion(new CellRangeAddress(row, lastRow, col, lastCol));
  /**
   * seems like a bug
   */
  CellRangeAddress region = sheet.getMergedRegion(sheet instanceof XSSFSheet ? i - 1 : i);
  RegionUtil.setBorderTop(cellStyle.getBorderTopEnum(), region, sheet);
  RegionUtil.setBorderLeft(cellStyle.getBorderLeftEnum(), region, sheet);
  RegionUtil.setBorderBottom(cellStyle.getBorderBottomEnum(), region, sheet);
  RegionUtil.setBorderRight(cellStyle.getBorderRightEnum(), region, sheet);
}

代码示例来源:origin: cn.hutool/hutool-all

/**
 * 合并单元格,可以根据设置的值来合并行和列
 * 
 * @param sheet 表对象
 * @param firstRow 起始行,0开始
 * @param lastRow 结束行,0开始
 * @param firstColumn 起始列,0开始
 * @param lastColumn 结束列,0开始
 * @param cellStyle 单元格样式,只提取边框样式
 * @return 合并后的单元格号
 */
public static int mergingCells(Sheet sheet, int firstRow, int lastRow, int firstColumn, int lastColumn, CellStyle cellStyle) {
  final CellRangeAddress cellRangeAddress = new CellRangeAddress(//
      firstRow, // first row (0-based)
      lastRow, // last row (0-based)
      firstColumn, // first column (0-based)
      lastColumn // last column (0-based)
  );
  if (null != cellStyle) {
    RegionUtil.setBorderTop(cellStyle.getBorderTopEnum(), cellRangeAddress, sheet);
    RegionUtil.setBorderRight(cellStyle.getBorderRightEnum(), cellRangeAddress, sheet);
    RegionUtil.setBorderBottom(cellStyle.getBorderBottomEnum(), cellRangeAddress, sheet);
    RegionUtil.setBorderLeft(cellStyle.getBorderLeftEnum(), cellRangeAddress, sheet);
  }
  return sheet.addMergedRegion(cellRangeAddress);
}

代码示例来源:origin: pentaho/pentaho-reporting

protected HSSFCellStyleKey( final CellStyle style ) {
 this.color = style.getFillForegroundColor();
 this.colorTop = style.getTopBorderColor();
 this.colorLeft = style.getLeftBorderColor();
 this.colorBottom = style.getBottomBorderColor();
 this.colorRight = style.getRightBorderColor();
 this.borderStrokeTop = style.getBorderTopEnum();
 this.borderStrokeLeft = style.getBorderLeftEnum();
 this.borderStrokeBottom = style.getBorderBottomEnum();
 this.borderStrokeRight = style.getBorderRightEnum();
 this.dataStyle = style.getDataFormat();
 this.font = style.getFontIndex();
 this.horizontalAlignment = style.getAlignmentEnum();
 this.verticalAlignment = style.getVerticalAlignmentEnum();
 this.wrapText = style.getWrapText();
 this.textRotation = TextRotation.getInstance( style.getRotation() );
}

相关文章

微信公众号

最新文章

更多