Skip to content

Conversation

@caio-pizzol
Copy link
Contributor

No description provided.

@linear
Copy link

linear bot commented Dec 15, 2025

Comment on lines +557 to +558
// Page dimensions are in inches, convert to pixels (96 PPI)
const availableWidth = (pageWidth - left - right) * 96;
Copy link
Contributor

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;
Copy link
Contributor

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) => {
Copy link
Contributor

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.

@harbournick harbournick force-pushed the main branch 2 times, most recently from 84f8ea5 to 2a443d8 Compare December 23, 2025 02:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

don't merge Don't merge yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

insertTable() with adaptive column width(to fill the entire width of the text), and overview-x:auto when load a document with multi-column tables

4 participants