lbr*_*ile 0 javascript docx node.js
假设我想删除该表中的所有边框:
---------------------------
| image | text |
---------------------------
Run Code Online (Sandbox Code Playgroud)
按照在线文档: https: //docx.js.org/#/usage/tables
new Table({
borders: {
top: {style: BorderStyle.NONE},
bottom: {style: BorderStyle.NONE},
left: {style: BorderStyle.NONE},
right: {style: BorderStyle.NONE},
},
rows: [
new TableRow({
children: [
new TableCell({
children: [
new Paragraph({ children: [some_image_file] }),
],
}),
new TableCell({
children: [
new Paragraph({ text: "text" }),
],
}),
],
}),
],
})
Run Code Online (Sandbox Code Playgroud)
这给出:
image | text
Run Code Online (Sandbox Code Playgroud)
根据文档,在 内移动边框选项TableCell应该会影响单元格的边框,但这样做时我看不到任何结果。有什么想法如何实现没有边框的表格吗?
正如@cbloss793所提到的,似乎边框选项TableCell还必须包含size: 0删除相应边框的属性。color: "FFFFFF"为了安全起见,我还添加了。
...
new TableCell({
borders: {
top: {style: BorderStyle.NONE, size: 0, color: "FFFFFF"},
bottom: {style: BorderStyle.NONE, size: 0, color: "FFFFFF"},
left: {style: BorderStyle.NONE, size: 0, color: "FFFFFF"},
right: {style: BorderStyle.NONE, size: 0, color: "FFFFFF"},
},
...
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1941 次 |
| 最近记录: |