poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Laubach Shawn Contr 327 CSSG/GFSL <Shawn.Laub...@tinker.af.mil>
Subject RE: Excel Sheet - Page Setup trouble ('fit to 1 page wide').
Date Thu, 23 Jun 2005 16:09:37 GMT
The key thing you missed is to add sheet.setAutobreaks(true);

The quick guide gives a nice example of this and many other things:
http://jakarta.apache.org/poi/hssf/quick-guide.html#FitTo

Shawn

-----Original Message-----
From: frederic.ferrant@ing.be [mailto:frederic.ferrant@ing.be] 
Sent: Thursday, June 23, 2005 4:33 AM
To: poi-user@jakarta.apache.org
Subject: Excel Sheet - Page Setup trouble ('fit to 1 page wide').


Hello.

I am having a little trouble generating an XLS file using HPSSF, with the
printing format to be more specific.
The Sheet involved contains a large number of columns, which print on two
pages wide if I try to print them at 100% scale.
In this case, I usually use the 'Fit to <1> page (s) wide by < > page(s)
tall' option in the Excel 'Page Setup' dialog.

Since other users, who don't know the 'fit to page' tip, will use the
generated files, I would like to fix this while generating the sheet in my
java code, but unfortunately it doesn't seem to work.


Here is what I do:
- set the page format (A4) on the sheet
- set the page layout (Horizontal) on the sheet
- set the page margins on the sheet
- create my data rows and columns, and format them
- try to set the 'fit to' by using:
       sheet.getPrintSetup().setFitWidth((short) 1);
- save the file.

Unfortunately, this doesn't seem to be the right way to do it, because when
I open the created file and print it, the page prints on 2 pages wide...

Does anyone have an idea...? Am I missing something here? Or doesn't this
option work...?

Thanks a lot,

Frédéric Ferrant



__________
Disclaimer: This e-mail is intended for the exclusive use by the

person(s) mentioned as recipient(s). This e-mail and its attachments,
if any, contain confidential information and/or information protected
by intellectual property rights or other rights. This e-mail
does not constitute any commitment for ING or its subsidiaries except when
expressly otherwise agreed in a written agreement between the

intended recipient and the originating subsidiaries of ING, sender of
the mail.
If you receive this message by mistake, please, notify the sender

with the "reply" option and delete immediately this e-mail
from your system, and destroy all copies of it. You may not, directly
or indirectly, use, disclose, distribute, print or copy, this e-mail
or any part of it if you are not the intended recipient.
You have to take at any time all necessary measures against viruses.

---------------------------------------------------------------------
To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
Mailing List:     http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta Poi Project:  http://jakarta.apache.org/poi/


Mime
View raw message