Ricky White
asked on
C# read rtf file?
I have a rtf file that contains some text and would like to read and parse its contents and probably load them in database.
I can read and process txt files using StreamReader's readline method. but when I try the same thing on rtf file it adds formatting and some non-readable text in the data string so the end result is not what I expect.
How can I process this rtf file? Would I need to manually copy the content of this rtf file and paste it in txt file before processing or is there a better way to directly process rtf files?
using (StreamReader sr = new StreamReader(FileName))
{
string strInputRcd;
// Read and display lines from the file until the end of
// the file is reached.
while ((strInputRcd = sr.ReadLine()) != null)
{
}
Thanks
I can read and process txt files using StreamReader's readline method. but when I try the same thing on rtf file it adds formatting and some non-readable text in the data string so the end result is not what I expect.
How can I process this rtf file? Would I need to manually copy the content of this rtf file and paste it in txt file before processing or is there a better way to directly process rtf files?
using (StreamReader sr = new StreamReader(FileName))
{
string strInputRcd;
// Read and display lines from the file until the end of
// the file is reached.
while ((strInputRcd = sr.ReadLine()) != null)
{
}
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER