我有我希望的简单问题!
我正在生成一个简单的RTF表,随后在MS Word中打开.该表生成正常,但列宽有点小,导致一些自动换行(不是我想要的).
我生成的RTF代码用于两行三列表,其形式如下:
\trowd \trautofit1
\intbl
\cellx1
\cellx2
\cellx3
{a\cell b\cell c\cell }{\trowd \trautofit1
\intbl
\cellx1
\cellx2
\cellx3
\row}
\trowd \trautofit1
\intbl
\cellx1
\cellx2
\cellx3
{d\cell e\cell f\cell }{\trowd \trautofit1
\intbl
\cellx1
\cellx2
\cellx3
\row}
Run Code Online (Sandbox Code Playgroud)
设置列宽需要添加什么?我已经尝试改变单词中的列宽,然后检查输出,但至少可以说它有点模糊!
小智 10
你正在寻找的控制词是\clwWidthN和\clftsWidthN
- \clwWidthN
Preferred cell width. Overrides \trautofitN.
- \clftsWidthN
Units for \clwWidthN:
- 0 : Null. Ignore \clwWidthN in favor of \cellxN (Word 97 style of determining cell and row width).
- 1 : Auto, no preferred cell width, ignores \clwWidthN if present; \clwWidthN will generally not be written, giving precedence to row defaults.
- 2 : Percentage (in 50ths of a percent).
- 3 : Twips.
Run Code Online (Sandbox Code Playgroud)
因此,在您的情况下,您可以使用\clftsWidth1(自动设置宽度)或自己设置首选百分比,例如\clwWidth2\clwWidth2500(2500 = 50%)
\trowd \trautofit1
\intbl
\clftsWidth1\cellx1
\clftsWidth1\cellx2
\clftsWidth1\cellx3
{a\cell b\cell c\cell }
Run Code Online (Sandbox Code Playgroud)
\trowd \trautofit1
\intbl
\clftsWidth2\clwWidth2000\cellx1
\clftsWidth2\clwWidth1500\cellx2
\clftsWidth2\clwWidth1500\cellx3
{a\cell b\cell c\cell }
Run Code Online (Sandbox Code Playgroud)
小智 8
问题在于您为列设置了非常小的宽度:
\cellx1
\cellx2
\cellx3
Run Code Online (Sandbox Code Playgroud)
要在RTF中设置列的宽度,有一个关键字'\ cellxN',其中N - 是以缇为单位的列宽.15缇是1px.
因此,如果要创建一个包含1行和3列(每个100px)的简单RTF表,请使用以下语法:
\trowd\cellx1500\cellx3000\cellx4500
\intbl A\cell B\cell C\cell\row
Run Code Online (Sandbox Code Playgroud)
你会得到一个300px,3列的简单表 - 每个100px,带有不可见的边框.
干杯,马克斯
| 归档时间: |
|
| 查看次数: |
14817 次 |
| 最近记录: |