/** * Create a new row within the sheet and return the high level representation * * @param rownum row number * @return High level HSSFRow object representing a row in the sheet * @see org.apache.poi.hssf.usermodel.HSSFRow * @see #removeRow(org.apache.poi.ss.usermodel.Row) */ @Override public HSSFRow createRow(int rownum) { HSSFRow row = new HSSFRow(_workbook, this, rownum); // new rows inherit default height from the sheet row.setHeight(getDefaultRowHeight()); row.getRowRecord().setBadFontHeight(false); addRow(row, true); return row; }
final HSSFSheet fs = wb.createSheet("sheet1"); final HSSFRow row0 = fs.createRow(0); final HSSFCell cellA1 = row0.createCell(0); row0.setHeight((short)700);
/** * Create a new row within the sheet and return the high level representation * * @param rownum row number * @return High level HSSFRow object representing a row in the sheet * @see org.apache.poi.hssf.usermodel.HSSFRow * @see #removeRow(org.apache.poi.ss.usermodel.Row) */ public HSSFRow createRow(int rownum) { HSSFRow row = new HSSFRow(_workbook, this, rownum); // new rows inherit default height from the sheet row.setHeight(getDefaultRowHeight()); addRow(row, true); return row; }
row.setHeight((short) 1100); sheet.setColumnWidth(0, 9500); listItems.add("List Item Six."); this.numberedListInCell(workbook, listItems, cell, 1, 2); row.setHeight((short) 1550); listItems.add("List Item Ten."); this.bulletedListInCell(workbook, listItems, cell); row.setHeight((short) 2550); multiLevelListItems.add(new MultiLevelListItem("List Item Four.", listItems)); this.multiLevelListInCell(workbook, multiLevelListItems, cell); row.setHeight((short) 2800); this.multiLevelNumberedListInCell(workbook, multiLevelListItems, cell, 1, 1, 1, 2); row.setHeight((short) 2800); cell = row.createCell(0); this.multiLevelBulletedListInCell(workbook, multiLevelListItems, cell); row.setHeight((short) 2800);
/** * Create a new row within the sheet and return the high level representation * * @param rownum row number * @return High level HSSFRow object representing a row in the sheet * @see org.apache.poi.hssf.usermodel.HSSFRow * @see #removeRow(org.apache.poi.ss.usermodel.Row) */ public HSSFRow createRow(int rownum) { HSSFRow row = new HSSFRow(_workbook, this, rownum); // new rows inherit default height from the sheet row.setHeight(getDefaultRowHeight()); row.getRowRecord().setBadFontHeight(false); addRow(row, true); return row; }
row1.setHeight((short) (256*1.5));
/** * Create a new row within the sheet and return the high level representation * * @param rownum row number * @return High level HSSFRow object representing a row in the sheet * @see org.apache.poi.hssf.usermodel.HSSFRow * @see #removeRow(org.apache.poi.ss.usermodel.Row) */ @Override public HSSFRow createRow(int rownum) { HSSFRow row = new HSSFRow(_workbook, this, rownum); // new rows inherit default height from the sheet row.setHeight(getDefaultRowHeight()); row.getRowRecord().setBadFontHeight(false); addRow(row, true); return row; }
private void buildTitle(String title, int width) { HSSFRow rowTitle = sheet.createRow((short) currentRowIndex); rowTitle.setHeight((short) TITLE_ROW_HEIGHT); HSSFCell cellTitle = rowTitle.createCell(0); cellTitle.setCellValue(title); cellTitle.setCellStyle(new MotechCellStyle(sheet, CellStyle.ALIGN_CENTER).style()); sheet.addMergedRegion(new CellRangeAddress(currentRowIndex, currentRowIndex, FIRST_COLUMN, width)); currentRowIndex++; }
private void createHeaderRow() { HSSFCellStyle headerCellStyle = new MotechCellStyle(sheet).style(); HSSFRow headerRow = sheet.createRow((short) currentRowIndex); headerRow.setHeight((short) HEADER_ROW_HEIGHT); int columnIndex = 0; for (ExcelColumn column : columnHeaders()) { HSSFCell cell = headerRow.createCell(columnIndex); cell.setCellValue(column.getHeader()); cell.setCellStyle(headerCellStyle); columnIndex++; } currentRowIndex++; }
public static void main( String[] args ) throws IOException { try (HSSFWorkbook wb = new HSSFWorkbook()) { HSSFSheet s = wb.createSheet(); HSSFFont f2 = wb.createFont(); HSSFCellStyle cs = wb.createCellStyle(); cs.setFont(f2); // Word Wrap MUST be turned on cs.setWrapText(true); HSSFRow r = s.createRow(2); r.setHeight((short) 0x349); HSSFCell c = r.createCell(2); c.setCellType(CellType.STRING); c.setCellValue("Use \n with word wrap on to create a new line"); c.setCellStyle(cs); s.setColumnWidth(2, (int) ((50 * 8) / ((double) 1 / 20))); try (FileOutputStream fileOut = new FileOutputStream("workbook.xls")) { wb.write(fileOut); } } } }
private static void drawSheet1( HSSFSheet sheet1 ) { // Create a row and size one of the cells reasonably large. HSSFRow row = sheet1.createRow(2); row.setHeight((short) 2800); row.createCell(1); sheet1.setColumnWidth(2, 9000); // Create the drawing patriarch. This is the top level container for // all shapes. HSSFPatriarch patriarch = sheet1.createDrawingPatriarch(); // Draw some lines and an oval. drawLinesToCenter( patriarch ); drawManyLines( patriarch ); drawOval( patriarch ); drawPolygon( patriarch ); // Draw a rectangle. HSSFSimpleShape rect = patriarch.createSimpleShape( new HSSFClientAnchor(100, 100, 900, 200, (short)0, 0, (short)0, 0) ); rect.setShapeType(HSSFSimpleShape.OBJECT_TYPE_RECTANGLE); }
resultRow.setHeight(templateCell.getRow().getHeight());
resultRow.setHeight(templateCell.getRow().getHeight());
private void fillHeaderRow(final HSSFWorkbook workbook, final HSSFSheet sheet, Integer rowNum, final Locale locale) { HSSFRow headerLine = sheet.createRow(rowNum); headerLine.setHeight((short) 800); Font font = workbook.createFont(); font.setFontName(HSSFFont.FONT_ARIAL); font.setFontHeightInPoints((short) 10); font.setBoldweight(Font.BOLDWEIGHT_NORMAL); HSSFCellStyle style = workbook.createCellStyle(); style.setFont(font); style.setBorderBottom(HSSFCellStyle.BORDER_THIN); style.setBorderTop(HSSFCellStyle.BORDER_THIN); style.setBorderLeft(HSSFCellStyle.BORDER_THIN); style.setBorderRight(HSSFCellStyle.BORDER_THIN); style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); style.setWrapText(true); style.setAlignment(HSSFCellStyle.ALIGN_CENTER); style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); int colNumber = 0; for (String column : TimeUsageXlsConstants.ALL_COLUMNS) { HSSFCell headerCell = headerLine.createCell(colNumber); headerCell.setCellValue(translationService.translate(column, locale)); headerCell.setCellStyle(style); colNumber++; } }
private void fillHeaderRow(final HSSFWorkbook workbook, final HSSFSheet sheet, Integer rowNum, final Locale locale) { HSSFRow headerLine = sheet.createRow(rowNum); headerLine.setHeight((short) 800); Font font = workbook.createFont(); font.setFontName(HSSFFont.FONT_ARIAL); font.setFontHeightInPoints((short) 10); font.setBoldweight(Font.BOLDWEIGHT_NORMAL); HSSFCellStyle style = workbook.createCellStyle(); style.setFont(font); style.setBorderBottom(HSSFCellStyle.BORDER_THIN); style.setBorderTop(HSSFCellStyle.BORDER_THIN); style.setBorderLeft(HSSFCellStyle.BORDER_THIN); style.setBorderRight(HSSFCellStyle.BORDER_THIN); style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); style.setFillForegroundColor(IndexedColors.GREY_25_PERCENT.getIndex()); style.setWrapText(true); style.setAlignment(HSSFCellStyle.ALIGN_CENTER); style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); int colNumber = 0; for (String column : WorkerCostsXlsConstants.ALL_COLUMNS) { HSSFCell headerCell = headerLine.createCell(colNumber); headerCell.setCellValue(translationService.translate(column, locale)); headerCell.setCellStyle(style); colNumber++; } }
HSSFRow r = s.createRow(rownum); if ((rownum % 2) == 0) { r.setHeight((short) 0x249);
r.setHeight((short) 0x249);