Guys,

Robert Lowe and I were having the same problem. As Robert confirms below,
we narrowed it down to this: In certain cases (which are described below),
calling the overloaded String version setCellValue, but passing in a String
representation of a number caused the spreadsheet to not open in Excel.

- Pat



----------------------



Pat,

I do believe this is related to having strings that look like numbers,
since
I was able to isolate the problem to a particular column with that format.
In my case the strings contain around eight digits and no decimal point. I
don't think your workaround will work for me though since leading zeroes
might be significant.

It does seem to be correlated with the size of the output too--I don't see
this problem with small files.

Best,
Rob


-----Original Message-----
From: Patrick Nolan [mailto:[EMAIL PROTECTED]
Sent: Monday, October 06, 2003 8:30 PM
To: Robert Lowe
Subject: RE: Help! Spreadsheet does not open if one more column is added






Robert,

Yes, I did find a solution. I discovered that passing a number, which has
one decimal place, as a string to the setCellValue causes the problem. What
I did to fix the problem was to convert it to a double and then pass it to
the method, which invokes an overloaded version of the method. If a number
with more than one decimal place is passed as a string it works fine. I
haven't had a chance to log this in the poi bugzilla.

Please let me know if this turns out to be your problem. This will support
my opinion that this is a bug.

Pat





                      "Robert Lowe"
                      <[EMAIL PROTECTED]        To:
<[EMAIL PROTECTED]>
                      m>                       cc:
                                               Subject:  RE: Help!
Spreadsheet does not open if one more column is added
                      10/04/2003 05:06
                      PM






Hi Patrick, did you ever find a solution to this? It sounds quite similar
to
a problem I'm having: spreadsheet with around 30,000 rows, no errors but
Excel 2000 is unable to open the file that is produced.

My workaround so far has been to fall back to the 1.5.1 release--not ideal
as I really need some of the newer features.



Best regards,

Robert Lowe
http://RMLowe.com/



-----Original Message-----
From: Patrick Nolan [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 01, 2003 5:34 AM
To: [EMAIL PROTECTED]
Subject: Help! Spreadsheet does not open if one more column is added






Hi,

Any ideas on what is happening here? I can't figure this one out.. spent 4
hours on it already and no closer to a solution! :(

SPECS:
      POI version: poi-2.0-pre3-20030728.jar
      OS: Solaris

SCENARIO:
      I am building a spreadsheet based on a resultset object. It is quite
a simple implementation. There are 8 columns in the query which will map to
8 columns in the spreadsheet. The spreadsheet is created without any
exceptions thrown. It is < 1meg in size and does not exceed 7k rows. This
is the query: SELECT customername, domaingroupname,username,
dialsvcplanname,
dialserviceplantypename,billingtotal,hourstotal,minutestotal
FROM rep_billing_sum where accountid = '1011'

PROBLEM:
      When I open the spreadsheet in excel, it opens as an empty
spreadsheet. If I take the last column off of the query ("minutestotal"),
the spreadsheet saves as expected and opens fine in excel. This field is a
simple NUMBER field in Oracle. The two previous fields are also the same
type. I redirected the output of the full query to a text file and
everything is written fine, including output of the last column.

CODE:

this.rsmd = newRset.getMetaData();
this.columnCount = (short)rsmd.getColumnCount();
this.rset = newRset;
HSSFSheet sheet = wb.createSheet("new sheet");
HSSFRow row;
HSSFCell cell;
HSSFCellStyle style;
HSSFDataFormat format = wb.createDataFormat();
style = wb.createCellStyle();
style.setDataFormat((short)0);//just general format for test
while (rset.next()) {
      // create the row.
      row = sheet.createRow(index++);
      for (short i = 0; i < columnCount; i++) {
            cell = row.createCell(i);
            cell.setCellValue(rset.getString(i+1));
            cell.setCellStyle(style);
      }
}
// the spreadsheet gets written as a file down here


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





                                                                                       
                                          
                      "Avik Sengupta"                                                  
                                          
                      <[EMAIL PROTECTED]        To:       POI Users List <[EMAIL 
PROTECTED]>, "Poi-User (E-mail)"       
                      ellix.com>                <[EMAIL PROTECTED]>,                   
                                
                                               cc:                                     
                                          
                      10/07/2003 10:44         Subject:  Re: HSSF Workbook not opening 
in MS Excel                               
                      AM                                                               
                                          
                      Please respond to                                                
                                          
                      "POI Users List"                                                 
                                          
                                                                                       
                                          
                                                                                       
                                          




Which version are you using? There was a bug wherein the file would get
corrupted if more than a particular number of unique strings were there in
the sheet. This bug has been fixed in current CVS, if you want to try that
out.

Or it could be a similar but different bug.. in which case its down to
reading hex dumps again :(

You say its the same data ... are you sure its *exactly* the same data? If
it is, then its a big bug... I dont think it would be memory issue while
generating.. not if you are able to consistently replicate the error.

Regards
-
Avik


   -------Original Message-------
   &gt; From: Singh, Arshi (Indsys) &lt;[EMAIL PROTECTED]&gt;
   &gt; Subject: HSSF Workbook not opening in MS Excel
   &gt; Sent: 07 Oct 2003 13:26:44
   &gt;
   &gt;  Hi All,
   &gt;
   &gt;  I am creating a workbook with 27 tabs (sheets), using poi, hssf.
   &gt;
   &gt;  I had successfully done it earlier and opened that workbook in
MSExcel. Now due to some mysterious reason when i create a workbook for the
same data, it does not open in MSExcel. The size of workbook is also
slightly more...575 kb (earlier 566 kb).
   &gt;
   &gt;  I fail to understand the reason for this. If i try to open the
workbook that i had generated earlier, it opens perfectly with 27 tabs. But
this new workbook having same data fails to open. It just flashes the
MSExcel with no document on it.
   &gt;
   &gt;  Could this be due to some memory problem while generating the
workbook repeatedly. Kindly help me to detect the problem. I did not make
any changes in code since then, but all of a sudden this problem starting
coming.
   &gt;
   &gt;  Regards,
   &gt;  Arshi
   &gt;  g  GE Industrial Systems
   &gt;  ________________________________________
   &gt;
   &gt;  Arshi Singh
   &gt;  GE-IBC, Datawarehousing
   &gt;  GE Industrial Systems
   &gt;  Center Point, HUDA Lane
   &gt;  Begumpet, Secunderabad 500 003
   &gt;
   &gt;  email:  [EMAIL PROTECTED]
   &gt;  Tel:  91-40-27881480 (D), 1800
   -------Original Message-------






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to