开发者

Right-align text inside an RTF table

开发者 https://www.devze.com 2023-01-29 01:12 出处:网络
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:

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\ltr开发者_运维问答par\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?


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号