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

Read a RTF File and Remove the dynamic text

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

My RTF File contains a text in the beginning like below:

{\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;}}

How can i Read the RTF File and replace with anything i wish?

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

If you want to generate the RTF Header yourself you should take a look at the RTF Spec. Otherwise you might be able to simply use the RichTextBox-Control, set the font-style/color etc. and get the header from the RTFText-Property.