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

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

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

Sheet.setZoom介绍

[英]Window zoom magnification for current view representing percent values. Valid values range from 10 to 400. Horizontal & Vertical scale together. For example:

10 - 10% 
20 - 20% 
... 
100 - 100% 
... 
400 - 400%

[中]当前视图的窗口缩放比例,表示百分比值。有效值范围为10到400。水平和垂直比例在一起。例如:

10 - 10% 
20 - 20% 
... 
100 - 100% 
... 
400 - 400%

代码示例

代码示例来源:origin: micromata/projectforge

/**
 * @param x
 * @param y
 * @see Sheet#setZoom(int, int)
 */
public void setZoom(final int x, final int y)
{
 poiSheet.setZoom(x, y);
}

代码示例来源:origin: ro.fortsoft.wicket.pivot/wicket-pivot-exporter

private void autoSizeColumns(Sheet sheetData, int maxColNum) {
  try {
    // Autosize columns
    int width = 0;
    for (int col = 0; col < maxColNum; col++) {
      sheetData.autoSizeColumn(col);
      int cwidth = sheetData.getColumnWidth(col);
      cwidth += 500;
      sheetData.setColumnWidth(col, cwidth);
      width += cwidth;
    }
    // calculate zoom factor
    int nominator = 45000 * 100 / width;
    if (nominator < 100)
      sheetData.setZoom(nominator, 100);
  } catch (HeadlessException he) {
    // No UI, no autosize :(
  }
}

代码示例来源:origin: net.paissad.tools.reqcoco/reqcoco-core

sheet.setZoom(DEFAULT_ZOOM_SCALE);

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

sheet.setColumnWidth(1, 256*33);
sheet.setColumnWidth(2, 256*20);
sheet.setZoom(75); //75% scale

代码示例来源:origin: net.paissad.tools.reqcoco/reqcoco-core

private void createOrUpdateSummarySheet(final Workbook wb, final String version, final int rowStartPosition) {
  Sheet sheet = wb.getSheet("Summary");
  if (sheet == null) {
    sheet = wb.createSheet(WorkbookUtil.createSafeSheetName("Summary"));
    final CreationHelper creationHelper = wb.getCreationHelper();
    final Font font = wb.createFont();
    XSSFCellStyle cellStyle = (XSSFCellStyle) wb.createCellStyle();
    // Title
    final Row rowTitle = sheet.createRow(0);
    cellStyle.setAlignment(HorizontalAlignment.CENTER);
    cellStyle.setFillForegroundColor(IndexedColors.CORNFLOWER_BLUE.getIndex());
    cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
    font.setBold(true);
    cellStyle.setFont(font);
    final Cell cellTitle = rowTitle.createCell(4);
    cellTitle.setCellValue(creationHelper.createRichTextString(getDefaultReportConfig().getTitle()));
    cellTitle.setCellStyle(cellStyle);
    sheet.autoSizeColumn(cellTitle.getColumnIndex());
    // Row for total of requirements for all versions
    final Row rowTotalOfReqsForAllVersions = sheet.createRow(3);
    final Cell cellTotalOfReqs = rowTotalOfReqsForAllVersions.createCell(0);
    cellTotalOfReqs.setCellValue(creationHelper.createRichTextString("Total of requirements : " + getRequirements().size()));
    cellTotalOfReqs.getCellStyle().setFont(font);
    sheet.autoSizeColumn(cellTotalOfReqs.getColumnIndex());
    sheet.setZoom(DEFAULT_ZOOM_SCALE);
  }
  if (!StringUtils.isBlank(version)) {
    this.updateSummarySheet(wb, sheet, version, rowStartPosition);
  }
}

代码示例来源:origin: com.namics.oss.spring.support.i18n/spring-i18n-support

LOG.info("Create sheet with name " + name);
Sheet sheet = wb.createSheet(name);
sheet.setZoom(this.zoom, 100);

相关文章

微信公众号

最新文章

更多