https://issues.apache.org/bugzilla/show_bug.cgi?id=54567
Mark B <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |NEW --- Comment #3 from Mark B <[email protected]> --- Assuming you were asking how to set multpile print areas on a sheet, tehn it is possible to do so using the current api. Try something like this; import java.io.*; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.*; /** * * @author Mark Beardsley */ public class TestPrintArea { private static final int MAX_ROWS = 50; private static final int MAX_COLS = 15; public TestPrintArea(String filename) throws FileNotFoundException, IOException { Workbook workbook = null; Sheet sheet = null; Row row = null; Cell cell = null; FileOutputStream fos = null; try { if(filename.endsWith(".xlsx")) { workbook = new XSSFWorkbook(); } else { workbook = new HSSFWorkbook(); } sheet = workbook.createSheet("To Test Print Area."); for(int i = 0; i < MAX_ROWS; i++) { row = sheet.createRow(i); for(int j = 0; j < MAX_COLS; j++) { cell = row.createCell(j); cell.setCellValue((i + 1) * (j + 1)); } } // Use a comma to separate the ramge for each print area workbook.setPrintArea(0, "$A$1:$B$2,$D$1:$H$3"); fos = new FileOutputStream(filename); workbook.write(fos); } finally { if(fos != null) { try { fos.close(); fos = null; } catch(IOException ioEx) { // I G N O R E } } } } } Do not know if there is a limit to the number of print areas that can be set this way. -- You are receiving this mail because: You are the assignee for the bug. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
