poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christian Gosch" <c.go...@inovex.de>
Subject Q: Print setup: Managing print scale and fitToPage/width/height
Date Tue, 27 Sep 2005 09:40:34 GMT
Hi,

how can I achieve reliable scaling / fit-to-page/width/height for print out
using POI?

We use poi-2.5.1-final-20040804.jar to produce Excel sheets for download by
a servlet. For us it is important to construct a proper print setup, since
customers expect that they can choose between "fixed scaling: 75%" and "fit
to 1 page in width, no limit for height". POI 2.5.1 final offers some
settings for this as part of HSSFSheet and HSSFSheet.PrintSetup, but it
seems not to be possible to "switch off" the "scale by page count" option,
thus making "HSSFSheet.getPrintSetup().setScale(75)" useless.

I tried:
HSSFSheet.setFitToPage(boolean)
HSSFSheet.getPrintSetup().setFitWidth(short)
HSSFSheet.getPrintSetup().setFitHeight(short)
HSSFSheet.getPrintSetup().setScale(short)

I expected
HSSFSheet.setFitToPage(false)  // optionally; does not seem to have any
effect
HSSFSheet.getPrintSetup().setFitWidth((short)0)  // or not present
HSSFSheet.getPrintSetup().setFitHeight((short)0)  // or not present
HSSFSheet.getPrintSetup().setScale((short)75)
to result in a sheet printed with scale=75% and no "page fit" settings at
all, but the "page layout" dialog in Excel2000 tells me, that print scale is
set to 75% and fitWidth / fitHeight are empty, but selected, which makes the
scale setting useless. The result is a print scale of 100%, since the 75%
setting is not recognized by Excel2000.

The other setting ("fit to 1 page in width, no limit in height") is working
as expected with:
HSSFSheet.setFitToPage(true)  // optionally; does not seem to have any
effect
HSSFSheet.getPrintSetup().setFitWidth((short)1)
HSSFSheet.getPrintSetup().setFitHeight((short)0)

How can I get a sheet with 75% print scale?


Regards,
-- 
Dipl.-Inform. Christian Gosch
Systems Development
inovex GmbH
Karlsruher Strasse 71
D-75179 Pforzheim
Tel.: +49 (0)72 31 - 31 91 - 85
Fax: +49 (0)72 31 - 31 91 - 91
mailto:c.gosch@inovex.de
http://www.inovex.de


Mime
View raw message