Added API for editing a worksheet's properties#949
Added API for editing a worksheet's properties#949michelebastione merged 4 commits intomini-software:masterfrom
Conversation
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.
|
/gemini review |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Introduces the
AlterWorksheetAsyncmethod to theOpenXmlExporter'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