Skip to content

Commit b0d1f9b

Browse files
committed
chore(doc): add expand table to readme
1 parent ea65232 commit b0d1f9b

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -559,6 +559,39 @@ Find out more about formatting cells:
559559
- [Modify and style table cells](https://github.com/singerla/pptx-automizer/blob/main/__tests__/modify-existing-table.test.ts)
560560
- [Insert data into table with empty cells](https://github.com/singerla/pptx-automizer/blob/main/__tests__/modify-existing-table-create-text.test.ts)
561561

562+
563+
If you need to add rows or columns in a table with merged cells, you can add tags to your template table to expand it:
564+
```ts
565+
slide.modifyElement(
566+
'NestedTable3',
567+
modify.setTable(tableData, {
568+
adjustHeight: false,
569+
adjustWidth: false,
570+
expand: [
571+
{
572+
// Find a cell containing '{{each:row}}' and
573+
// clone it 3 times row-wise
574+
mode: 'row',
575+
tag: '{{each:row}}',
576+
count: 3,
577+
},
578+
{
579+
// Find a cell containing '{{each:sub}}' and
580+
// clone it once column-wise. Merged cells will
581+
// be cloned as well.
582+
mode: 'column',
583+
tag: '{{each:sub}}',
584+
count: 1,
585+
},
586+
],
587+
}),
588+
);
589+
```
590+
591+
Please find some examples in the tests:
592+
- [Expand a table with merged cells](https://github.com/singerla/pptx-automizer/blob/main/__tests__/modify-nested-table.test.ts)
593+
594+
562595
## Modify Charts
563596

564597
All data and styles of a chart can be modified. Please note that if your template contains more data than your data object, Automizer will remove these extra nodes. Conversely, if you provide more data, new nodes will be cloned from the first existing one in the template.

0 commit comments

Comments
 (0)