Bug 24066 - "Fit To" option in the Page Setup Properties not working
Summary: "Fit To" option in the Page Setup Properties not working
Status: RESOLVED FIXED
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 2.0-pre3
Hardware: PC All
: P3 normal (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-10-23 16:32 UTC by mjmoore
Modified: 2016-05-13 14:41 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mjmoore 2003-10-23 16:32:12 UTC
I am using the HSSFSheet class as well as the HSSFPrintSetup class to set some 
page setup properties for printing.  The properties I am trying to set are in 
the scaling section of the page setup form.  The second option button of the 
scaling section is the "Fit to" option button.  According to the java doc, I 
should be able to select that option button and set the width of pages to fit 
to and height of pages to fit to using the HSSFPrintSetup class's methods of 
setFitWidth and setFitHeight.  

For example:

        this.sheet.getPrintSetup().setFitWidth((short) 1);
        this.sheet.getPrintSetup().setFitHeight((short) 26);

sets the values in the Width and Height properties of the scaling section, but 
it does not select the "Fit To" option button, which is required to use these 
values.  

Upon further investigation, I found that he setScale method of the 
HSSFPrintSetup class selects the "Fit To" option button when used alone, but 
when used in conjuction with the setHeight and setWidth methods, selects 
the "Adjust To" option button in the scaling section.

For Example:
 this.sheet.getPrintSetup().setScale((short) 1);
 -Sets the "Fit To" option button and sets the width and height values to 1.
  this.sheet.getPrintSetup().setScale((short) 1);
  this.sheet.getPrintSetup().setFitWidth((short) 1);
  this.sheet.getPrintSetup().setFitHeight((short) 26);
 -Selects the "Adjust To" option button and sets the value to 1, but sets the 
width and height values of the "Fit to" option to the correct values of 1 and 
26.  

How can I set the values of the "Fit to" option button as well as set the 
values to what I need?
Comment 1 Yegor Kozlov 2008-05-17 02:48:59 UTC
http://poi.apache.org/hssf/quick-guide.html#FitTo


Regards,
Yegor