poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From MSB <markbrd...@tiscali.co.uk>
Subject Re: DO NOT REPLY [Bug 48707] New: Excel: Custom Paper size (height/Width)
Date Tue, 09 Feb 2010 13:44:30 GMT

Do not take this as being the final word on the topic but I think you will be
doomed to search fruitlessly for this option. I have just had a look in
Excel and it does not offer the ability to set a custom paper size that
would allow me to specify the height and width of the page. Instead, I am
able to choose from a list of possible paper sizes using a drop down list
and the only customisation I can perform is to modify the margins. As an
initial suggestion, you could try to find a page size in the list that
exceeds your size requirement and then adjust the margin widths/heights
accordingly if this is possible (I suspect you will need to add this option
to the list of paper sizes defined in the PrintSetup class). Further, I
suspect that these limitations may even be the result of the printer and or
driver I am using; if it is not able to support this feature then Excel
cannot. I suspect that you will have to hack the API and create a custom
paper size but I cannot say whether this will work or not because your
printer/driver may not support this option at all.

Finally, I would like to point out that the setFitWidth() and setFitHeight()
methods may not function as you expect; I am assuming you want to use then
to set the width and height of the page. The javadocs say that both indicate
how many pages the worksheet should be fitted onto. So, in your example, you
are asking that the full width of your sheet be fitted onto one page width
and the full height be spread across 999 pages.

As I said, do not take this as the definitive answer as I am not a developer
of the API simply someone who uses it.

Yours

Mark B

PS Have you tried using a template at all? If you are able to find the
option in Excel to set the page size explicitly as you require then do so
and save the workbook away. Open that workbook using POI and populate the
sheets then save it away again. Now, when you open it with Excel, the page
size setting ought to be preserved.


Bugzilla from bugzilla@apache.org wrote:
> 
> https://issues.apache.org/bugzilla/show_bug.cgi?id=48707
> 
>            Summary: Excel: Custom Paper size (height/Width)
>            Product: POI
>            Version: unspecified
>           Platform: All
>         OS/Version: All
>             Status: NEW
>           Severity: major
>           Priority: P2
>          Component: HSSF
>         AssignedTo: dev@poi.apache.org
>         ReportedBy: tariq.zubairy@gmail.com
> 
> 
> 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...)
> 
> -- 
> Configure bugmail:
> https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
> ------- You are receiving this mail because: -------
> You are the assignee for the bug.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
> For additional commands, e-mail: dev-help@poi.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/DO-NOT-REPLY--Bug-48707--New%3A-Excel%3A-Custom-Paper-size-%28height-Width%29-tp27511464p27515376.html
Sent from the POI - Dev mailing list archive at Nabble.com.


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


Mime
View raw message