It turns out the problem was a bit more complicated. When I moved my
project from version 1.5 to 1.8, none of my spreadsheets would open in
Excel.
I tracked the problem to the fact that I was repeatedly defining the same
row in a spreadsheet as follows:
HSSFCell c;
HSSFRow r = sheet.createRow(1);
c = r.createCell((short)0);
c.setCellValue("x");
HSSFRow r = sheet.createRow(1);
c = r.createCell((short)1);
c.setCellValue("x");
This never generated any problems in 1.5, but it did in 1.8. The problems
were so extreme in 1.8 that MS Excel couldn't even repair the file. After I
went through my objects and fixed this problem, everything worked fine.
Apparently, I missed one of these cases in the first sheet of my workbook,
and while Excel didn't report any errors, each sheet after this bad sheet
had the problem with the print settings. (If I moved the sheet to the 4th
location in the workbook, sheets 1-4 were fine and 5-10 were bad.) Once I
fixed this problem, everything ran fine.
Thanks for your help.
Brian Glick
Freightek, Inc.
(215) 887-6100
[EMAIL PROTECTED]
-----Original Message-----
From: Laubach Shawn Contr OC-ALC/PSB [mailto:Shawn.Laubach@;tinker.af.mil]
Sent: Thursday, October 24, 2002 9:42 AM
To: 'POI Users List'
Subject: RE: setPageWidth not working on all pages in Workbook
I wrote a simple test that created 11 sheets and called your function for
each one. When I opened the resulting file, all values were set properly
for each sheet. Would it be possible to get the smallest test program and
example spreadsheet that recreated this.
Shawn
-----Original Message-----
From: Brian Glick [mailto:B.Glick@;Freightek.com]
Sent: Thursday, October 24, 2002 8:06 AM
To: [EMAIL PROTECTED]
Subject: setPageWidth not working on all pages in Workbook
I am trying to create a workbook with 10 sheets. Before writing the
workbook, I run the following method on each sheet:
static void printFormat(HSSFSheet sht)
{
//format sheet
HSSFPrintSetup pSetup = sht.getPrintSetup();
sht.setAutobreaks(true);
pSetup.setFitWidth((short)1);
pSetup.setFitHeight((short)0);
pSetup.setLandscape(true);
}
When I open the workbook in Excel and look at Page Setup, all sheets have
the correct Fit to Page settings, but only the first page has the "Fit to:"
radio button selected. All other pages are still set to "Adjust to:".
Therefore only my first page is printing correctly.
When I use BiffViewer all of the pages have the same values in the [WSBOOL]
and [PRINTSETUP] sections, which are included below.
(All of the pages are correctly formatted for landscape.)
What am I doing wrong? Thanks in advance for any help.
Brian Glick
Freightek, Inc.
(215) 887-6100
[EMAIL PROTECTED]
[WSBOOL]
.wsbool1 = 5
.autobreaks = true
.dialog = false
.rowsumsbelw= false
.rowsumsrigt= false
.wsbool2 = ffffffc1
.fittopage = true
.displayguts= false
.alternateex= true
.alternatefo= true
[/WSBOOL]
[PRINTSETUP]
.papersize = 1
.scale = 100
.pagestart = 1
.fitwidth = 1
.fitheight = 0
.options = 0
.ltor = false
.landscape = false
.valid = false
.mono = false
.draft = false
.notes = false
.noOrientat = false
.usepage = false
.hresolution = 300
.vresolution = 300
.headermargin = 0.5
.footermargin = 0.5
.copies = 0
[/PRINTSETUP]
--
To unsubscribe, e-mail: <mailto:poi-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:poi-user-help@;jakarta.apache.org>
--
To unsubscribe, e-mail: <mailto:poi-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:poi-user-help@;jakarta.apache.org>
--
To unsubscribe, e-mail: <mailto:poi-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:poi-user-help@;jakarta.apache.org>