i have a some problem in window application C# Project.so plz help me for that..i am sending my details requirement to you.
plz try to understand my problem and plz send code as much as possible.
requirement:- there is a RTF file is save in any Drive. in this RTF file there is 4-5 Paragrph. i have need to read this file paragraph and show it in richtextbox control in window form with
and <\p> and with every paragraph.
means to say, if RTF file 4-5 paragraph then he show in richtextbox with every paragrpah with
aaaaaaaaaaa<\p>.
like that...
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa<\p>
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb<\p>
wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwww<\p>.
so plz help me for that..requirement before 29 oct.
Clue:- i have did only to show RTF file content to richtextbox in form only..i have no idea about how to insert
,<\p>
with every paragraph.
Mamta MPosted Oct 30, 2008, 8:22 AM
The following code should help you achieve this assuming that you have beginning of paragraphs defined by blank lines.
string
fileName = @"d:\test.rtf"; string outputFileName = @"d:\test2.rtf"; string inputLine, newLine="";System.IO.
StreamReader sr = new System.IO.StreamReader(fileName);System.IO.
StreamWriter sw = new System.IO.StreamWriter(outputFileName);inputLine = sr.ReadLine();
newLine =
""
;sw.WriteLine(newLine);
while (inputLine != null){
//MessageBox.Show(inputLine.ToString()); if (inputLine.Length == 0){
newLine =
""
;sw.WriteLine(newLine);
}
else if (newLine.Equals(""
)){
sw.WriteLine(inputLine+
"");}
elsesw.WriteLine(inputLine);
// read the next lineinputLine = sr.ReadLine();
}
sr.Close();
sw.Close();
Regards,
Mamta