Skip to content

Corrupted after calling ShiftRows function to remove the row where the shared formula is defined #1490

@26642523

Description

@26642523

NPOI Version

2.7.2

File Type

  • XLSX

Upload the Excel File

Please attach your original Excel File to help us reproduce the issue

import.xlsx

Reproduce Steps

Create a project, and paste the code below.

static void Main(string[] args)
{
string filename = "import.xlsx";
IWorkbook doc = new XSSFWorkbook(filename);
int insertRow = 2;
var sheet = doc.GetSheetAt(0);

sheet.ShiftRows(insertRow, sheet.LastRowNum, -1);
using (var ms1 = File.OpenWrite("out.xlsx"))
{
    doc.Write(ms1, false);
}
doc.Close();

}

Issue Description

after calling the ShiftRows function, the output file will be corrupted due to the invalid shared formula.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions