You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2003/02/27 13:25:48 UTC

DO NOT REPLY [Bug 17485] New: - adding sheets to existing template results in 2 print jobs

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17485>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=17485

adding sheets to existing template results in 2 print jobs

           Summary: adding sheets to existing template results in 2 print
                    jobs
           Product: POI
           Version: 1.5.1
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: HSSF
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: stephen@basit.com


I'm using 1.5.1
I think there is a problem/bug in starting with a template and adding sheets to 
it.
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.
--Steve
------------------------------------------
 
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 
Documents\\Excel\\Template.xls"));
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");
     wb.write(fileOut);
     fileOut.close();
---------------------