ronfrancis
Joined: Fri Aug 03, 2007 1:22 pm Posts: 1
|
-:
I get this exception while writing out an excel file.
java.lang.-: 8000
at EasyXLS.Util.Conversion.ByteConversion.add_cch_rgch_string(SourceFile:1916)
at EasyXLS.BIFF_Records.l.a(SourceFile:125)
at EasyXLS.ExcelDocument.d(SourceFile:18658)
at EasyXLS.ExcelDocument.easy_WriteExcelFile(SourceFile:15745)
at EasyXLS.ExcelDocument.easy_WriteExcelFile(SourceFile:15412)
at Tutorial2.main(Tutorial2.java:91)
The code is attached below-it is a modification of your examples running against an ORACLE database.
ExcelDocument xls = new ExcelDocument();
Connection sqlConnection = createConnection();
ResultSet rs = null;
String query = " select * from ( select row_.*, rownum rownum_ from ( SELECT /*+index ( person INDX_PERSON_LAST_NAME)*/ NVL(last_name,' ')," +
" NVL(first_name,' '), NVL(general_status,' '),NVL(BAND,' ') FROM person where last_name is not null order by last_name ) " +
"row_ where rownum <= 5000) where rownum_ >0";
System.err.println(query);
PreparedStatement stmt = sqlConnection.prepareStatement(query);
/*stmt.setObject(1, new Long(20));
stmt.setObject(2,new Long(10));*/
rs = stmt.executeQuery(query);
// Create an instance of the object used to format the cells.
ExcelAutoFormat xlsAutoFormat = new ExcelAutoFormat();
// Set the style of the header
ExcelStyle xlsHeaderStyle = new ExcelStyle(new Color(144, 238, 144));
xlsHeaderStyle.setFontSize(12);
xlsAutoFormat.setHeaderRowStyle(xlsHeaderStyle);
long start = System.currentTimeMillis();
System.out.println("Writing file C:\\Trash\\Tutorial2.xls.");
xls.easy_addWorksheet("SourceData");
ExcelTable xlsTable1 = ((ExcelWorksheet)xls.easy_getSheet("SourceData")).easy_getExcelTable();
xlsTable1.easy_getCell(0, 0).setValue("Show Date");
xlsTable1.easy_getCell(0, 1).setValue("Available Places");
xlsTable1.easy_getCell(0, 2).setValue("Available -");
xlsTable1.easy_getCell(0, 3).setValue("BAND");
int row =1;
while(rs.next()){
xlsTable1.easy_getCell(row,0).setValue(rs.getObject(1).toString());
xlsTable1.easy_getCell(row,1).setValue(rs.getObject(2).toString());
xlsTable1.easy_getCell(row,2).setValue(rs.getObject(3).toString());
xlsTable1.easy_getCell(row,3).setValue(rs.getObject(4).toString());
row++;
}
// Generate the file
xls.easy_WriteExcelFile("c:\\Trash\\Tutorial2.xls");
//xls.easy_WriteExcelFile_FromResultSet("c:\\Trash\\Tutorial2.xls", rs, xlsAutoFormat, "Sheet1");
// Confirm generation
if (xls.easy_getError() == "")
System.out.println("File successfully created."+(System.currentTimeMillis()-start)/1000 + " secs");
else
System.out.println("Error encountered: " + xls.easy_getError());
// Close the database connection.
sqlConnection.close();
// Dispose memory
xls.Dispose();
} catch (Exception ex) {
ex.printStackTrace();
if(ex.getCause()!=null) {
ex.getCause().printStackTrace();
}
}
|
daniela
Joined: Fri Feb 03, 2006 12:23 pm Posts: 199 Location: Brasov, Romania
|
The defect occurred for EasyXLS version 6.0 and was fixed in version 6.1. If you purchased a Professional or Writer version, you can request a patch. If you are using a trial, EasyXLS Trial 6.1 will be released in a couple of weeks.
|