Warm tip: This article is reproduced from serverfault.com, please click

c#-读取RTF文件并删除动态文本

(c# - Read a RTF File and Remove the dynamic text)

发布于 2010-11-24 14:27:02

我的RTF文件开头包含一个文本,如下所示:

{\ rtf1 \ ansi \ ansicpg1252 \ deff0 \ deflang1033 {\ fonttbl {\ f0 \ fnil \ fcharset0 Trebuchet MS;} {\ f1 \ fswiss \ fprq2 \ fcharset0 Verdana;} {\ f2 \ fnil \ fcharset0 Tahoma;} {\ f3 \ fnil \ fcharset0 Arial;} {\ f4 \ froman \ fprq2 \ fcharset0 Times New Roman;}}

我如何读取RTF文件并替换为我希望的任何内容?

Questioner
xorpower
Viewed
0
Kevin Wienhold 2010-11-24 23:10:09

如果要自己生成RTF标头,则应查看RTF规范否则,你可能可以简单地使用RichTextBox-Control,设置字体样式/颜色等,并从RTFText-Property获取标头。