You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by "Marx, Stefan ext. MA Fa. Lynx" <St...@rewe.de> on 2005/09/05 10:46:55 UTC

howto print large sheets with fit to page?

Hi list-reader,

fiddling in the area of formatting & printing I ran into
trouble trying to scale some data to page size.
Using the code like

[..]
      // printing optimized
      iSheet.setMargin(HSSFSheet.LeftMargin, 0);
      iSheet.setMargin(HSSFSheet.RightMargin, 0);

      HSSFPrintSetup ps = iSheet.getPrintSetup();

      ps.setLandscape(true);
      iSheet.setAutobreaks(true);
      ps.setPaperSize(HSSFPrintSetup.A4_PAPERSIZE);

      ps.setFitHeight((short) 1);
      ps.setFitWidth((short) 1);
[..]

print out the lines nicely fitting on the page when
I'm in the situation that there are only one page
to print. But as soon as I have to deal with more
data (page counts in the area of 40 or more) the 
setAutobreaks() methode reduces the scaled print 
image to a nearly micros-scopic font size and un-
readble lines.
Looking at the sources of 2.0-pre I get the impres-
sion the constellation with many line more than
one paper size width are spoilling the fit to page
functionality.
Before I start in the direction to make my line fit
by adding wrapping and re-design of my sheets and
all the groupping and summation:

Is there anybody out there who avoid this effect?

Many greetings from Germany, thx for reading, much
more for writting ;=).

cu Stefan

P.S.: I'm using the 2.5.1 final 2004/08/04 version.
--
Tel:	+49-(0)221-149-5953
Fax:	+49-(0)221-149-97-5953
E-Mail:	Stefan.Marxext.MAFa.Lynx@rewe.de
Stefan Marx, M.A.
www.marx-consulting.com


---------------------------------------------------------------------
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/


Re: howto print large sheets with fit to page?

Posted by elnino3800 <lu...@gmail.com>.
Better solution is:

ps.setFitHeight( (short) 0 ); 

//this set in excel scale like a "automatic"

--
View this message in context: http://apache-poi.1045710.n5.nabble.com/howto-print-large-sheets-with-fit-to-page-tp2283001p5032239.html
Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Re: howto print large sheets with fit to page?

Posted by Lior Shliechkorn <li...@yahoo.com>.
Hello Stefan,

I ran into a similar issue where I was crunching a lot
of data into fitting to a page. One thing I found, by
basically seeing how many rows there are per page, is
to divide by the number of rows. So, as an example, a
regular landscape page ( by stating setLandscape(true)
) has about 27 rows. So I wrote the following:

short numberOfPagesDataSpans =
totalNumberOfRowsInDocument / 27;
ps.setFitHeight( numberOfPagesDataSpans );
ps.setFitWidth((short) 1);

So basically, you're saying I want my page to fit in a
landscape size. But I might have 2+ pages of data that
I don't want to squeeze into one page. Therefore, you
find how many pages the data needs to span and still
fit into a single page (width wise). I hope this was
clear. It was a pain in the *** to get this going for
me, but it's a clever way to get it to work. Please
let me know if you find this helpful.

Best Regards,

Lior Shliechkorn


--- "Marx, Stefan ext. MA Fa. Lynx"
<St...@rewe.de> wrote:

> Hi list-reader,
> 
> fiddling in the area of formatting & printing I ran
> into
> trouble trying to scale some data to page size.
> Using the code like
> 
> [..]
>       // printing optimized
>       iSheet.setMargin(HSSFSheet.LeftMargin, 0);
>       iSheet.setMargin(HSSFSheet.RightMargin, 0);
> 
>       HSSFPrintSetup ps = iSheet.getPrintSetup();
> 
>       ps.setLandscape(true);
>       iSheet.setAutobreaks(true);
>       ps.setPaperSize(HSSFPrintSetup.A4_PAPERSIZE);
> 
>       ps.setFitHeight((short) 1);
>       ps.setFitWidth((short) 1);
> [..]
> 
> print out the lines nicely fitting on the page when
> I'm in the situation that there are only one page
> to print. But as soon as I have to deal with more
> data (page counts in the area of 40 or more) the 
> setAutobreaks() methode reduces the scaled print 
> image to a nearly micros-scopic font size and un-
> readble lines.
> Looking at the sources of 2.0-pre I get the impres-
> sion the constellation with many line more than
> one paper size width are spoilling the fit to page
> functionality.
> Before I start in the direction to make my line fit
> by adding wrapping and re-design of my sheets and
> all the groupping and summation:
> 
> Is there anybody out there who avoid this effect?
> 
> Many greetings from Germany, thx for reading, much
> more for writting ;=).
> 
> cu Stefan
> 
> P.S.: I'm using the 2.5.1 final 2004/08/04 version.
> --
> Tel:	+49-(0)221-149-5953
> Fax:	+49-(0)221-149-97-5953
> E-Mail:	Stefan.Marxext.MAFa.Lynx@rewe.de
> Stefan Marx, M.A.
> www.marx-consulting.com
> 
> 
>
---------------------------------------------------------------------
> 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/
> 
> 



	
		
______________________________________________________
Click here to donate to the Hurricane Katrina relief effort.
http://store.yahoo.com/redcross-donate3/

---------------------------------------------------------------------
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/