Skip to content

Patches from poi 3.17#1557

Merged
tonyqus merged 8 commits into
nissl-lab:masterfrom
antony-liu:poi/v3.17-patch5
May 28, 2025
Merged

Patches from poi 3.17#1557
tonyqus merged 8 commits into
nissl-lab:masterfrom
antony-liu:poi/v3.17-patch5

Conversation

@antony-liu
Copy link
Copy Markdown
Collaborator

Main changes:

  • bug 58325: enable TestXSSFShape unit tests.
  • XSSFTable should format numeric/date cells when used as Column Header names as Excel does.
  • Don't report data table master cells as formula cells, since POI doesn't evaluate data table formulas.

@tonyqus tonyqus added this to the NPOI 2.7.4 milestone May 14, 2025
@tonyqus tonyqus requested a review from Copilot May 24, 2025 02:45
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR applies patches from POI 3.17 to enable previously ignored tests, improve table header formatting for numeric and date values, and prevent data table master cells from being treated as formulas.

  • Replaced SetCellReferences(...) calls with a new CellReferences property and added comprehensive unit tests for typed and numeric table headers.
  • Removed legacy bug-58325 shape tests, updated table creation to set the CT_Table id, and enhanced XSSFTable to support dynamic column addition.
  • Excluded data table formula types from formula detection in cells and refined drawing parsing to include all anchor types.

Reviewed Changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
testcases/ooxml/XSSF/UserModel/TestXSSFTable.cs Switched to CellReferences property, added TestDifferentHeaderTypes and TestNumericCellsInTable tests
testcases/ooxml/XSSF/UserModel/TestUnfixedBugs.cs Removed obsolete test58325_* methods
ooxml/XSSF/UserModel/XSSFTable.cs Added AddColumn, CellReferences property, and enriched UpdateHeaders to use DataFormatter
ooxml/XSSF/UserModel/XSSFSheet.cs Set the internal CT_Table id when creating a table
ooxml/XSSF/UserModel/XSSFCell.cs Updated IsFormulaCell to ignore dataTable formulas
OpenXmlFormats/Spreadsheet/Sheet/CT_Table.cs Added GetTableColumnArray and AddNewTableColumn support
OpenXmlFormats/Drawing/SpreadsheetDrawing.cs Refined XPath in Parse to include all anchor types (oneCellAnchor, twoCellAnchor, absCellAnchor)
Comments suppressed due to low confidence (1)

ooxml/XSSF/UserModel/XSSFTable.cs:245

  • [nitpick] The method name AddColumn may be confusing alongside CreateColumn. Consider renaming it (e.g., InsertColumn) or updating documentation to clarify its purpose and return value.
public void AddColumn()

Comment thread testcases/ooxml/XSSF/UserModel/TestXSSFTable.cs
Comment thread OpenXmlFormats/Drawing/SpreadsheetDrawing.cs
@antony-liu
Copy link
Copy Markdown
Collaborator Author

Fix according to Copilot reviews.

ClassicAssert.AreEqual("34.56", t.GetCTTable().tableColumns.GetTableColumnArray(1).name);
ClassicAssert.AreEqual("ABCD", t.GetCTTable().tableColumns.GetTableColumnArray(2).name);
// Done
wb.Close();
Copy link
Copy Markdown
Member

@tonyqus tonyqus May 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can apply using to IWorkbook object. No need to close it by yourself

@tonyqus
Copy link
Copy Markdown
Member

tonyqus commented May 28, 2025

LGTM

@tonyqus tonyqus merged commit 9dcce24 into nissl-lab:master May 28, 2025
1 of 3 checks passed
@antony-liu antony-liu deleted the poi/v3.17-patch5 branch June 30, 2025 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants