Skip to content

Allow user-defined table and sheet names, flexible table positioning #117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Aug 12, 2025

Conversation

myk93
Copy link
Contributor

@myk93 myk93 commented Apr 24, 2025

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

@myk93 myk93 force-pushed the makeTemplateGeneral branch from 11697b8 to 52a4ca6 Compare July 29, 2025 07:35
@myk93 myk93 requested a review from Copilot August 10, 2025 08:00
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copilot

This comment was marked as outdated.

@myk93 myk93 requested a review from Copilot August 10, 2025 08:27
Copilot

This comment was marked as outdated.

@myk93 myk93 requested a review from Copilot August 10, 2025 11:12
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

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

@myk93 myk93 merged commit 1870121 into microsoft:main Aug 12, 2025
1 check passed
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.

4 participants