Allow user-defined table and sheet names, flexible table positioning#117
Merged
myk93 merged 16 commits intomicrosoft:mainfrom Aug 12, 2025
Merged
Allow user-defined table and sheet names, flexible table positioning#117myk93 merged 16 commits intomicrosoft:mainfrom
myk93 merged 16 commits intomicrosoft:mainfrom
Conversation
…the sheet, and dosent force the table to be at A1
alenviner1
reviewed
Apr 29, 2025
alnasar12
approved these changes
May 15, 2025
mabezen
reviewed
May 29, 2025
tests start working
mabezen
reviewed
Jun 2, 2025
alnasar12
reviewed
Jul 21, 2025
alnasar12
reviewed
Jul 21, 2025
alnasar12
reviewed
Jul 21, 2025
alnasar12
reviewed
Jul 21, 2025
11697b8 to
52a4ca6
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR introduces functionality to allow user-defined table and sheet names along with flexible table positioning. The changes enable users to specify custom sheet and table names in their templates and position tables at locations other than the default A1 cell, enhancing customization options for document generation.
- Enhanced FileConfigs with TemplateSettings for custom sheet and table names
- Updated table utilities to support flexible positioning using cell range references
- Added XML helper functions to locate sheets and tables by name within workbook templates
Reviewed Changes
Copilot reviewed 19 out of 20 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types.ts | Added TemplateSettings interface for custom sheet/table names |
| src/workbookManager.ts | Updated to pass template settings to XML utilities |
| src/utils/xmlPartsUtils.ts | Enhanced to resolve sheet/table paths and handle custom positioning |
| src/utils/xmlInnerPartsUtils.ts | Added functions to find sheets and tables by name |
| src/utils/tableUtils.ts | Updated to accept cell range references for flexible positioning |
| src/utils/documentUtils.ts | Added GetStartPosition function and removed unused getTableReference |
| src/utils/constants.ts | Added new constants for error messages and XML paths |
| src/workbookTemplate.ts | Added new template with different sheet name |
| package.json | Version bump to 3.3.0-beta |
| tests/* | Updated test files with Jest imports and new test cases |
mabezen
approved these changes
Aug 11, 2025
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.
summery
Introduce options for users to specify table and sheet names, and allow tables to be positioned away from cell A1. This enhances customization and usability in document generation.
Changes
types.ts
Expanded FileConfigs to include tableName and sheetName properties for better control over table and sheet configurations.
documentsUtils.ts
update getTableReference so it will return a refrance that dosent need to start at A1
tableUtils.ts
changed the function updateTableInitialDataIfNeeded so it will get the location of the table, sheet from the user and ref from the files and use them instead of the defaults
changed the function updateSheetsInitialData so it will insert into the file the more generic row,col instead of starting from A1
xmlInnerPartsUtils.ts
added functions to get the path for the sheet correspond to the sheet name that we got from the user by finding the attrabute in workbookXmlPath
added functions to get the path for the table correspond to the table name that we got from the user by going over the files in xl/tables/
added functions to get the defined name(range) from xl/tables/tablePath
xmlPartsUtils.ts
updated the functions updateWorkbookDataAndConfigurations, updateWorkbookSingleQueryAttributes so it will get the sheet path, table path and the ref before we start
tests
tests/tableUtils.test.ts
the tests need to be updated to the new signatures
###tests/documentUtils.test.ts
added Unit test for the function GetStartPosition