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

x33g5p2x  于2022-01-29 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(244)

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

Sheet.getColumnStyle介绍

[英]Returns the CellStyle that applies to the given (0 based) column, or null if no style has been set for that column
[中]返回应用于给定(基于0)列的CellStyle,如果没有为该列设置样式,则返回null

代码示例

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

/**
 * 获取或创建某一行的样式,返回样式后可以设置样式内容
 * 
 * @param x X坐标,从0计数,既列号
 * @return {@link CellStyle}
 * @since 4.1.4
 */
public CellStyle getOrCreateColumnStyle(int x) {
  CellStyle columnStyle = this.sheet.getColumnStyle(x);
  if (null == columnStyle) {
    columnStyle = this.workbook.createCellStyle();
    this.sheet.setDefaultColumnStyle(x, columnStyle);
  }
  return columnStyle;
}

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

/**
 * 获取或创建某一行的样式,返回样式后可以设置样式内容
 * 
 * @param x X坐标,从0计数,既列号
 * @return {@link CellStyle}
 * @since 4.1.4
 */
public CellStyle getOrCreateColumnStyle(int x) {
  CellStyle columnStyle = this.sheet.getColumnStyle(x);
  if (null == columnStyle) {
    columnStyle = this.workbook.createCellStyle();
    this.sheet.setDefaultColumnStyle(x, columnStyle);
  }
  return columnStyle;
}

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

/**
 * 获取或创建某一行的样式,返回样式后可以设置样式内容
 * 
 * @param x X坐标,从0计数,既列号
 * @return {@link CellStyle}
 * @since 4.1.4
 */
public CellStyle getOrCreateColumnStyle(int x) {
  CellStyle columnStyle = this.sheet.getColumnStyle(x);
  if (null == columnStyle) {
    columnStyle = this.workbook.createCellStyle();
    this.sheet.setDefaultColumnStyle(x, columnStyle);
  }
  return columnStyle;
}

相关文章

微信公众号

最新文章

更多