Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

HSSFWorkbook . After moving a row down , it fails to copy the row correctly. #1425

Open
1 task done
yoi102 opened this issue Sep 26, 2024 · 1 comment
Open
1 task done
Milestone

Comments

@yoi102
Copy link

yoi102 commented Sep 26, 2024

NPOI Version

2.7.1

File Type

  • XLS

Upload the Excel File

input.xls

Reproduce Steps

string inputFile = "input.xlsx";
IWorkbook workbook;

using (FileStream file = new FileStream(inputFile, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
    workbook = new HSSFWorkbook(file);
    //workbook = new XSSFWorkbook(file);
}


ISheet sheet = workbook.GetSheetAt(0);

sheet.ShiftRows(3, sheet.LastRowNum, 1);
sheet.CopyRow(4, 3);

string outputFile = "output.xlsx";
using (FileStream file = new FileStream(outputFile, FileMode.Create, FileAccess.Write))
{
    workbook.Write(file);
}

Issue Description

After moving a row down, it fails to copy the row correctly, and the output does not match the expected result.

inpuit:

image

output:

image

The output result of XSSFWorkbook is shown in the following image:(Expected result):

image

@yoi102 yoi102 added the bug label Sep 26, 2024
@tonyqus tonyqus added the xls label Oct 3, 2024
@tonyqus tonyqus added this to the NPOI 2.8.0 milestone Oct 3, 2024
@tonyqus
Copy link
Member

tonyqus commented Nov 24, 2024

#1329 contains a fix for row-shifting

@tonyqus tonyqus modified the milestones: NPOI 2.8.0, NPOI 2.7.3 Nov 24, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants