Aspose.Email.Mail.Appointment.GetAppointmentText() shows wrong start/endtime

Hi,

the method GetAppointmentText() shows wrong data. See attached Demo.zip.

- the endtime shows the wrong label “Startime”; it should be “Endtime”

- the time format differs beetwen starttime and endtime. The starttime show seconds, the endtime doesn’t show seconds.

- a space character is missing after the label "Title:"

Aspose.Email.dll 2.0.0.0

===== result textform demo.ics ======

Title:Demo
StartTime: Dienstag, 21. August 2012 15:00:00
StartTime: Dienstag, 21. August 2012 16:00
Time Zone: Europe/Berlin
Location: Klosterwall 4
~~~~~~~~~
Description: Großer Sitzungssaal

At last, one proposal: there’s no elegant way of translating the labels. An AppointmentFormater class similar to Aspose.Email.Mail.MhtMessageFormatter would be a great improvement.

Best regards, Martin Pfeifer

Hi Martin,

Thanks for using Aspose.Email.

I can observe the formatting issues as you have mentioned with your sample input file and following lines of code. I have logged this issue as an enhancement in our issue tracking system. Our development team will look into it and provide a solution as soon as possible. We appreciate your patience in this regard.

Appointment appointment = Appointment.Load(“demo.ics”);
Console.WriteLine(appointment.GetAppointmentText());

The issue has been logged in our issue tracking system as: NETWORKNET-33437. I have also logged your suggestion regarding Appointment formater class against this issue. Development team will analyze it and look into its implementation in our future enhancements.

Hi,

i just tested the AppointmentFormattingOptions with some strange result.

The method Appointment.GetAppointmentText( AppointmentFormattingOptions) shows an empty result like

Titel:
Beginn:
Ende:
Time Zone: Europe/Berlin
Ort:
Beschreibung:


Here is my code.

Appointment appointment = Appointment.Load(“c:\temp\demo.ics”);

AppointmentFormattingOptions fmtOpt = new AppointmentFormattingOptions();
fmtOpt.TitleFormat = "Titel: ";
fmtOpt.DescriptionFormat = "Beschreibung: ";
fmtOpt.EndDateFormat = "Ende: ";
fmtOpt.StartDateFormat = "Beginn: ";
fmtOpt.LocationFormat = "Ort: ";

Console.WriteLine(appointment.GetAppointmentText( fmtOpt));

Aspose.Email.dll 2.7.0.0
.net 2.0 runtime

Hi Martin,


You may modify your code according to the following sample, to get the appropriate result.

Appointment appointment = Appointment.Load(“Demo.ics”);
AppointmentFormattingOptions fmtOpt = new AppointmentFormattingOptions();
fmtOpt.TitleFormat = “Titel: {0}”;
fmtOpt.DescriptionFormat = “Beschreibung: {0}”;
fmtOpt.EndDateFormat = “Ende: {0}”;
fmtOpt.StartDateFormat = “Beginn: {0}”;
fmtOpt.LocationFormat = “Ort: {0}”;
Console.WriteLine(appointment.GetAppointmentText(fmtOpt));

Please feel free to write us back if you have any other query in this regard.

Hi Kashif,

you’re right. Using {0} as placeholder solves the problem.

But in HTML mode the placeholders and formatter class doesn’t work.



The example code ( Aspose.Email.dll 2.7.0.0 )

Appointment appointment = Appointment.Load(“Demo.ics”);
AppointmentFormattingOptions fmtOpt = AppointmentFormattingOptions.CreateAsHtml();
fmtOpt.TitleFormat = “Titel: {0}”;
fmtOpt.DescriptionFormat = “Beschreibung: {0}”;
fmtOpt.EndDateFormat = “Ende: {0}”;
fmtOpt.StartDateFormat = “Beginn: {0}”;
fmtOpt.LocationFormat = “Ort: {0}”;
Console.WriteLine(appointment.GetAppointmentText(fmtOpt));

produces this output:

\r\n\r\n\r\nDemo\r\n\r\n\r\n

\r\n<FONT SIZE=2 FACE=“Arial”>Title: Demo
\r\n<FONT SIZE=2 FACE=“Arial”>StartTime: Dienstag, 21. August 2012 15:00:00
\r\n<FONT SIZE=2 FACE=“Arial”>EndTime: Dienstag, 21. August 2012 16:00:00
\r\n<FONT SIZE=2 FACE=“Arial”>Time Zone: Europe/Berlin
\r\n<FONT SIZE=2 FACE=“Arial”>Location: Klosterwall 4
\r\n

<FONT SIZE=2 FACE=“Arial”>~~~~~~~~~~~~~~~~~~~~~
\r\nGroßer Sitzungssaal

\r\n


Best regards, Martin

Hi Martin,


Aspose.Email provides facility to format the Appointment into html string. Please give a try to the following code and let us know your feedback.

MailAddressCollection attendees = new MailAddressCollection();
attendees.Add(new MailAddress("person1@domain.com"));
attendees.Add(new MailAddress("person2@domain.com"));
attendees.Add(new MailAddress("person3@domain.com"));
Appointment app = new Appointment(“Room 112”,new DateTime(2006,7,17,13,0,0),new DateTime(2006,7,17,14,0,0),new MailAddress("somebody@domain.com"), attendees );
app.Summary = “Release Meeting”;
app.Description = “Discuss for the next release”;
AppointmentFormattingOptions formattingOptions = AppointmentFormattingOptions.CreateAsHtml();
formattingOptions.LocationFormat = “<FONT SIZE=5 FACE=“Arial”>Where: {0}
”;
formattingOptions.TitleFormat = “<FONT SIZE=5 FACE=“Arial”>Subject: {0}
”;
formattingOptions.DescriptionFormat = “

<FONT SIZE=5 FACE=“Arial”>-----------
{0}

”;
string appointmentHtml = app.GetAppointmentText(formattingOptions);
System.IO.File.WriteAllText(@“D:\test.html”, appointmentHtml);

Attached is the screen shot of the output generated from above sample code:

Hi Kashif,

thanks a lot. This is working now.

Best regards, Martin

Hi Martin,


Good to know that it worked for you.

Have a good day ahead!