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

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

本文整理了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

  1. /**
  2. * 合并单元格,可以根据设置的值来合并行和列
  3. *
  4. * @param sheet 表对象
  5. * @param firstRow 起始行,0开始
  6. * @param lastRow 结束行,0开始
  7. * @param firstColumn 起始列,0开始
  8. * @param lastColumn 结束列,0开始
  9. * @param cellStyle 单元格样式,只提取边框样式
  10. * @return 合并后的单元格号
  11. */
  12. public static int mergingCells(Sheet sheet, int firstRow, int lastRow, int firstColumn, int lastColumn, CellStyle cellStyle) {
  13. final CellRangeAddress cellRangeAddress = new CellRangeAddress(//
  14. firstRow, // first row (0-based)
  15. lastRow, // last row (0-based)
  16. firstColumn, // first column (0-based)
  17. lastColumn // last column (0-based)
  18. );
  19. if (null != cellStyle) {
  20. RegionUtil.setBorderTop(cellStyle.getBorderTopEnum(), cellRangeAddress, sheet);
  21. RegionUtil.setBorderRight(cellStyle.getBorderRightEnum(), cellRangeAddress, sheet);
  22. RegionUtil.setBorderBottom(cellStyle.getBorderBottomEnum(), cellRangeAddress, sheet);
  23. RegionUtil.setBorderLeft(cellStyle.getBorderLeftEnum(), cellRangeAddress, sheet);
  24. }
  25. return sheet.addMergedRegion(cellRangeAddress);
  26. }

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

  1. /**
  2. * 合并单元格,可以根据设置的值来合并行和列
  3. *
  4. * @param sheet 表对象
  5. * @param firstRow 起始行,0开始
  6. * @param lastRow 结束行,0开始
  7. * @param firstColumn 起始列,0开始
  8. * @param lastColumn 结束列,0开始
  9. * @param cellStyle 单元格样式,只提取边框样式
  10. * @return 合并后的单元格号
  11. */
  12. public static int mergingCells(Sheet sheet, int firstRow, int lastRow, int firstColumn, int lastColumn, CellStyle cellStyle) {
  13. final CellRangeAddress cellRangeAddress = new CellRangeAddress(//
  14. firstRow, // first row (0-based)
  15. lastRow, // last row (0-based)
  16. firstColumn, // first column (0-based)
  17. lastColumn // last column (0-based)
  18. );
  19. if (null != cellStyle) {
  20. RegionUtil.setBorderTop(cellStyle.getBorderTopEnum(), cellRangeAddress, sheet);
  21. RegionUtil.setBorderRight(cellStyle.getBorderRightEnum(), cellRangeAddress, sheet);
  22. RegionUtil.setBorderBottom(cellStyle.getBorderBottomEnum(), cellRangeAddress, sheet);
  23. RegionUtil.setBorderLeft(cellStyle.getBorderLeftEnum(), cellRangeAddress, sheet);
  24. }
  25. return sheet.addMergedRegion(cellRangeAddress);
  26. }

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

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

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

  1. /**
  2. * 合并单元格,可以根据设置的值来合并行和列
  3. *
  4. * @param sheet 表对象
  5. * @param firstRow 起始行,0开始
  6. * @param lastRow 结束行,0开始
  7. * @param firstColumn 起始列,0开始
  8. * @param lastColumn 结束列,0开始
  9. * @param cellStyle 单元格样式,只提取边框样式
  10. * @return 合并后的单元格号
  11. */
  12. public static int mergingCells(Sheet sheet, int firstRow, int lastRow, int firstColumn, int lastColumn, CellStyle cellStyle) {
  13. final CellRangeAddress cellRangeAddress = new CellRangeAddress(//
  14. firstRow, // first row (0-based)
  15. lastRow, // last row (0-based)
  16. firstColumn, // first column (0-based)
  17. lastColumn // last column (0-based)
  18. );
  19. if (null != cellStyle) {
  20. RegionUtil.setBorderTop(cellStyle.getBorderTopEnum(), cellRangeAddress, sheet);
  21. RegionUtil.setBorderRight(cellStyle.getBorderRightEnum(), cellRangeAddress, sheet);
  22. RegionUtil.setBorderBottom(cellStyle.getBorderBottomEnum(), cellRangeAddress, sheet);
  23. RegionUtil.setBorderLeft(cellStyle.getBorderLeftEnum(), cellRangeAddress, sheet);
  24. }
  25. return sheet.addMergedRegion(cellRangeAddress);
  26. }

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

  1. protected HSSFCellStyleKey( final CellStyle style ) {
  2. this.color = style.getFillForegroundColor();
  3. this.colorTop = style.getTopBorderColor();
  4. this.colorLeft = style.getLeftBorderColor();
  5. this.colorBottom = style.getBottomBorderColor();
  6. this.colorRight = style.getRightBorderColor();
  7. this.borderStrokeTop = style.getBorderTopEnum();
  8. this.borderStrokeLeft = style.getBorderLeftEnum();
  9. this.borderStrokeBottom = style.getBorderBottomEnum();
  10. this.borderStrokeRight = style.getBorderRightEnum();
  11. this.dataStyle = style.getDataFormat();
  12. this.font = style.getFontIndex();
  13. this.horizontalAlignment = style.getAlignmentEnum();
  14. this.verticalAlignment = style.getVerticalAlignmentEnum();
  15. this.wrapText = style.getWrapText();
  16. this.textRotation = TextRotation.getInstance( style.getRotation() );
  17. }

相关文章