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

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

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

CellStyle.setHidden介绍

[英]set the cell's using this style to be hidden
[中]将使用此样式的单元格设置为隐藏

代码示例

代码示例来源:origin: org.apache.poi/poi

/**
 * Sets the format properties of the given style based on the given map.
 *
 * @param style cell style
 * @param workbook parent workbook
 * @param properties map of format properties (String -> Object)
 * @see #getFormatProperties(CellStyle)
 */
private static void setFormatProperties(CellStyle style, Workbook workbook, Map<String, Object> properties) {
  style.setAlignment(getHorizontalAlignment(properties, ALIGNMENT));
  style.setVerticalAlignment(getVerticalAlignment(properties, VERTICAL_ALIGNMENT));
  style.setBorderBottom(getBorderStyle(properties, BORDER_BOTTOM));
  style.setBorderLeft(getBorderStyle(properties, BORDER_LEFT));
  style.setBorderRight(getBorderStyle(properties, BORDER_RIGHT));
  style.setBorderTop(getBorderStyle(properties, BORDER_TOP));
  style.setBottomBorderColor(getShort(properties, BOTTOM_BORDER_COLOR));
  style.setDataFormat(getShort(properties, DATA_FORMAT));
  style.setFillPattern(getFillPattern(properties, FILL_PATTERN));
  style.setFillForegroundColor(getShort(properties, FILL_FOREGROUND_COLOR));
  style.setFillBackgroundColor(getShort(properties, FILL_BACKGROUND_COLOR));
  style.setFont(workbook.getFontAt(getInt(properties, FONT)));
  style.setHidden(getBoolean(properties, HIDDEN));
  style.setIndention(getShort(properties, INDENTION));
  style.setLeftBorderColor(getShort(properties, LEFT_BORDER_COLOR));
  style.setLocked(getBoolean(properties, LOCKED));
  style.setRightBorderColor(getShort(properties, RIGHT_BORDER_COLOR));
  style.setRotation(getShort(properties, ROTATION));
  style.setTopBorderColor(getShort(properties, TOP_BORDER_COLOR));
  style.setWrapText(getBoolean(properties, WRAP_TEXT));
}

代码示例来源:origin: Vatavuk/excel-io

@Override
  public void accept(final CellStyle style) {
    style.setHidden(this.value);
  }
}

代码示例来源:origin: stackoverflow.com

CellStyle hiddenstyle = workBook.createCellStyle();
hiddenstyle.setHidden(true);

代码示例来源:origin: SheetJS/jxls

newStyle.setFillPattern(style.getFillPattern());
newStyle.setFont(workbook.getFontAt(style.getFontIndex()));
newStyle.setHidden(style.getHidden());
newStyle.setIndention(style.getIndention());
newStyle.setLeftBorderColor(style.getLeftBorderColor());

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
 * Sets the format properties of the given style based on the given map.
 *
 * @param style cell style
 * @param workbook parent workbook
 * @param properties map of format properties (String -> Object)
 * @see #getFormatProperties(CellStyle)
 */
private static void setFormatProperties(CellStyle style, Workbook workbook, Map<String, Object> properties) {
  style.setAlignment(getHorizontalAlignment(properties, ALIGNMENT));
  style.setVerticalAlignment(getVerticalAlignment(properties, VERTICAL_ALIGNMENT));
  style.setBorderBottom(getBorderStyle(properties, BORDER_BOTTOM));
  style.setBorderLeft(getBorderStyle(properties, BORDER_LEFT));
  style.setBorderRight(getBorderStyle(properties, BORDER_RIGHT));
  style.setBorderTop(getBorderStyle(properties, BORDER_TOP));
  style.setBottomBorderColor(getShort(properties, BOTTOM_BORDER_COLOR));
  style.setDataFormat(getShort(properties, DATA_FORMAT));
  style.setFillPattern(getFillPattern(properties, FILL_PATTERN));
  style.setFillForegroundColor(getShort(properties, FILL_FOREGROUND_COLOR));
  style.setFillBackgroundColor(getShort(properties, FILL_BACKGROUND_COLOR));
  style.setFont(workbook.getFontAt(getInt(properties, FONT)));
  style.setHidden(getBoolean(properties, HIDDEN));
  style.setIndention(getShort(properties, INDENTION));
  style.setLeftBorderColor(getShort(properties, LEFT_BORDER_COLOR));
  style.setLocked(getBoolean(properties, LOCKED));
  style.setRightBorderColor(getShort(properties, RIGHT_BORDER_COLOR));
  style.setRotation(getShort(properties, ROTATION));
  style.setTopBorderColor(getShort(properties, TOP_BORDER_COLOR));
  style.setWrapText(getBoolean(properties, WRAP_TEXT));
}

