Enhance ExcelWriter functionality with tests, refactoring, and CI updates#14
Merged
Conversation
…ionality; enhance existing tests for async enumerators and limit checks
…o assert exceptions and validate expected results
…actor code for consistency
…tests for shared string deduplication and round-trip validation
- Replaced direct comparisons with Brt.EndSheetData in XlsbReader.Enumerator.cs with a new method IsEndSheetData for clarity. - Improved code maintainability by encapsulating the logic for checking end of sheet data. Enhance BiffRecord and BiffRecordWriter with additional record types - Added constants for new BIFF records in BiffRecord.cs. - Implemented methods to write new BIFF records such as InterfaceHdr, Mms, InterfaceEnd, WriteAccess, and others in BiffRecordWriter.cs. - Updated WriteXf method to handle style and cell XF records more effectively. Update BiffStringEncoder to improve character validation logic - Refactored character validation in BiffStringEncoder.cs to use pattern matching for better readability. Modify OleCompoundWriter to handle directory entries correctly - Changed child references in directory entries to NoStream constant for better clarity in OleCompoundWriter.cs. Revise SharedStringTable to ensure SST records are correctly written - Updated SharedStringTable.cs to write BeginSst and EndSst records around shared string items. Adjust XlsGlobals to include new record writing methods - Enhanced XlsGlobals.cs to write additional records for workbook properties and styles. Refactor XlsSheetWriter and XlsWorkbookWriter for improved structure - Updated XlsSheetWriter.cs to include worksheet view and metadata writing. - Modified XlsWorkbookWriter.cs to ensure proper writing of app properties and relationships. Add tests for new functionality in ExcelWriter - Implemented tests in RealWorldInteropTests.cs and WriterSharedStringTests.cs to validate new record writing and structure. - Ensured that XlsbWriter emits correct record envelopes and handles shared strings appropriately.
…improved readability; enhance WriterSharedStringTests with additional assertions for record lengths
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #14 +/- ##
==========================================
+ Coverage 85.99% 90.99% +5.00%
==========================================
Files 60 61 +1
Lines 3862 4166 +304
Branches 692 710 +18
==========================================
+ Hits 3321 3791 +470
+ Misses 382 224 -158
+ Partials 159 151 -8 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Benchmark ResultsMeasured on ExcelReader.Benchmarks.ParseBenchmark
ExcelReader.Benchmarks.ReadBenchmark
ExcelReader.Benchmarks.WriteBenchmark
ExcelReader.Benchmarks.XlsReadBenchmark
ExcelReader.Benchmarks.XlsWriteBenchmark
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements and optimizations across the codebase, focusing on enhanced memory efficiency, code modernization, and updated documentation. The most significant updates include improved memory usage in the OLE compound file reader, modernized C# syntax, and expanded documentation for shared strings support in XLSX/XLSB writers. Additionally, the CI workflow is updated to include the
developbranch, and minor bug fixes and code cleanups are applied.Memory and performance optimizations:
src/ExcelReader.Core/Reader/XlsCompoundFile.cs: Refactored to use stack allocation and pooled arrays for buffers, reducing heap allocations and improving performance. Methods now use spans and array pools for more efficient memory management. [1] [2] [3] [4] [5] [6] [7] [8] [9]src/ExcelReader.Core/Parser/Internal/RowProjector.cs: Changed_seenfrom nullable to non-nullable, initialized it with an empty array, and removed unnecessary null checks, simplifying logic and reducing allocations. [1] [2] [3] [4] [5] [6]Documentation updates:
README.md: Updated benchmark results for .NET 10.0.9 (SDK 11.0.100-preview.4), added documentation for opt-in shared strings in XLSX/XLSB writers, and clarified performance comparisons. [1] [2] [3] [4]Code modernization and bug fixes:
src/ExcelReader.Core/Parser/HeaderNormalization.cs: ReplacedToArray()with the modern C# range operator for improved clarity and performance.src/ExcelReader.Core/Parser/Internal/ColumnParserFactory.cs: Simplified variable declaration in parsing logic.CI workflow improvements:
.github/workflows/ci.yml: CI now runs on bothmasteranddevelopbranches, ensuring better coverage for in-progress work.Maintenance and extensibility:
src/ExcelReader.Core/Reader/Brt.cs: Added missing BIFF12 record constants, improving maintainability and future extensibility for XLSB support.