Files
docx-js/src/file/table/table-column.ts

26 lines
694 B
TypeScript
Raw Normal View History

2019-03-04 22:50:04 +00:00
import { TableCell, VMergeType } from "./table-cell";
export class TableColumn {
constructor(private readonly cells: TableCell[]) {}
public getCell(index: number): TableCell {
const cell = this.cells[index];
if (!cell) {
throw Error("Index out of bounds when trying to get cell on column");
}
return cell;
}
public mergeCells(startIndex: number, endIndex: number): TableCell {
this.cells[startIndex].addVerticalMerge(VMergeType.RESTART);
2019-05-15 18:14:39 -04:00
2019-05-16 11:15:20 -04:00
for (let i = startIndex + 1; i <= endIndex; i++) {
2019-05-15 18:14:39 -04:00
this.cells[i].addVerticalMerge(VMergeType.CONTINUE);
}
2019-03-04 22:50:04 +00:00
return this.cells[startIndex];
}
}