RTF 表格内的文本右对齐

发布于 2024-10-06 02:38:44 字数 804 浏览 5 评论 0原文

我正在尝试使用 C# RichTextEdit 控件在 RTF 中编写一个小型格式化测试,但我似乎无法正确执行。这就是我想要的样子:

         Key Value
 Another key Another value
 A third key Value

我使用的 rtf 代码是这样的:

{\rtf1\ansi\ansicpg1252\deff0
{\fonttbl
{\f0\fswiss\fcharset0\fprq2\fttruetype Tahoma;}}

\kerning0\cf0\ftnbj\fet2\ftnstart1\ftnnar\aftnnar\ftnstart1\aftnstart1\aenddoc\revprop3{\info\uc1}\deftab720\viewkind1\paperw11905\paperh16837\margl1440\margr1440\widowctrl
\sectd\sbknone\colsx360\pgncont\ltrsect
\pard\plain\ltrpar\ql\sl240\slmult1\itap0\par{
\trowd 
\cellx2288\pard\plain\ltrpar\qr\f0\fs14\sl240\slmult1\intbl\b\  Key \cell
\cellx6721\pard\plain\ltrpar\ql\f0\fs14\sl240\slmult1\intbl  Value \cell
\row

剩下两个问题; 无论我尝试放入什么,我都无法删除桌子周围的边框。 键列左对齐,而不是右对齐。

那么有 RTF 人员可以提供帮助吗?

I am trying to write a small formatted test in RTF using the C# RichTextEdit control, but I can't seem to get it right. This is how I want to to look:

         Key Value
 Another key Another value
 A third key Value

The rtf code im using is this:

{\rtf1\ansi\ansicpg1252\deff0
{\fonttbl
{\f0\fswiss\fcharset0\fprq2\fttruetype Tahoma;}}

\kerning0\cf0\ftnbj\fet2\ftnstart1\ftnnar\aftnnar\ftnstart1\aftnstart1\aenddoc\revprop3{\info\uc1}\deftab720\viewkind1\paperw11905\paperh16837\margl1440\margr1440\widowctrl
\sectd\sbknone\colsx360\pgncont\ltrsect
\pard\plain\ltrpar\ql\sl240\slmult1\itap0\par{
\trowd 
\cellx2288\pard\plain\ltrpar\qr\f0\fs14\sl240\slmult1\intbl\b\  Key \cell
\cellx6721\pard\plain\ltrpar\ql\f0\fs14\sl240\slmult1\intbl  Value \cell
\row

Two problems remaining;
No matter what I have tried putting in, I can't remove the border around the table.
The Key column is aligned to the left, not the right.

So are there any RTF people out there who can help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半葬歌 2024-10-13 02:38:45

.net 中的 Rtf 控件很可怜,只实现了 rtf 命令的一小部分,而表是一个几乎无法工作的巨大漏洞。基本上,如果你想做任何类似的事情,你需要集成一个像样的文本编辑器。

微软希望您添加一个Word窗口来支持它,但这会引发无穷无尽的问题,因为您能否保证您的用户拥有正确的Office版本,或者即使他们根本使用Office。

我已经研究这个问题有一段时间了,但还没有找到一个可以工作的 RTF 控件,甚至许多商业控件也只能修复一两个错误。你最好是选择 HTML

The Rtf control in .net is pathetic and only implements a tiny portion of the rtf commands and tables is the massive hole that barely works at all. basically if you want to do any thing like that you need to integrate a decent text editor.

microsoft expects you to put a word window in to support it but this throws up no end of issues as can you guarantee that your user has the right version of office or even if they use office at all.

i've been looking into this for a while and have yet to find a rtf control that works even many of the commercial ones only fix one or 2 of the errors. you best be is to go for HTML

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文