poi-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 62711] Calling shiftRows corrupts file in POI 4.0
Date Mon, 04 Mar 2019 11:24:05 GMT
https://bz.apache.org/bugzilla/show_bug.cgi?id=62711

--- Comment #4 from jesper Jørgensen <Jesper.Jorgensen@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


Mime
View raw message