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 46953] New: Incorrect HSSFWorkbook.getNumberOfSheets() and corrupt Excel file
Date Thu, 02 Apr 2009 15:19:40 GMT

Are you simply using HSSF to copy an existing spreadsheet file as your code
suggests? This morning, I downloaded the 'problem.output.xls' file and like
you could not open it using Excel but, and this was interesting, I could
using Calc - part of the OpenOffice.org suite - without any trouble at all
so it's filter recognised the file as a 'valid' one, though it would be
silly to read too much into this of course. Once I opened the file, all I
found were a number of blank sheets and a few macros.

Can I ask a few questions? How is the original spreadsheet file generated?
Is that file the problem.xls that you use to instantiate the FileInputStream
in the example below? Is it possible for you to post this file - the one
that you CAN open successfully using Excel - also so that I can perform a
similar operation to yourself? Are there any 'interesting' features, are the
worksheets hidden for example?


Bugzilla from bugzilla@apache.org wrote:
> 
> https://issues.apache.org/bugzilla/show_bug.cgi?id=46953
> 
>            Summary: Incorrect HSSFWorkbook.getNumberOfSheets() and corrupt
>                     Excel file
>            Product: POI
>            Version: 3.5-dev
>           Platform: PC
>         OS/Version: Windows XP
>             Status: NEW
>           Severity: major
>           Priority: P2
>          Component: HSSF
>         AssignedTo: dev@poi.apache.org
>         ReportedBy: matthew.knl@gmail.com
> 
> 
> Created an attachment (id=23435)
>  --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23435)
> problem.xls
> 
> I use following codes to read attached "problem.xls" Excel file, the Excel
> file
> contains 5 worksheets but HSSFWorkbook.getNumberOfSheets() output 1 only.
> And
> write the workbook out, it cannot be opened by MS Excel.
> 
> --
> 
> FileInputStream fis = new FileInputStream("problem.xls");
> POIFSFileSystem poifs = new POIFSFileSystem(fis);
> HSSFWorkbook wb = new HSSFWorkbook(poifs);        
> System.out.println("wb.getNumberOfSheets() = " + wb.getNumberOfSheets());
> FileOutputStream os = new FileOutputStream("problem.output.xls");
> wb.write(os);
> 
> -- 
> 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://www.nabble.com/DO-NOT-REPLY--Bug-46953--New%3A-Incorrect-HSSFWorkbook.getNumberOfSheets%28%29-and-corrupt-Excel-file-tp22841306p22850048.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