Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
VolodymyrBaydalkaDevessence committed Nov 6, 2024
2 parents eddd0af + 9c5ac37 commit 2d1941c
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/document-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,34 @@ export class DocumentParser {

return true;
});

this.parseTableCellVerticalText(elem, cell);
}

parseTableCellVerticalText(elem: Element, cell: WmlTableCell) {
const directionMap = {
"btLr": {
writingMode: "vertical-rl",
transform: "rotate(180deg)"
},
"lrTb": {
writingMode: "vertical-lr",
transform: "none"
},
"tbRl": {
writingMode: "vertical-rl",
transform: "none"
}
};

xmlUtil.foreach(elem, c => {
if (c.localName === "textDirection") {
const direction = xml.attr(c, "val");
const style = directionMap[direction] || {writingMode: "horizontal-tb"};
cell.cssStyle["writing-mode"] = style.writingMode;
cell.cssStyle["transform"] = style.transform;
}
});
}

parseDefaultProperties(elem: Element, style: Record<string, string> = null, childStyle: Record<string, string> = null, handler: (prop: Element) => boolean = null): Record<string, string> {
Expand Down

0 comments on commit 2d1941c

Please sign in to comment.