I am Creating ICS file fromC# WPF application and using the following code to generate ICS file.
StreamWriter writer;
writer = new StreamWriter(filePath);
writer.WriteLine("BEGIN:VCALENDAR");
writer.WriteLine("VERSION:2.0");
writer.WriteLine("PRODID:MyApp");
writer.WriteLine("CALSCALE:GREGORIAN");
writer.WriteLine("METHOD:PUBLISH");
writer.WriteLine("BEGIN:VEVENT");
string startDateTime = Convert.ToDateTime(appointmentDetails.StartDate).ToString("yyyyMMdd'T'HHmmss");
string endDateTime = Convert.ToDateTime(appointmentDetails.EndDate).ToString("yyyyMMdd'T'HHmmss");
writer.WriteLine("DTSTART:" + startDateTime);
writer.WriteLine("DTEND:" + endDateTime);
writer.WriteLine(@"DESCRIPTION:" + appointmentDetails.Body);
writer.WriteLine("SUMMARY:" + appointmentDetails.Subject);
writer.WriteLine("END:VEVENT");
writer.WriteLine("END:VCALENDAR");
writer.Close();
But I have some problems while fromating the description.I think when I add \n for new line ,it creates a problem. I need to format my string like this.
------------------
Header1
-----------------
bOdy1
contents
---------------
I am using the following line to create a dotted line.
result += new String('-', characterLength) + "\\n";
But the out put showing one line instead of dotted line.I think “\n” creates the problem.when I add some space after the new line escape character I can see the problem solved.Is there any better/alternate solution for this?
Some string in the description showing in different font style.How can Make it unique?
How can I set the font for this ICs file from the C#?
Please suggest.