代码示例来源:origin: net.sf.jxls/jxls-core

newStyle.setFillPattern(style.getFillPattern());
newStyle.setFont(workbook.getFontAt(style.getFontIndex()));
newStyle.setHidden(style.getHidden());
newStyle.setIndention(style.getIndention());
newStyle.setLeftBorderColor(style.getLeftBorderColor());

代码示例来源:origin: com.haulmont.thirdparty/poi

/**
 * Sets the format properties of the given style based on the given map.
 *
 * @param style cell style
 * @param workbook parent workbook
 * @param properties map of format properties (String -> Object)
 * @see #getFormatProperties(CellStyle)
 */
private static void setFormatProperties(CellStyle style, Workbook workbook, Map<String, Object> properties) {
  style.setAlignment(getShort(properties, ALIGNMENT));
  style.setBorderBottom(getShort(properties, BORDER_BOTTOM));
  style.setBorderLeft(getShort(properties, BORDER_LEFT));
  style.setBorderRight(getShort(properties, BORDER_RIGHT));
  style.setBorderTop(getShort(properties, BORDER_TOP));
  style.setBottomBorderColor(getShort(properties, BOTTOM_BORDER_COLOR));
  style.setDataFormat(getShort(properties, DATA_FORMAT));
  style.setFillBackgroundColor(getShort(properties, FILL_BACKGROUND_COLOR));
  style.setFillForegroundColor(getShort(properties, FILL_FOREGROUND_COLOR));
  style.setFillPattern(getShort(properties, FILL_PATTERN));
  style.setFont(workbook.getFontAt(getShort(properties, FONT)));
  style.setHidden(getBoolean(properties, HIDDEN));
  style.setIndention(getShort(properties, INDENTION));
  style.setLeftBorderColor(getShort(properties, LEFT_BORDER_COLOR));
  style.setLocked(getBoolean(properties, LOCKED));
  style.setRightBorderColor(getShort(properties, RIGHT_BORDER_COLOR));
  style.setRotation(getShort(properties, ROTATION));
  style.setTopBorderColor(getShort(properties, TOP_BORDER_COLOR));
  style.setVerticalAlignment(getShort(properties, VERTICAL_ALIGNMENT));
  style.setWrapText(getBoolean(properties, WRAP_TEXT));
}

代码示例来源:origin: com.eas.platypus/platypus-js-reports

private void copyStyle(Workbook workbook, Cell fromCell, Cell toCell) {
    CellStyle toStyle = toCell.getCellStyle();
    CellStyle fromStyle = fromCell.getCellStyle();
    CellStyle newStyle = workbook.createCellStyle();

    newStyle.setAlignment(fromStyle.getAlignment());
    newStyle.setBorderBottom(fromStyle.getBorderBottom());
    newStyle.setBorderLeft(fromStyle.getBorderLeft());
    newStyle.setBorderRight(fromStyle.getBorderRight());
    newStyle.setBorderTop(fromStyle.getBorderTop());
    newStyle.setBottomBorderColor(fromStyle.getBottomBorderColor());

    newStyle.setFillBackgroundColor(fromStyle.getFillBackgroundColor());
    newStyle.setFillForegroundColor(fromStyle.getFillForegroundColor());
    newStyle.setFillPattern(fromStyle.getFillPattern());
    newStyle.setFont(workbook.getFontAt(fromStyle.getFontIndex()));
    newStyle.setHidden(fromStyle.getHidden());
    newStyle.setIndention(fromStyle.getIndention());
    newStyle.setLeftBorderColor(fromStyle.getLeftBorderColor());
    newStyle.setLocked(fromStyle.getLocked());
    newStyle.setRightBorderColor(fromStyle.getRightBorderColor());
    newStyle.setTopBorderColor(fromStyle.getTopBorderColor());
    newStyle.setVerticalAlignment(fromStyle.getVerticalAlignment());
    newStyle.setWrapText(fromStyle.getWrapText());
    newStyle.setDataFormat(toStyle.getDataFormat());
    toCell.setCellStyle(newStyle);
  }
}

