Merge pull request #324 from Scarface2013/master
Fix merging of 3+ cells vertically
This commit is contained in:
@ -43,7 +43,9 @@ describe("TableColumn", () => {
|
||||
});
|
||||
|
||||
const tree2 = new Formatter().format(cells[1]);
|
||||
expect(tree2).to.deep.equal({ "w:tc": [{ "w:p": EMPTY_OBJECT }] });
|
||||
expect(tree2).to.deep.equal({
|
||||
"w:tc": [{ "w:tcPr": [{ "w:vMerge": { _attr: { "w:val": "continue" } } }] }, { "w:p": EMPTY_OBJECT }],
|
||||
});
|
||||
|
||||
const tree3 = new Formatter().format(cells[2]);
|
||||
expect(tree3).to.deep.equal({
|
||||
|
@ -15,7 +15,10 @@ export class TableColumn {
|
||||
|
||||
public mergeCells(startIndex: number, endIndex: number): TableCell {
|
||||
this.cells[startIndex].addVerticalMerge(VMergeType.RESTART);
|
||||
this.cells[endIndex].addVerticalMerge(VMergeType.CONTINUE);
|
||||
|
||||
for (let i = startIndex + 1; i <= endIndex; i++) {
|
||||
this.cells[i].addVerticalMerge(VMergeType.CONTINUE);
|
||||
}
|
||||
|
||||
return this.cells[startIndex];
|
||||
}
|
||||
|
Reference in New Issue
Block a user