Loading RTF file having Table in TRichEdit without Table borders

断了今生、忘了曾经 提交于 2020-01-24 14:13:08

问题


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.


回答1:


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.




回答2:


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.



来源:https://stackoverflow.com/questions/4591004/loading-rtf-file-having-table-in-trichedit-without-table-borders

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!