在 RTF 中设置列​​宽 [英] Setting column width in RTF

查看:82
本文介绍了在 RTF 中设置列​​宽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望是一个简单的问题!

I have what I hope is a simple question !

我正在生成一个简单的 RTF 表,随后在 MS Word 中打开该表.表格生成良好,但列宽有点小,导致一些自动换行(不是我想要的).

I am generating a simple RTF table that is subsequently opened in MS Word. The table is generating fine but the column widths are a little small and causing some word wrapping (not what I want).

我生成的 RTF 代码用于两行三列的表格,格式如下:

The RTF code I generate is for a two line, three column table and is of the form:

\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} 

我需要添加什么来设置列宽?我曾尝试更改 word 中的列宽,然后检查输出,但至少可以说有点晦涩!

What do I need to add to set a column width ? I have tried altering the column width in word and then examining the output but it is a little obscure to say the least !

推荐答案

问题是你设置的列宽太小了:

The problem is in that you have set very small width for column:

\cellx1 
\cellx2 
\cellx3

要在 RTF 中设置列​​宽,有一个关键字 '\cellxN',其中 N - 是以缇为单位的列宽.15 缇等于 1px.

To set width for column in RTF there is a keyword '\cellxN', where N - is column width in twips. 15 twips is 1px.

因此,如果您想创建一个简单的 1 行 3 列、每列 100 像素的 RTF 表格,请使用以下语法:

So if you want to create a simple RTF table with 1 row and 3 columns, 100px each, use this syntax:

\trowd\cellx1500\cellx3000\cellx4500
\intbl A\cell B\cell C\cell\row

您将得到一个 300 像素的简单表格,3 列 - 每列 100 像素,边框不可见.

You will get a simple table by 300px, 3 columns - 100px each, with invisible borders.

干杯,最大

这篇关于在 RTF 中设置列​​宽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