Add per-sheet filtering to ExcelToPdfConverter (SheetIndices / SheetNames)#44
Open
Add per-sheet filtering to ExcelToPdfConverter (SheetIndices / SheetNames)#44
Conversation
Co-authored-by: shps951023 <12729184+shps951023@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Complete implementation of task #11
Add per-sheet filtering to ExcelToPdfConverter (SheetIndices / SheetNames)
Feb 24, 2026
There was a problem hiding this comment.
Pull request overview
Adds optional per-sheet filtering to ExcelToPdfConverter so callers can convert only selected sheets instead of always rendering the full workbook.
Changes:
- Added
SheetIndicesandSheetNamestoExcelToPdfConverter.ConversionOptionsand filtered the sheet enumeration accordingly. - Added xUnit tests covering index filtering, name filtering (case-insensitive), precedence, and no-match behavior.
- Documented the new options in the README with usage examples.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/MiniPdf/ExcelToPdfConverter.cs | Adds SheetIndices / SheetNames options and filters sheets before rendering. |
| tests/MiniPdf.Tests/ExcelToPdfConverterTests.cs | Adds multi-sheet XLSX test helper + new tests for sheet filtering and precedence. |
| README.md | Documents multi-sheet selection options and examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ``` | ||
|
|
||
| When both `SheetIndices` and `SheetNames` are specified, `SheetIndices` takes precedence. | ||
| ``` |
There was a problem hiding this comment.
There is an extra stray Markdown code fence after the precedence sentence, which starts a new (unclosed) code block and breaks the README formatting. Remove the trailing ``` on this line (or ensure code fences are correctly paired).
Suggested change
| ``` |
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.
ExcelToPdfConverterhad no way to select a subset of sheets — it always converted every sheet. This adds two mutually-exclusive filter options toConversionOptions.API changes
ExcelToPdfConverter.ConversionOptions— two new optional properties:SheetIndicesIReadOnlyList<int>?SheetNamesIReadOnlyList<string>?SheetIndicestakes precedence when both are set.null/ empty → all sheets (existing default behaviour unchanged).Changes
ExcelToPdfConverter.cs— addedSheetIndices/SheetNamestoConversionOptions;Convert(Stream, ...)filters the sheet list before rendering using aHashSetlookup for O(1) membership tests.ExcelToPdfConverterTests.cs— 4 new tests covering index filtering, name filtering, precedence, and no-match fallback; addedCreateMultiSheetExcelin-memory xlsx helper.README.md— documented the new options with examples.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.