Hi,
I've been given some code that populates a set of XMLBeans classes from an
excel spreadsheet and returns an XMLBeans document to the caller. However, when
I increase the size of the spreadsheet the performance of the code is aweful.
I've managed to pinpoint the performance problems to the point at which the
code marshals the value of each cell into its designated XMLBeans variable. I'm
wondering if anyone more experience can suggest some performance improvements.
The specific section of code in question is as follows:
Object[][] values = (Object[][])range.getValue();
ExcelDocument doc=ExcelDocument.Factory.newInstance();
excelElement=doc.addNewExcel();
ExcelDocument.Excel.Cells cells=excelElement.addNewCells();
for(int i = 0; i < values.length; i++) {
ExcelDocument.Excel.Row row=excelElement.addNewRow();
String rowNumber=""+(i+1);
row.setRowNumber(new java.math.BigDecimal(i+1));
row.setRowID(padRowNumber(rowNumber));
for(int j = 0; j < values[i].length; j++) {
ExcelDocument.Excel.Row.Col col=row.addNewCol();
String colName=convertColumnName(j+1);
col.setColumnName(colName);
col.setColumnID(padColumnName(colName));
ExcelDocument.Excel.Cells.Cell cell=cells.addNewCell();
cell.setCellID(padColumnName(colName)+":"+padRowNumber(rowNumber));
if(values[i][j] != null){
col.setStringValue( (values[i][j]).toString() );
cell.setStringValue( (values[i][j]).toString() );
}
}
The 2D Object array, values, is the the variable that holds the data (in the
form [row][column]) that has been extracted from the excel spreadsheet.
Thanks,
Adam Flynn.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]