Bug 17485 - adding sheets to existing template results in 2 print jobs
Summary: adding sheets to existing template results in 2 print jobs
Alias: None
Product: POI
Classification: Unclassified
Component: HSSF (show other bugs)
Version: 3.0-dev
Hardware: PC All
: P3 major (vote)
Target Milestone: ---
Assignee: POI Developers List
Depends on:
Reported: 2003-02-27 12:25 UTC by Stephen
Modified: 2009-02-18 09:18 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Stephen 2003-02-27 12:25:48 UTC
I'm using 1.5.1
I think there is a problem/bug in starting with a template and adding sheets to 
Symptoms: When printing the resulting file, two separate print jobs are created.
THE PROBLEM IS:  When I open the file in Excel and print it, two separate
jobs are output to the printer. The first job contains sheet 0, and the second
job contains all the other sheets.  When I do Print in Excel and look at
the Print Preview, it looks correct.  And, when I do Print in Excel the
popup page count window shows that I'm printing 3 pages. Evidently, there
is some character in the stream that my print company's print job control 
system is interpreting as a "job separator".
A guess that a workaround would be to create a template with the extra
blank sheets that I may need, and delete the ones that I don't use.
Note: My template file does not contain graphics.
In Excel, I create an excel .xls file with one worksheet and save it, to be 
used as a template.
In POI API, I do:
POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream("C:\\My 
HSSFWorkbook wb = new HSSFWorkbook(fs);
I "get" the first sheet
HSSFSheet coverSheet = wb.getSheetAt(0);
and then I modify it by adding stuff to it.
Then, I add more sheets to the HSSFWorkbook wb, like this:
HSSFSheet summarySheet = wb.createSheet();
wb.setSheetName(1, "Summary");
addSheetTitle(summarySheet, "Summary");
I then write it out:
     FileOutputStream fileOut = new FileOutputStream("PlanningReport.xls");
Comment 1 Andy Oliver 2003-07-24 15:52:03 UTC
weird but too minor to hold up 2.0 -- put off till 3.0
Comment 2 Jason Height 2004-10-15 04:45:47 UTC
Any chance of the template being attached to this bug report. You already have
the code there.

Comment 3 Yegor Kozlov 2008-12-29 09:38:45 UTC
Try the latest POI-3.5-beta4. If the problem persists, re-open this bug and
attach the problem file and sample code to reproduce it.

Comment 4 David Fisher 2009-02-18 09:18:20 UTC
This bug was against the ancient 1.5.1.

If there is still trouble with 3.5 the OP or someone else can certainly submit a real example.