是否有可能将 html 添加到 vevent 的描述中。
我生成一个 VCALENDAR
和一个带有描述的 VEVENT
。我用 Ical4j使用 ICS
这是我尝试做的:
BEGIN:VCALENDAR
PRODID:-//----//Calendar 1.0//ES
VERSION:2.0
METHOD:REQUEST
CALSCALE:GREGORIAN
BEGIN:VEVENT
DTSTAMP:20101202T145512Z
UID:20101202T145513Z-project@myPc
DESCRIPTION:ALTREP="CID:content-id-here":BlaBla
LOCATION:Room 2
SUMMARY:Confirmation
DTSTART:20110115T180000
DTEND:20110115T184500
ATTENDEE;ROLE=REQ-PARTICIPANT:mailto:foo@bar.com
ORGANIZER;SENT-BY=EyeContact:mailto:foo@bar.com
END:VEVENT
END:VCALENDAR
Content-Type:text/html
Content-Id:content-id-here
<html>
<head>
<title></title>
</head>
<body>
<p>
<b>Example</b>
</p>
</body>
</html>
现在它只显示 HTML 代码。
上面的日历我放在一个MultiPart中
message.addHeaderLine("method=REQUEST");
message.addHeaderLine("charset=UTF-8");
message.addHeaderLine("component=vevent");
message.setFrom(new InternetAddress(fromAddress));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(app.getPanelist().getEmail()));
message.setSubject(subject);
Multipart mp = new MimeMultipart();
MimeBodyPart iCalAttachment = new MimeBodyPart();
iCalAttachment.setDataHandler(new DataHandler(new ByteArrayDataSource(new ByteArrayInputStream(invite), "text/calendar;method=REQUEST;charset=\"UTF-8\"")));
mp.addBodyPart(iCalAttachment);
message.setContent(mp);
我错过了一部分还是不可能?
编辑 - 我尝试用 iCal4j 做什么(使用 Altrep)
ParameterList params = new ParameterList();
URI uri = new URI("CID:content-id-here");
params.add(new AltRep(uri));
vEvent.getProperties().add(new Description(params,_content));
但是上面的代码让我卡住了。有人提出将 HTML 与 iCall4j 结合使用的想法
最佳答案
我在这个博客中找到了解决方案:
http://valermicle.blogspot.com/2009/02/i-was-searching-for-documentations-on.html
以正确的方式使用 MultiPart 解决了问题
关于java - iCal 中的 HTML 使用 iCal4j,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4336432/