Skip to content

Added API for editing a worksheet's properties#949

Merged
michelebastione merged 4 commits intomini-software:masterfrom
michelebastione:alter-sheets-info
Apr 24, 2026
Merged

Added API for editing a worksheet's properties#949
michelebastione merged 4 commits intomini-software:masterfrom
michelebastione:alter-sheets-info

Conversation

@michelebastione
Copy link
Copy Markdown
Collaborator

Introduces the AlterWorksheetAsync method to the OpenXmlExporter's API. The method allows for editing the name, index and visibility state of an existing document's worksheet.

Also adds tests and reduces preprocessor instructions clutter through new polyfills.

Closes #656

Introduces `AlterSheetAsync` methods on `OpenXmlExporter` (path and Stream variants) to rename, reindex, or change visibility of a worksheet, with an internal implementation defined through `OpenXmlWriter.AlterWorksheetAsync`, and adds synchronous and asynchronous unit tests for the various use cases.
@michelebastione
Copy link
Copy Markdown
Collaborator Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new AlterSheet feature to modify worksheet properties such as name, index, and visibility state, supported by new unit tests. It also includes significant refactoring: moving polyfills to a dedicated file, adopting ValueTuples, and converting utility methods into extension methods. Feedback focuses on several incorrect preprocessor directives (e.g., using NET10_0_OR_GREATER for .NET 8 APIs) and regressions in asynchronous execution where simplified framework checks now favor synchronous operations on older .NET Core versions.

Comment thread src/MiniExcel.Core/Helpers/Polyfills.cs
Comment thread src/MiniExcel.OpenXml/FluentMapping/MappingTemplateApplicator.cs
Comment thread src/MiniExcel.OpenXml/OpenXmlWriter.cs
Comment thread src/MiniExcel.OpenXml/OpenXmlReader.cs
Comment thread src/MiniExcel.OpenXml/OpenXmlWriter.cs
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces several enhancements and refactorings to the MiniExcel library, primarily focusing on OpenXml worksheet manipulation and modernizing asynchronous code. Key changes include the addition of AlterSheetAsync to allow renaming, reordering, and changing the visibility of worksheets, as well as the introduction of a Polyfills class to support newer .NET features across different target frameworks. The refactoring also replaces Tuple with C# value tuples and converts XmlReaderHelper methods into extension methods for better readability. Feedback focuses on critical resource management issues in OpenXmlExporter, invalid await using syntax with ConfigureAwait on non-task types, and potential robustness improvements regarding null handling and numeric overflows.

Comment thread src/MiniExcel.OpenXml/Api/OpenXmlExporter.cs
Comment thread src/MiniExcel.OpenXml/FluentMapping/MappingTemplateApplicator.cs
Comment thread src/MiniExcel.Core/Helpers/Polyfills.cs
Comment thread src/MiniExcel.OpenXml/Api/OpenXmlExporter.cs
Comment thread src/MiniExcel.OpenXml/OpenXmlReader.cs
Comment thread src/MiniExcel.OpenXml/OpenXmlReader.cs
@michelebastione michelebastione merged commit 9d2c3f1 into mini-software:master Apr 24, 2026
3 checks passed
@michelebastione michelebastione deleted the alter-sheets-info branch April 24, 2026 23:26
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.

Hide sheets if Data is empty - using template (SaveAsByTemplateAsync)

1 participant