代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev

/**
 * Sets the format properties of the given style based on the given map.
 *
 * @param style cell style
 * @param workbook parent workbook
 * @param properties map of format properties (String -> Object)
 * @see #getFormatProperties(CellStyle)
 */
private static void setFormatProperties(CellStyle style, Workbook workbook, Map<String, Object> properties) {
  style.setAlignment(getShort(properties, ALIGNMENT));
  style.setBorderBottom(getShort(properties, BORDER_BOTTOM));
  style.setBorderLeft(getShort(properties, BORDER_LEFT));
  style.setBorderRight(getShort(properties, BORDER_RIGHT));
  style.setBorderTop(getShort(properties, BORDER_TOP));
  style.setBottomBorderColor(getShort(properties, BOTTOM_BORDER_COLOR));
  style.setDataFormat(getShort(properties, DATA_FORMAT));
  style.setFillBackgroundColor(getShort(properties, FILL_BACKGROUND_COLOR));
  style.setFillForegroundColor(getShort(properties, FILL_FOREGROUND_COLOR));
  style.setFillPattern(getShort(properties, FILL_PATTERN));
  style.setFont(workbook.getFontAt(getShort(properties, FONT)));
  style.setHidden(getBoolean(properties, HIDDEN));
  style.setIndention(getShort(properties, INDENTION));
  style.setLeftBorderColor(getShort(properties, LEFT_BORDER_COLOR));
  style.setLocked(getBoolean(properties, LOCKED));
  style.setRightBorderColor(getShort(properties, RIGHT_BORDER_COLOR));
  style.setRotation(getShort(properties, ROTATION));
  style.setTopBorderColor(getShort(properties, TOP_BORDER_COLOR));
  style.setVerticalAlignment(getShort(properties, VERTICAL_ALIGNMENT));
  style.setWrapText(getBoolean(properties, WRAP_TEXT));
}

代码示例来源:origin: org.apache.poi/poi-contrib

/**
 * Sets the format properties of the given style based on the given map.
 *
 * @param style cell style
 * @param workbook parent workbook
 * @param properties map of format properties (String -> Object)
 * @see #getFormatProperties(CellStyle)
 */
