-
Notifications
You must be signed in to change notification settings - Fork 25
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
base: main
Are you sure you want to change the base?
Conversation
…the sheet, and dosent force the table to be at A1
@myk93 please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
@@ -41,6 +41,8 @@ export interface FileConfigs { | |||
templateFile?: File; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest a breaking change, but seems like the tableName and the sheetName strongly bind to the templateFile, I would suggest to introduce a new props to have them all together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have to bump the version if we choose to change the API.
@@ -62,7 +62,7 @@ const generateSingleQueryWorkbookFromZip = async (zip: JSZip, query: QueryInfo, | |||
} | |||
|
|||
await xmlPartsUtils.updateWorkbookPowerQueryDocument(zip, query.queryName, generateSingleQueryMashup(query.queryName, query.queryMashup)); | |||
await xmlPartsUtils.updateWorkbookSingleQueryAttributes(zip, query.queryName, query.refreshOnOpen); | |||
await xmlPartsUtils.updateWorkbookSingleQueryAttributes(zip, query.queryName, query.refreshOnOpen, fileConfigs?.sheetName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we add test coverage? in our type script tests?
* @returns Object with numeric row and column. | ||
*/ | ||
const GetStartPosition = (cellRangeRef: string): { row: number; column: number } => { | ||
const match = cellRangeRef.match(/^([A-Z]+)(\d+):/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we accept also low chars? like a-z?
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