Page 1 of 1

add more rows to xlsx

PostPosted: Wed Mar 09, 2016 11:15 pm
by Hunyady
I am new in docx4j xlsx; How can I add more than one rows to a Sheet ?
My code makes only one row (the last one):

Row row = Context.getsmlObjectFactory().createRow();
row.setHt(66.0);
row.setCustomHeight(Boolean.TRUE);
row.setR(1L);
Cell cell1 = Context.getsmlObjectFactory().createCell();
cell1.setV("1234");
row.getC().add(cell1);
Cell cell2 = Context.getsmlObjectFactory().createCell();
cell2.setV("56");
row.getC().add(cell2);

Row row2 = Context.getsmlObjectFactory().createRow();
row2.setHt(33.0);
row2.setCustomHeight(Boolean.TRUE);
row2.setR(1L);
cell1 = Context.getsmlObjectFactory().createCell();
cell1.setV("5678");
row2.getC().add(cell1);
cell2 = Context.getsmlObjectFactory().createCell();
cell2.setV("910");
row2.getC().add(cell2);

sheetData.getRow().add(row);
sheetData.getRow().add(row2);

thank's
Laszlo Hunyady