-
Notifications
You must be signed in to change notification settings - Fork 43
feat: adaptive insert table column width #1533
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?
feat: adaptive insert table column width #1533
Conversation
| // Page dimensions are in inches, convert to pixels (96 PPI) | ||
| const availableWidth = (pageWidth - left - right) * 96; |
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.
Use pixelsToInches helper
|
|
||
| for (let index = 0; index < colsCount; index++) { | ||
| const cell = createCell(types.tableCell, cellContent); | ||
| const cellAttrs = columnWidths ? { colwidth: [columnWidths[index]] } : null; |
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.
What happens if columnWidths.length != colsCount? In particular, if columnWidths[index] is undefined, should cellAttrs be set to null rather than { colwidth: [undefined] }?
| * const table = createTable(schema, 3, 3, false, null, [200, 100, 200]) | ||
| */ | ||
| export const createTable = (schema, rowsCount, colsCount, withHeaderRow, cellContent = null) => { | ||
| export const createTable = (schema, rowsCount, colsCount, withHeaderRow, cellContent = null, columnWidths = null) => { |
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.
Recommend changing function signature to take an object with named options, rather than an ordered list of positional arguments; with a long list of arguments, it's hard to look at a createTable call and understand what each argument is.
84f8ea5 to
2a443d8
Compare
No description provided.