是否可以在pdfmake中的文本开头之前添加制表符空间。我确实为此尝试了“ \ t”,但是当我们将其添加到开头或字符串开始之前,它不起作用。

这就是我尝试的


  


var dd = {
>         content: [{
>     text: 'Cost',
>     style: 'header',
>     decoration: 'underline' }, {
>     text: '\tInvesting in a granulator is a wise move because of the enormous long-term savings of virgin raw materials and other benefits
> that you gain.',
>     style: 'para' }],
>         styles: {
>             header: {
>                 fontSize: 20,
>                 bold: true
>             },
>             para: {
>                 fontSize: 10,
>                 margin: [0, 9, 0, 9]
>             }
>
> }


目前我的输出是:


  成本
  
  投资造粒是明智的举动,因为巨大
  长期节省原始原材料和其他好处
  获得。


我要寻找的是“投资造粒”之前的制表符空间

最佳答案

将多个“ \ t”添加到初始字符串以产生制表符空间效果。

var dd = {
>         content: [{
>     text: 'Cost',
>     style: 'header',
>     decoration: 'underline' }, {
>     text: '\t\t\t Investing in a granulator is a wise move because of the enormous long-term savings of virgin raw materials and other benefits
> that you gain.',
>     style: 'para' }],
>         styles: {
>             header: {
>                 fontSize: 20,
>                 bold: true
>             },
>             para: {
>                 fontSize: 10,
>                 margin: [0, 9, 0, 9]
>             }
>
> }

09-18 19:37