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

http://issues.apache.org/bugzilla/show_bug.cgi?id=40318

           Summary: workbook.getBytes() method not working?
           Product: POI
           Version: 2.5
          Platform: PC
               URL: http://jakarta.apache.org/poi/hssf/quick-
                    guide.html#ReadWriteWorkbook
        OS/Version: Windows XP
            Status: NEW
          Severity: major
          Priority: P2
         Component: HSSF
        AssignedTo: poi-dev@jakarta.apache.org
        ReportedBy: [EMAIL PROTECTED]


The following code doesn't work: 

POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream
( "c:\\workbook1.xls")); 
wb = new HSSFWorkbook(fs); 
FileOutputStream fileOut = new FileOutputStream("c:\\workbook2.xls"); 
byte[] bytes = wb.getBytes(); 
fileOut.write(bytes);
fileOut.close();

Whereas this does: 
 
POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream
( "c:\\workbook1.xls")); 
wb = new HSSFWorkbook(fs); 
FileOutputStream fileOut = new FileOutputStream("c:\\workbook2.xls"); 
wb.write(fileOut);
fileOut.close();

My input file just contains a simple text "Hi" in the 1st cell. 

I have just replaced the line - wb.write(fileOut); 
with the lines -
byte[] bytes = wb.getBytes(); 
fileOut.write(bytes);

I think there is some problem with the wb.getBytes() method.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
Mailing List:    http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/

Reply via email to