Bug 51643

Summary: XWPFTable.createRow() uses first row as a template
Product: POI Reporter: Dmitry Kochelaev <dkochelaev>
Component: XWPFAssignee: POI Developers List <dev>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: 3.8-dev   
Target Milestone: ---   
Hardware: All   
OS: All   

Description Dmitry Kochelaev 2011-08-10 09:11:47 UTC
Currently createRow method of XWPFTableRow uses first row as template (number of columns). This looks to be a bit confusing when adding a new row in table, since it is not like previous one.

I suggest to apply following modification to XWPFTables class -- columns' number is taken from last row and not from the first one.

    public XWPFTableRow createRow() {
        int sizeCol = ctTbl.sizeOfTrArray() > 0 ? ctTbl.getTrArray(ctTbl.sizeOfTrArray() - 1).sizeOfTcArray() : 0;
        ...
    }