在richtextbox中创建一个表 [英] Create a table in richtextbox

查看:71
本文介绍了在richtextbox中创建一个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在MS Word文档中创建表时在RichTextBox中创建一个表。我正在研究C#apllication,并希望在RichTextBox中显示结构良好的格式。请帮忙。

I want to create a table in RichTextBox as we create the table in MS Word document. I am working on a C# apllication and want to dislay a well structured format in the RichTextBox. Please help.

推荐答案

您可以直接设置RTF来完成。这里有一个示例,可以让您知道自己想要做什么:
You can do it by directly setting the RTF. Here's a sample that should give you some idea what you want to do:
{\rtf1\fbidis\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fprq2\fcharset0 Calibri;}{\f1\fnil\fcharset0 Microsoft Arial;}}
{\colortbl ;\red0\green0\blue0;}
\viewkind4\uc1\trowd\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10\brdrcf1 \trbrdrl\brdrs\brdrw10\brdrcf1 \trbrdrb\brdrs\brdrw10\brdrcf1 \trbrdrr\brdrs\brdrw10\brdrcf1 \clbrdrt\brdrw15\brdrs\clbrdrl\brdrw15\brdrs\clbrdrb\brdrw15\brdrs\clbrdrr\brdrw15\brdrs \cellx1576\clbrdrt\brdrw15\brdrs\clbrdrl\brdrw15\brdrs\clbrdrb\brdrw15\brdrs\clbrdrr\brdrw15\brdrs \cellx3260\clbrdrt\brdrw15\brdrs\clbrdrl\brdrw15\brdrs\clbrdrb\brdrw15\brdrs\clbrdrr\brdrw15\brdrs \cellx4944\pard\intbl\ltrpar\sl276\slmult1\f0\fs22 TopLeft\Top Right\cell\row
\trowd\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10\brdrcf1 \trbrdrl\brdrs\brdrw10\brdrcf1 \trbrdrb\brdrs\brdrw10\brdrcf1 \trbrdrr\brdrs\brdrw10\brdrcf1 \clbrdrt\brdrw15\brdrs\clbrdrl\brdrw15\brdrs\clbrdrb\brdrw15\brdrs\clbrdrr\brdrw15\brdrs \cellx1576\clbrdrt\brdrw15\brdrs\clbrdrl\brdrw15\brdrs\clbrdrb\brdrw15\brdrs\clbrdrr\brdrw15\brdrs \cellx3260\clbrdrt\brdrw15\brdrs\clbrdrl\brdrw15\brdrs\clbrdrb\brdrw15\brdrs\clbrdrr\brdrw15\brdrs \cellx4944\intbl Bottom Left\cell Bottom Right\cell\row
\pard\ltrpar\sa200\sl276\slmult1\par
\pard\ltrpar\f1\fs17\par
}

如果你想这样做,你应该真正阅读RTF格式。或者(这里是一个方便的提示),在Word中创建所需的页面,并将其另存为RTF文件。您可以将此作为创建应用程序的基础。

You should really read up on the RTF format if you want to do this. Alternatively (and here's a handy hint), create the page you want in Word, and save it out as an RTF file. You can use this as the basis of creating your application.


这篇关于在richtextbox中创建一个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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