3
我們使用以下代碼創建了一個vcs文件。VCS在html中的文件描述
Dim mstream As New MemoryStream
Dim writer As New StreamWriter(mstream)
writer.AutoFlush = True
GetvCalendarText(writer)
Response.Clear()
Response.AppendHeader("Content-Disposition", "attachment; filename=Event" & eventID & ".vcs")
Response.AppendHeader("Content-Length", mstream.Length.ToString)
Response.ContentType = "application/download"
Response.BinaryWrite(mstream.ToArray)
Response.End()
GetCalendarText方法
Dim body As String = <b>New event</b> writer.WriteLine("BEGIN:VCALENDAR{0}", vbCrLf) writer.WriteLine("VERSION:1.0{0}", vbCrLf) writer.WriteLine("BEGIN:VEVENT{0}", vbCrLf) writer.WriteLine("DTStart:{0}{1}", DateTime.Now.ToString("yyyyMMddTHHmm00Z"), vbCrLf) writer.WriteLine("DTEnd:{0}{1}", DateTime.Now.AddHours(2).ToString("yyyyMMddTHHmm00Z"), vbCrLf) writer.WriteLine("DESCRIPTION:{0}", body) writer.WriteLine("X-ALT-DESC;FMTTYPE=text/html:{0}", body) writer.WriteLine("SUMMARY;ENCODING=QUOTED-PRINTABLE:{0}{1}", Test event, vbCrLf) writer.WriteLine("PRIORITY:3{0}", vbCrLf) writer.WriteLine("END:VEVENT{0}", vbCrLf) writer.WriteLine("END:VCALENDAR{0}", vbCrLf)
據生成VCS文件並在打開文件是在Outlook 2010與主體打開,開始時間和結束時間與正確的值。
我們給出的描述是html格式,但它顯示爲純文本。
所以我們如何顯示html描述。