3
I have a class to read an xls in java, and I need to know how to print a column next to each other as well as in xls itself. So far I’ve only been able to print in a race or single line.
NOTE: I am using jxl library.
Follows the code:
Workbook workbook = Workbook.getWorkbook( new File( "C:\\Users\\lm\\Desktop\\planilha.xls" ));
Sheet sheet = workbook.getSheet( 0 );
int rows = sheet.getRows();
int columns = sheet.getColumns();
for ( int i = 0; i < columns; i++ )
{
for ( int j = 0; j < rows; j++ )
{
Cell cell = sheet.getCell( i , j );
System.out.println( cell.getContents() );
}
}
workbook.close();
That is, you can read all the XLS data and are only having difficulty organizing it on
System.out.println
?– Victor Stafusa
Hi Victor ! That’s right, so that it is structured as if it were the spreadsheet itself. I thought within the looping create a Cell type variable for each column and concatenate, but there are many columns and I would like to use for more than one sheet this scope.
– Luís Felipe Dal Molin