我们使用以下代码创建了一个 vcs 文件。
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描述。