本文整理了Java中org.apache.poi.ss.usermodel.Sheet.getDefaultRowHeight()
方法的一些代码示例,展示了Sheet.getDefaultRowHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Sheet.getDefaultRowHeight()
方法的具体详情如下:
包路径:org.apache.poi.ss.usermodel.Sheet
类名称:Sheet
方法名:getDefaultRowHeight
[英]Get the default row height for the sheet (if the rows do not define their own height) in twips (1/20 of a point)
[中]获取图纸的默认行高(如果行未定义自己的高度),单位为twips(1/20点)
代码示例来源:origin: stackoverflow.com
Workbook wb = new HSSFWorkbook();
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
CreationHelper createHelper = wb.getCreationHelper();
Sheet sheet = wb.createSheet("new sheet");
Row row = sheet.createRow((short) 0);
row.setHeight((short) (2*sheet.getDefaultRowHeight()));
CellStyle cs = wb.createCellStyle();
cs.setWrapText(true);
Cell cell = row.createCell(0);
cell.setCellStyle(cs);
cell.setCellValue(
createHelper.createRichTextString("This is \n a string"));
wb.write(fileOut);
fileOut.close();
代码示例来源:origin: org.jxls/jxls-poi
@Override
public void updateRowHeight(String srcSheetName, int srcRowNum, String targetSheetName, int targetRowNum) {
if (isSXSSF) return;
SheetData sheetData = sheetMap.get(srcSheetName);
RowData rowData = sheetData.getRowData(srcRowNum);
Sheet sheet = workbook.getSheet(targetSheetName);
if (sheet == null) {
sheet = workbook.createSheet(targetSheetName);
}
Row targetRow = sheet.getRow(targetRowNum);
if (targetRow == null) {
targetRow = sheet.createRow(targetRowNum);
}
short srcHeight = rowData != null ? (short) rowData.getHeight() : sheet.getDefaultRowHeight();
targetRow.setHeight(srcHeight);
}
}
代码示例来源:origin: spdx/tools
/**
* resize the rows for a best fit. Will not exceed maximum row height.
*/
public void resizeRows() {
// header row
// data rows
int lastRow = this.getNumDataRows()+this.getFirstDataRow()-1;
for (int i = 0; i <= lastRow; i++) {
Row row = sheet.getRow(i);
int lastCell = row.getLastCellNum(); // last cell + 1
int maxNumLines = 1;
for (int j = 0; j < lastCell; j++) {
Cell cell = row.getCell(j);
if (cell != null) {
int cellLines = getNumWrappedLines(cell);
if (cellLines > maxNumLines) {
maxNumLines = cellLines;
}
}
}
if (maxNumLines > MAX_ROW_LINES) {
maxNumLines = MAX_ROW_LINES;
}
if (maxNumLines > 1) {
row.setHeight((short) (sheet.getDefaultRowHeight()*maxNumLines));
}
}
}
代码示例来源:origin: org.spdx/spdx-tools
/**
* resize the rows for a best fit. Will not exceed maximum row height.
*/
public void resizeRows() {
// header row
// data rows
int lastRow = this.getNumDataRows()+this.getFirstDataRow()-1;
for (int i = 0; i <= lastRow; i++) {
Row row = sheet.getRow(i);
int lastCell = row.getLastCellNum(); // last cell + 1
int maxNumLines = 1;
for (int j = 0; j < lastCell; j++) {
Cell cell = row.getCell(j);
if (cell != null) {
int cellLines = getNumWrappedLines(cell);
if (cellLines > maxNumLines) {
maxNumLines = cellLines;
}
}
}
if (maxNumLines > MAX_ROW_LINES) {
maxNumLines = MAX_ROW_LINES;
}
if (maxNumLines > 1) {
row.setHeight((short) (sheet.getDefaultRowHeight()*maxNumLines));
}
}
}
内容来源于网络,如有侵权,请联系作者删除!