在 TRichEdit 中加载具有表格但不带表格边框的 RTF 文件

发布于 2024-10-10 05:22:39 字数 193 浏览 0 评论 0原文

我有一个 RTF 文件,正在将其加载到 TRichEdit 控件中。

我面临的唯一问题是,RTF 文件中有表格,加载相同的文件会显示表格边框。但是当我在 MS Word 中加载相同的 RTF 时,它不显示任何边框(客户端想要相同的行为)。

有没有办法在加载到 TRichEdit 时不显示表格边框。

我用的是Delphi7。

I have a RTF file that I am loading into a TRichEdit control.

Only problem that I am facing is, RTF file has Tables in it, loading the same shows table borders. But when I load the same RTF in MS Word it doesn't show any borders(Client want the same behavior).

Is there any way for not displaying borders of table while loading into TRichEdit.

I am using Delphi7.

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

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

发布评论

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

评论(2

听你说爱我 2024-10-17 05:22:39

TRichEdit 控件在 RTF 格式的实现方面不如 MS Word 完整。
据我记得,TRichEdit 不会处理表格边框。

您需要将 MS Word 作为 Active X 控件嵌入,或者使用 TRichView 组件。 TRichView 是更好的方法,因为 TRichEdit 行为与不同版本的 Windows 不一致,并且它不依赖于现有的 MS Word 安装。但它不是免费组件。 :(

如果您只想显示一些文本和表格,您可以将其转换为 HTML,然后使用嵌入式 Internet Explorer 或 THtmlView 显示它。

TRichEdit control is less complete than MS Word, in its implementation of the RTF format.
As far as I remember, TRichEdit won't handle table borders.

You will need either to embed MS Word as an Active X control, either use a TRichView component. TRichView is the better approach, because TRichEdit behavior is not consistent with diverse version of Windows, and it doesn't depend on an existing MS Word installation. But it's not a free component. :(

If you want only to display some text and tables, you could convert it to HTML, then display it using either an embedded Internet Explorer, either with THtmlView.

離人涙 2024-10-17 05:22:39

如果您在旧版本的 MS Office(如 2003 或更低版本)中打开 RTF 文件,无论指定无边框,您仍然可以查看边框。

在较新版本的 MS Office(2007 和 2010)中,您无法查看边框。

由于 TRichEdit 的 RTF 引擎是使用较旧的规范编写的,因此它将在您的应用程序中显示边框。

因此,您需要查看 @A.Bouchez 答案中指定的第三方组件。

If you open the RTF file in older versions of MS Office like 2003 or below, irrespective of specifying no borders, you can still view the borders.

In newer versions of MS Office (2007 and 2010), you cannot view the borders.

As the RTF Engine for TRichEdit is written with older specification, it will show borders in your application.

So you need to have a look on the thrid party components which were specified in @A.Bouchez answer.

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