private static void setFormatProperties(CellStyle style, Workbook workbook, Map<String, Object> properties) {
  style.setAlignment(getShort(properties, ALIGNMENT));
  style.setBorderBottom(getShort(properties, BORDER_BOTTOM));
  style.setBorderLeft(getShort(properties, BORDER_LEFT));
  style.setBorderRight(getShort(properties, BORDER_RIGHT));
  style.setBorderTop(getShort(properties, BORDER_TOP));
  style.setBottomBorderColor(getShort(properties, BOTTOM_BORDER_COLOR));
  style.setDataFormat(getShort(properties, DATA_FORMAT));
  style.setFillBackgroundColor(getShort(properties, FILL_BACKGROUND_COLOR));
  style.setFillForegroundColor(getShort(properties, FILL_FOREGROUND_COLOR));
  style.setFillPattern(getShort(properties, FILL_PATTERN));
  style.setFont(workbook.getFontAt(getShort(properties, FONT)));
  style.setHidden(getBoolean(properties, HIDDEN));
  style.setIndention(getShort(properties, INDENTION));
  style.setLeftBorderColor(getShort(properties, LEFT_BORDER_COLOR));
  style.setLocked(getBoolean(properties, LOCKED));
  style.setRightBorderColor(getShort(properties, RIGHT_BORDER_COLOR));
  style.setRotation(getShort(properties, ROTATION));
  style.setTopBorderColor(getShort(properties, TOP_BORDER_COLOR));
  style.setVerticalAlignment(getShort(properties, VERTICAL_ALIGNMENT));
  style.setWrapText(getBoolean(properties, WRAP_TEXT));
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi

/**
 * Sets the format properties of the given style based on the given map.
 *
 * @param style cell style
 * @param workbook parent workbook
 * @param properties map of format properties (String -> Object)
 * @see #getFormatProperties(CellStyle)
 */
private static void setFormatProperties(CellStyle style, Workbook workbook, Map<String, Object> properties) {
  style.setAlignment(getShort(properties, ALIGNMENT));
  style.setBorderBottom(getShort(properties, BORDER_BOTTOM));
  style.setBorderLeft(getShort(properties, BORDER_LEFT));
  style.setBorderRight(getShort(properties, BORDER_RIGHT));
  style.setBorderTop(getShort(properties, BORDER_TOP));
  style.setBottomBorderColor(getShort(properties, BOTTOM_BORDER_COLOR));
  style.setDataFormat(getShort(properties, DATA_FORMAT));
  style.setFillBackgroundColor(getShort(properties, FILL_BACKGROUND_COLOR));
  style.setFillForegroundColor(getShort(properties, FILL_FOREGROUND_COLOR));
  style.setFillPattern(getShort(properties, FILL_PATTERN));
  style.setFont(workbook.getFontAt(getShort(properties, FONT)));
  style.setHidden(getBoolean(properties, HIDDEN));
  style.setIndention(getShort(properties, INDENTION));
  style.setLeftBorderColor(getShort(properties, LEFT_BORDER_COLOR));
  style.setLocked(getBoolean(properties, LOCKED));
  style.setRightBorderColor(getShort(properties, RIGHT_BORDER_COLOR));
  style.setRotation(getShort(properties, ROTATION));
  style.setTopBorderColor(getShort(properties, TOP_BORDER_COLOR));
  style.setVerticalAlignment(getShort(properties, VERTICAL_ALIGNMENT));
  style.setWrapText(getBoolean(properties, WRAP_TEXT));
}

代码示例来源:origin: SheetJS/jxls

private void copyStyle(Workbook workbook, org.apache.poi.ss.usermodel.Cell fromCell, org.apache.poi.ss.usermodel.Cell toCell){
    CellStyle toStyle = toCell.getCellStyle();
    CellStyle fromStyle = fromCell.getCellStyle();
    if( fromStyle.getDataFormat() == toStyle.getDataFormat() ){
      toCell.setCellStyle( fromStyle );
    }else{
      CellStyle newStyle = workbook.createCellStyle();
      newStyle.setAlignment( toStyle.getAlignment() );
      newStyle.setBorderBottom( toStyle.getBorderBottom() );
      newStyle.setBorderLeft( toStyle.getBorderLeft() );
      newStyle.setBorderRight( toStyle.getBorderRight() );
      newStyle.setBorderTop( toStyle.getBorderTop() );
      newStyle.setBottomBorderColor( toStyle.getBottomBorderColor() );
      newStyle.setDataFormat( toStyle.getDataFormat() );
      newStyle.setFillBackgroundColor( fromStyle.getFillBackgroundColor() );
      newStyle.setFillForegroundColor( fromStyle.getFillForegroundColor() );
      newStyle.setFillPattern( fromStyle.getFillPattern() );
      newStyle.setFont( workbook.getFontAt( fromStyle.getFontIndex() ) );
      newStyle.setHidden( toStyle.getHidden() );
      newStyle.setIndention( toStyle.getIndention() );
      newStyle.setLeftBorderColor( toStyle.getLeftBorderColor() );
      newStyle.setLocked( toStyle.getLocked() );
      newStyle.setRightBorderColor( toStyle.getRightBorderColor() );
      newStyle.setTopBorderColor( toStyle.getTopBorderColor() );
      newStyle.setVerticalAlignment( toStyle.getVerticalAlignment() );
      newStyle.setWrapText( toStyle.getWrapText() );
      toCell.setCellStyle( newStyle );
    }
  }
}

代码示例来源:origin: com.github.nic-luo/rober-office

toStyle.setFillPattern(fromStyle.getFillPattern());
toStyle.setHidden(fromStyle.getHidden());

相关文章

微信公众号

最新文章

更多