Bug 48707 - Excel: Custom Paper size (height/Width)
Summary: Excel: Custom Paper size (height/Width)
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: unspecified
Hardware: All All
: P2 major (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
: 48708 (view as bug list)
Depends on:
Blocks: 48708
  Show dependency tree
 
Reported: 2010-02-08 23:40 UTC by Tariq Zubairy
Modified: 2015-05-22 21:43 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tariq Zubairy 2010-02-08 23:40:28 UTC
HSSFPrintSetup/XSSFPrintSetup setPaperSize method does not allow to set custom width and custom height of paper used for printing ...

Here is my scenario...

HSSFSheet hssfSheet = hssfWorkBook.getSheetAt(0);
HSSFPrintSetup hssfPS = hssfSheet.getPrintSetup();

hssfPS.setFitWidth((short)1);
hssfPS.setFitHeight((short)999);
hssfSheet.setFitToPage(true);


here I want to set the custom paper size, as setPaperSize only gives few option for paper size so it is not feasible due to that limitation. I want to set the custom paper size according to the maximum physical number of cells in excel sheet so that the data in my sheet should not shrink when I made its actual printout or PDF.... (i.e. set width to 17 inches when max physical columns in sheet are more than 10 and set width of page to 20 inches when max physical columns are greater than 15 etc...)
Comment 1 Yegor Kozlov 2010-05-30 03:07:22 UTC
*** Bug 48708 has been marked as a duplicate of this bug. ***
Comment 2 Dominik Stadler 2015-05-22 21:43:30 UTC
See the comments at https://bz.apache.org/bugzilla/show_bug.cgi?id=43693#c8 for a way that might make this work and some additional explanation. 

Therefore I am closing this as WORKSFORME, please report a new bug if you still cannot make it work with the latest version of POI.