How to read rtf file line by linle...
Posted on 2004-10-27
I have one question related to programming IO in C#.
I am trying to read rtf file (this file i have created using some pdf file), now i want to read this file and store the output in csv(Comma Sepearted file).
I am not able to read the file, i mean it gives all the formating information. Then i tried to investigate about rtf files and found that it has special format.
Now the problem is how do i read that file and create a new output file.
I would be grateful if someone please inform me a way to do this by that time I will try to find some solution for it.
Here is the code which i have written:
/// Summary description for Class1.
/// The main entry point for the application.
static void Main(string args)
// Read the file and display it line by line. Hardcode file path for time being
string filePath = "C:\\MyFiles\\participants-governments.rtf";
StreamReader file = new StreamReader(filePath);
StreamWriter sw = new StreamWriter("C:\\MyFiles\\participants-governments.csv");
while((line = file.ReadLine()) != null)
if( counter == 5)