如何居中对齐表格 - PDFMAKE [英] How to center align table - PDFMAKE
本文介绍了如何居中对齐表格 - PDFMAKE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我可以使用 PDFMAKE 创建一个居中对齐(页面)的表格吗?
Can i create one table with center alignment (page) using PDFMAKE?
已定义对齐方式:样式和标签表中的居中":{}
Already defined alignment: "center" in Styles and inside the tag table: {}
{
table: {
width: "auto",
body: [
[
{ text: "PERÍODO", style: "tableHeader" },
{ text: "VOLUME (MW médios)", style: "tableHeader" }
],
["{7} a {8}", "{9}"],
["{10} a {11}", "{12}"],
["{13} a {14}", "{15}"]
],
alignment: "center"
}
}
我希望一个表格在页面中央对齐.
I expect one table align in the center of the page.
推荐答案
alignment:"center"
只将列的内容居中对齐.您可以尝试以下操作:
alignment:"center"
only aligns the content of the columns in center. You can try as following:
{
columns: [
{ width: '*', text: '' },
{
width: 'auto',
table: {
body: [
[
{ text: "PERÍODO", style: "tableHeader" },
{ text: "VOLUME (MW médios)", style: "tableHeader" }
],
["{7} a {8}", "{9}"],
["{10} a {11}", "{12}"],
["{13} a {14}", "{15}"]
],
alignment: "center"
}
},
{ width: '*', text: '' },
]
}
这篇关于如何居中对齐表格 - PDFMAKE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文