Skip to content

feature: support multi-rows loop filling and merge strategies - #842

Open
bengbengbalabalabeng wants to merge 22 commits into
apache:mainfrom
bengbengbalabalabeng:feature-issues-836
Open

feature: support multi-rows loop filling and merge strategies#842
bengbengbalabalabeng wants to merge 22 commits into
apache:mainfrom
bengbengbalabalabeng:feature-issues-836

Conversation

@bengbengbalabalabeng

@bengbengbalabalabeng bengbengbalabalabeng commented Feb 1, 2026

Copy link
Copy Markdown
Contributor

Purpose of the pull request

Related: #836

What's changed?

1. Support multi-rows loop filling.

Refactor row shifting logic in ExcelWriteFillExecutor. Updated shiftRows and doFill to correctly handle row offsets when a loop item spans multiple rows.

2. Add FillMergeStrategy to handling merge across rows and columns.

Implemented through the addMergedRegionIfNecessary method, which replicates the merge structure defined in the template row and applies it to each generated data row.

Implemented through the addMergedRegionIfNecessary method, which replicates only the merged regions that intersect cells containing template variables. Merged regions in the template row that do not cover any placeholder cells are intentionally not replicated.

See the API Usage Example for usage examples.

Checklist

  • I have read the Contributor Guide.
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

@bengbengbalabalabeng

Copy link
Copy Markdown
Contributor Author

@delei PTAL :)

@alaahong
alaahong requested a review from Copilot February 21, 2026 06:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds support for multi-row loop filling and introduces configurable merged-region replication during vertical list filling, with accompanying docs and regression tests.

Changes:

  • Refactors ExcelWriteFillExecutor to account for multi-row “rowSpan” when shifting rows and advancing write positions during loop fills.
  • Introduces FillMergeStrategy + FillConfig.mergeStrategy to control automatic merge replication (and optional merged-cell style unification).
  • Adds docs (EN + zh-CN) and a comprehensive integration test suite with new/updated fill templates.

Reviewed changes

Copilot reviewed 7 out of 31 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
website/i18n/zh-cn/docusaurus-plugin-content-docs/current/sheet/fill/fill.md Adds zh-CN documentation for merge strategies and multi-row loop filling examples.
website/docs/sheet/fill/fill.md Adds EN documentation for merge strategies and multi-row loop filling examples.
fesod-sheet/src/main/java/org/apache/fesod/sheet/write/metadata/fill/FillConfig.java Adds mergeStrategy to fill configuration with defaults + validation.
fesod-sheet/src/main/java/org/apache/fesod/sheet/write/executor/ExcelWriteFillExecutor.java Implements multi-row row-span advancing + merge replication and merged-style unification.
fesod-sheet/src/main/java/org/apache/fesod/sheet/enums/FillMergeStrategy.java New enum defining merge handling strategies for loop fills.
fesod-sheet/src/test/java/org/apache/fesod/sheet/fill/LoopRowFillingMergeTest.java New end-to-end tests covering multi-row fill + merge strategies for xls/xlsx and combined fill.
fesod-sheet/src/test/java/org/apache/fesod/sheet/fill/LoopRowFillingMergeModel.java Test model for multi-row fill cases.
fesod-sheet/src/test/resources/fill/case_a_07.xlsx Template for base multi-row loop fill (.xlsx).
fesod-sheet/src/test/resources/fill/case_b_07.xlsx Template for AUTO merge strategy (.xlsx).
fesod-sheet/src/test/resources/fill/case_c_07.xlsx Template for MERGE_CELL_STYLE strategy (.xlsx).
fesod-sheet/src/test/resources/fill/case_d_07.xlsx Template for combined list+common base fill (.xlsx).
fesod-sheet/src/test/resources/fill/case_e_07.xlsx Template for combined list+common fill with AUTO merge (.xlsx).
fesod-sheet/src/test/resources/fill/case_f_07.xlsx Template for combined list+common fill with MERGE_CELL_STYLE (.xlsx).
fesod-sheet/src/test/resources/fill/case_a_03.xls Template for base multi-row loop fill (.xls).
fesod-sheet/src/test/resources/fill/case_b_03.xls Template for AUTO merge strategy (.xls).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread website/docs/sheet/fill/fill.md
Comment thread fesod-sheet/src/main/java/org/apache/fesod/sheet/enums/FillMergeStrategy.java Outdated
@bengbengbalabalabeng

Copy link
Copy Markdown
Contributor Author

@delei PTAL :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants