Page 1 of 1

How to get the Cols?

PostPosted: Thu Jul 16, 2015 4:56 am
by keeferlaic
Hi!

I'm trying to get the cols from the WorksheetPart but i just can't. It always returns a empty list. Do I need also to create the cols and then associate it to the rows (if yes, how?) or i can just add the cells to the rows and then the sheet will understand that there are news cols on the list?

I'm using the example code with the row.getC().add(createCell("hello world!")); inside a for(int i=0; i<2; i++) to insert 2 cells into a row (2 cols).

https://github.com/plutext/docx4j/blob/master/src/samples/xlsx4j/org/xlsx4j/samples/CreateSimpleSpreadsheet.java

My code to get the cols:

Code: Select all
List<Cols> lstCols = sheet.getContents().getCols();


It always return 0 on the lstCols.size() method.

Looking for help :)
THanks