List of usage examples for org.apache.poi.hssf.usermodel HSSFSheet shiftRows
@Override public void shiftRows(int startRow, int endRow, int n, boolean copyRowHeight, boolean resetOriginalRowHeight)
From source file:citibob.reports.PoiXlsWriter.java
License:Open Source License
/** @param row0 example row to copy when inserting... Don't do fixup between xrow0 and xrow1, non-inclusive. */ public void insertRowsFixup(HSSFSheet sheet, int rowIx, int n, int row0Ix, int xcol0, int xcol1, int xrow0, int xrow1) { sheet.shiftRows(rowIx, sheet.getLastRowNum(), n, true, true); HSSFRow row0 = sheet.getRow(row0Ix + n); if (row0 != null) { for (int r = rowIx; r < rowIx + n; ++r) { HSSFRow row1 = sheet.createRow(r); copyRow(row0, row1, xcol0, xcol1); }/*from w ww .j av a 2s. c o m*/ } fixupFormulas(sheet, rowIx, n, xrow0, xrow1); }
From source file:citibob.reports.PoiXlsWriter.java
License:Open Source License
/** Don't do fixup between xrow0 and xrow1, non-inclusive. */ public void deleteRowsFixup(HSSFSheet sheet, int rowIx, int n, int xrow0, int xrow1) { sheet.shiftRows(rowIx + n, sheet.getLastRowNum(), -n, true, true); fixupFormulas(sheet, rowIx, -n, xrow0, xrow1); }
From source file:org.jxstar.report.util.ReportXlsUtil.java
/** * ?PageSize?/*from w w w . j ava 2s . c o m*/ * @param sheet -- ? * @param startRow -- ???PageSize * @param rows -- ? * @return */ public static HSSFSheet insertSheetRow(HSSFSheet sheet, int startRow, int rows) { if (sheet == null) return null; sheet.shiftRows(startRow, sheet.getLastRowNum(), rows, true, false); HSSFCell sourcell = null, descell = null; HSSFRow sourow = sheet.getRow(startRow - 1); for (int i = 0; i < rows; i++) { HSSFRow descrow = sheet.createRow(startRow + i); descrow.setHeight(sourow.getHeight()); descrow.setHeightInPoints(sourow.getHeightInPoints()); java.util.Iterator<Cell> iter = sourow.cellIterator(); while (iter.hasNext()) { sourcell = (HSSFCell) iter.next(); int column = sourcell.getColumnIndex(); descell = descrow.createCell(column); descell.setCellType(sourcell.getCellType()); descell.setCellStyle(sourcell.getCellStyle()); } } //?? insertSheetRegions(sheet, startRow, rows); return sheet; }
From source file:org.rti.zcore.dar.report.MonthlyArtSheetPopulater.java
License:Apache License
/** * Populates the monthly ART Sheet//from w w w .j a v a 2s . c om * If this is the standalone dynamic sheet, set currentRow = 11. * @param mReport * @param mSsheet * @param currentRow - if you want the list to start at n, set currentRow to n-1. */ public static void populateDynamicMonthlyArtSheet(MonthlyArtReport mReport, HSSFSheet mSsheet, int currentRow) { ArrayList<RegimenReport> regimenList = mReport.getRegimenList(); //if (regimenList.size() > 2) { //int shiftRows = regimenList.size() - 2; if (regimenList.size() > 0) { mSsheet.shiftRows(101, 123, regimenList.size(), true, true); } //} for (RegimenReport regimenReport : regimenList) { currentRow++; HSSFRichTextString code = new HSSFRichTextString(regimenReport.getCode()); HSSFRichTextString name = new HSSFRichTextString(regimenReport.getName()); /*HSSFRow row = mSsheet.createRow(currentRow); HSSFCell cell = row.createCell(0); cell.setCellValue(code);*/ mSsheet.createRow(currentRow).createCell(0).setCellValue(code); mSsheet.getRow(currentRow).createCell(1).setCellValue(name); //mSsheet.getRow(currentRow).getCell(1).setCellValue(name); mSsheet.getRow(currentRow).createCell(2).setCellValue(regimenReport.getCountInt()); mSsheet.getRow(currentRow).createCell(4).setCellValue(regimenReport.getNewEstimatedArtPatients()); mSsheet.getRow(currentRow).createCell(6).setCellValue(regimenReport.getTotalEstimatedArtPatients()); } }