You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2019/03/04 11:24:05 UTC

[Bug 62711] Calling shiftRows corrupts file in POI 4.0

https://bz.apache.org/bugzilla/show_bug.cgi?id=62711

--- Comment #4 from jesper Jørgensen <Je...@kofax.com> ---
It seem that in XSSFRow:

    protected void shift(int n) {
        int rownum = getRowNum() + n;
        String msg = "Row[rownum=" + getRowNum() + "] contains cell(s) included
in a multi-cell array formula. " +
                "You cannot change part of an array.";
        for(Cell c : this){
            ((XSSFCell)c).updateCellReferencesForShifting(msg);
          }
        setRowNum(rownum);
    }

the setRowNum(rownum) is called after the updateCellReferencesForShifting and
this causes the cells to have a reference to the old row number and this is
what Excel is complaining about. This means that the row might have a row
number 5 but the cells could have a cell reference that points to A1. Whether
this is the entire issue I cannot say, but moving the setRowNum call up before
the for loop will create a document the Excel can read and which have the rows
shifted correctly.

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org