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

x33g5p2x  于2022-01-28 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(210)

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

Row.getHeightInPoints介绍

[英]Returns row height measured in point size. If the height is not set, the default worksheet value is returned, See Sheet#getDefaultRowHeightInPoints()
[中]返回以点大小度量的行高度。如果未设置高度,则返回默认工作表值,请参见工作表#getDefaultRowHeightInPoints()

代码示例

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

public static double getRowHeightInPixels(Sheet sheet, int rowNum) {
    Row r = sheet.getRow(rowNum);
    double points = (r == null) ? sheet.getDefaultRowHeightInPoints() : r.getHeightInPoints();
    return Units.toEMU(points)/(double)EMU_PER_PIXEL;
  }
}

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

private float getRowHeightInPixels(int rowIndex) {
  // THE FOLLOWING THREE LINES ARE THE MAIN CHANGE compared to the non-streaming version: use the SXSSF sheet,
  // not the XSSF sheet (which never contais rows when using SXSSF)
  XSSFSheet xssfSheet = getSheet();
  SXSSFSheet sheet = _wb.getSXSSFSheet(xssfSheet);
  Row row = sheet.getRow(rowIndex);
  float height = row != null ?  row.getHeightInPoints() : sheet.getDefaultRowHeightInPoints();
  return height * Units.PIXEL_DPI / Units.POINT_DPI;
}
/**

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

public static double getRowHeightInPixels(Sheet sheet, int rowNum) {
    Row r = sheet.getRow(rowNum);
    double points = (r == null) ? sheet.getDefaultRowHeightInPoints() : r.getHeightInPoints();
    return Units.toEMU(points)/(double)EMU_PER_PIXEL;
  }
}

代码示例来源:origin: subtlelib/poi

/**
 * Define row height as follows:
 * - row height set explicitly by user: value defined by user;
 * - multiline output and no row height defined: default height * number of lines;
 * - otherwise: auto row height (by setting height to a magic value of #ROW_HEIGHT_AUTOMATIC);
 */
private void assignRowHeight(int rowHeightMultiplier) {
  if (rowHeightMultiplier > 1 && rowHeight == ROW_HEIGHT_AUTOMATIC) {
    row.setHeightInPoints(row.getHeightInPoints() * rowHeightMultiplier);
  } else {
    row.setHeight(rowHeight);
  }
}

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

private float getRowHeightInPixels(int rowIndex) {
  // THE FOLLOWING THREE LINES ARE THE MAIN CHANGE compared to the non-streaming version: use the SXSSF sheet,
  // not the XSSF sheet (which never contais rows when using SXSSF)
  XSSFSheet xssfSheet = getSheet();
  SXSSFSheet sheet = _wb.getSXSSFSheet(xssfSheet);
  Row row = sheet.getRow(rowIndex);
  float height = row != null ?  row.getHeightInPoints() : sheet.getDefaultRowHeightInPoints();
  return height * Units.PIXEL_DPI / Units.POINT_DPI;
}
/**

代码示例来源:origin: liaochong/html2excel

/**
 * 设置所有单元格,自适应列宽,单元格最大支持字符长度255
 */
private void setTdOfTable(Table table, Sheet sheet) {
  maxTdHeightMap = new HashMap<>();
  Map<Integer, Integer> colMaxWidthMap = this.getColMaxWidthMap(table);
  for (int i = 0, size = table.getTrList().size(); i < size; i++) {
    Tr tr = table.getTrList().get(i);
    tr.getTdList().forEach(td -> this.setCell(td, sheet));
    // 设置行高,最小12
    Row row = sheet.getRow(tr.getIndex());
    if (Objects.isNull(maxTdHeightMap.get(row.getRowNum()))) {
      row.setHeightInPoints(row.getHeightInPoints() + 5);
    } else {
      row.setHeightInPoints((short) (maxTdHeightMap.get(row.getRowNum()) + 5));
      maxTdHeightMap.remove(row.getRowNum());
    }
    table.getTrList().set(i, null);
  }
  colMaxWidthMap.forEach((key, value) -> {
    int contentLength = value << 1;
    if (contentLength > 255) {
      contentLength = 255;
    }
    sheet.setColumnWidth(key, contentLength << 8);
  });
}

代码示例来源:origin: zsl131/spring-boot-test

findData = true;
defaultStyle = c.getCellStyle();
rowHeight = row.getHeightInPoints();
initStyles();
break;

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

rowHeightMM = row.getHeightInPoints() /
    ConvertImageUnits.POINTS_PER_MILLIMETRE;
totalRowHeightMM += rowHeightMM;

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

rowHeightMM = row.getHeightInPoints() / ConvertImageUnits.POINTS_PER_MILLIMETRE;

代码示例来源:origin: org.hswebframework/hsweb-expands-office

@Override
public void nextRow(Cell cell) {
  if (nowRow == null) {
    //首次渲染行,则将表达式所在行替换为数据行
    nowRow = cell.getRow();
  } else {
    //创建下一行
    int rowNum = nowRow.getRowNum() + 1;
    //将最后一行移动到当前行,以实现插入行效果
    sheet.shiftRows(rowNum,sheet.getLastRowNum(),1,true,false);
    Row tmp = sheet.createRow(rowNum);
    tmp.setHeight(nowRow.getHeight());
    tmp.setHeightInPoints(nowRow.getHeightInPoints());
    nowRow = tmp;
  }
}

代码示例来源:origin: hs-web/hsweb-expands

@Override
public void nextRow(Cell cell) {
  if (nowRow == null) {
    //首次渲染行,则将表达式所在行替换为数据行
    nowRow = cell.getRow();
  } else {
    //创建下一行
    int rowNum = nowRow.getRowNum() + 1;
    //将最后一行移动到当前行,以实现插入行效果
    sheet.shiftRows(rowNum,sheet.getLastRowNum(),1,true,false);
    Row tmp = sheet.createRow(rowNum);
    tmp.setHeight(nowRow.getHeight());
    tmp.setHeightInPoints(nowRow.getHeightInPoints());
    nowRow = tmp;
  }
}

代码示例来源:origin: hellojavaer/poi-excel-utils

templateRow = new InnerRow();
templateRow.setHeight(tempRow.getHeight());
templateRow.setHeightInPoints(tempRow.getHeightInPoints());
templateRow.setRowStyle(tempRow.getRowStyle());
templateRow.setZeroHeight(tempRow.getZeroHeight());

代码示例来源:origin: caryyu/excel2pdf

pdfpCell.setPhrase(getPhrase(cell));
pdfpCell.setMinimumHeight(this.getPixelHeight(row.getHeightInPoints()));

相关文章