R
rachana
Hi,
I am trying to create rtf document using C# and ASP.NET.
I have seen a sample code in asp:
http://support.microsoft.com/kb/270906/
I tried to do the same using C#, but rtf controls are not recognized.
Document is not formatted and formatting information is just displayed
in plain text.
My code:
FileStream sw =
File.Open(Server.MapPath("Sample1.doc"),FileMode.Truncate);
StreamWriter MyFile = new StreamWriter(sw);
MyFile.WriteLine("{\rtf1 ");
string sRTF = string.Empty;
sRTF = @"{\par This is some {\b bold} text.\par}";
MyFile.WriteLine(sRTF);
MyFile.WriteLine("}");
MyFile.Close();
sw.Close();
Response.Write("<META HTTP-EQUIV='REFRESH'
Content=0;URL=Sample1.doc>");
The output in Sample1.doc should be
This is some bold text.
Instead it is,
{tf1
{\par This is some {\b bold} text.\par}
}
What's wrong? Please help me.
Rachana
I am trying to create rtf document using C# and ASP.NET.
I have seen a sample code in asp:
http://support.microsoft.com/kb/270906/
I tried to do the same using C#, but rtf controls are not recognized.
Document is not formatted and formatting information is just displayed
in plain text.
My code:
FileStream sw =
File.Open(Server.MapPath("Sample1.doc"),FileMode.Truncate);
StreamWriter MyFile = new StreamWriter(sw);
MyFile.WriteLine("{\rtf1 ");
string sRTF = string.Empty;
sRTF = @"{\par This is some {\b bold} text.\par}";
MyFile.WriteLine(sRTF);
MyFile.WriteLine("}");
MyFile.Close();
sw.Close();
Response.Write("<META HTTP-EQUIV='REFRESH'
Content=0;URL=Sample1.doc>");
The output in Sample1.doc should be
This is some bold text.
Instead it is,
{tf1
{\par This is some {\b bold} text.\par}
}
What's wrong? Please help me.
Rachana