Skip to content

Commit 5e8d059

Browse files
committed
fix(table): skip table cells without 'a:txBody' to prevent error with GoogleSlides; fixes #132
1 parent f7a2d80 commit 5e8d059

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/modify/modify-table.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,18 +49,18 @@ export class ModifyTable {
4949
);
5050

5151
this.data.body.forEach((row: TableRow, r: number) => {
52-
row.values.forEach((cell: number | string, c: number) => {
52+
this.table.modify({
53+
'a16:rowId': {
54+
index: r,
55+
modify: ModifyXmlHelper.attribute('val', r),
56+
},
57+
});
58+
59+
row.values.forEach((cell, c: number) => {
5360
const rowStyles = row.styles && row.styles[c] ? row.styles[c] : {};
5461
this.table.modify(
5562
this.row(r, this.column(c, this.cell(cell, rowStyles))),
5663
);
57-
this.table.modify({
58-
'a16:rowId': {
59-
index: r,
60-
modify: ModifyXmlHelper.attribute('val', r),
61-
},
62-
});
63-
6464
if (!alreadyExpanded) {
6565
this.expandOtherMergedCellsInColumn(c, r);
6666
}
@@ -119,9 +119,13 @@ export class ModifyTable {
119119
column = (index: number, children: ModificationTags): ModificationTags => {
120120
return {
121121
'a:tc': {
122-
index: index,
123-
children: children,
124-
fromPrevious: true,
122+
children: {
123+
'a:txBody': {
124+
index: index,
125+
children: children,
126+
fromPrevious: true,
127+
},
128+
},
125129
},
126130
};
127131
};

0 commit comments

Comments
 (0)