Java Code Examples for org.apache.poi.hssf.usermodel.HSSFSheet#getDefaultRowHeight()
The following examples show how to use
org.apache.poi.hssf.usermodel.HSSFSheet#getDefaultRowHeight() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Util.java From Knowage-Server with GNU Affero General Public License v3.0 | 5 votes |
/** * @param source * the sheet to copy. * @param destSheet * the sheet to create. * @param srcRow * the row to copy. * @param destRow * the row to create. * @param styleMap * */ private static void copyRow(HSSFSheet source, XSSFSheet destSheet, HSSFRow srcRow, XSSFRow destRow, List<CellStyle> styleMap) { Set<CellRangeAddressWrapper> mergedRegions = new TreeSet<CellRangeAddressWrapper>(); short dh = source.getDefaultRowHeight(); if (srcRow.getHeight() != dh) { destRow.setHeight(srcRow.getHeight()); } int j = srcRow.getFirstCellNum(); if (j < 0) { j = 0; } for (; j <= srcRow.getLastCellNum(); j++) { HSSFCell oldCell = srcRow.getCell(j); XSSFCell newCell = destRow.getCell(j); if (oldCell != null) { if (newCell == null) { newCell = destRow.createCell(j); } copyCell(oldCell, newCell, styleMap); CellRangeAddress mergedRegion = getMergedRegion(source, srcRow.getRowNum(), (short) oldCell.getColumnIndex()); if (mergedRegion != null) { CellRangeAddress newMergedRegion = new CellRangeAddress(mergedRegion.getFirstRow(), mergedRegion.getLastRow(), mergedRegion.getFirstColumn(), mergedRegion.getLastColumn()); CellRangeAddressWrapper wrapper = new CellRangeAddressWrapper(newMergedRegion); if (isNewMergedRegion(wrapper, mergedRegions)) { mergedRegions.add(wrapper); destSheet.addMergedRegion(wrapper.range); } } } } }
Example 2
Source File: PictureSheetGenerator.java From ermasterr with Apache License 2.0 | 5 votes |
private float getRowHeightInPixels(final HSSFSheet sheet, final int i) { final HSSFRow row = sheet.getRow(i); float height; if (row != null) { height = row.getHeight(); } else { height = sheet.getDefaultRowHeight(); } return height / 15F; }
Example 3
Source File: PictureSheetGenerator.java From ermaster-b with Apache License 2.0 | 5 votes |
private float getRowHeightInPixels(HSSFSheet sheet, int i) { HSSFRow row = sheet.getRow(i); float height; if (row != null) { height = row.getHeight(); } else { height = sheet.getDefaultRowHeight(); } return height / 15F; }