-
Notifications
You must be signed in to change notification settings - Fork 5
Set Print Area
shoaibkhan-aspose edited this page Jul 14, 2014
·
3 revisions
Workbook wb = new HSSFWorkbook();
Sheet sheet = wb.createSheet("Sheet1");
//sets the print area for the first sheet
wb.setPrintArea(0, "$A$1:$C$2");
//Alternatively:
wb.setPrintArea(
0, //sheet index
0, //start column
1, //end column
0, //start row
0 //end row
);
// Instantiating a Workbook object
Workbook workbook = new Workbook();
// Accessing the first worksheet in the Workbook file
WorksheetCollection worksheets = workbook.getWorksheets();
Worksheet sheet = worksheets.get(0);
// Obtaining the reference of the PageSetup of the worksheet
PageSetup pageSetup = sheet.getPageSetup();
// Specifying the cells range (from A1 cell to F20 cell) of the print area
pageSetup.setPrintArea("A1:F20");
Download Source Code
For further releases and updates, please follow these new repositories:
- Aspose.Words Java for Apache POI
- Aspose.Cells Java for Apache POI
- Aspose.Slides Java for Apache POI
- Aspose.Email Java for Apache POI
- For documentation, please visit Aspose Docs.
- Raise your queries and suggest more examples via Aspose Forums or via new social coding sites.