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]

Reply via email to