I am creating the ICS file from the # # WPF application and using the following code to generate the 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 describing the description. I think when I add \ n for a new line, this creates a problem. I need to format my string as follows.
I use the following line to create a dashed line.
result += new String('-', characterLength) + "\\n";
But out out shows a single line instead of a dashed line. I think "\ n" is creating a problem. When I add some space after the line escape character, I see that the problem is resolved. Is there a better / alternative solution for this?
Some line in the description displayed in a different font style. How to make it unique?
How can I set the font for this ICs file from C #?
Please offer.
source share