如何将存储在富文本项目中的html添加到Xpages中的HTMLMail [英] How to add html stored in a richtext item to an HTMLMail in Xpages

查看:293
本文介绍了如何将存储在富文本项目中的html添加到Xpages中的HTMLMail的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在电子邮件中添加html,因此我使用Mark Leusink HTMLMail SSJS函数。
我拥有的是一个richtext字段,它看起来像这样。

I need to add html to an email so I use Mark Leusink HTMLMail SSJS function. The html I have is in a richtext field and it looks like this.

"Content-Type: text/html; charset="utf-8"

<p dir="ltr">
 Test1</p>
<p dir="ltr">
 Test12</p>
<p dir="ltr">
 Test3</p>
<p dir="ltr">
Test4</p>
<p dir="ltr">
 &nbsp;</p>"

使用xpages中的标准RT编辑器填充rt字段的内容

The content of the rt field is filled using the standard RT Editor in xpages

我已经尝试这些方法来添加rt到电子邮件。 mail是html函数,rt是存储内容的richtextitem

I have tried these method to add the rt to the email. "mail" is the html function and "rt" is the richtextitem where the content is stored

mail.addHTML(rt.getFormattedText(false,0,0));
mail.addHTML(rt.getUnformattedText();

但是当我收到电子邮件html不保留,文本没有段落显示,

But when I recieve the email the html is not preserved and the text is displayed without paragraphs,

如何将richtext字段的内容添加到html邮件中,并保留rt中的html字段

How can I add the content of the richtext field to an html mail and preserve the html that is in the rt field

谢谢

托马斯

推荐答案

如果您使用 wrapDocument XSnippet 将NotesDocument转换成NotesXspDocument,然后可以在NotesXspDocument上调用.getHTML(),这样可以给出文档的HTML表示。

If you use the wrapDocument XSnippet to convert NotesDocument into NotesXspDocument, you can then call .getHTML() on the NotesXspDocument. This should give you the HTML representation of the document.

I使用它从现有的后端文档中更新CKEditor字段的内容。请参阅我的博客文章: http://per.lausten.dk/blog/2012/12/xpages-dynamically-updating-rich-text-content-in-a-ckeditor.html

I use it to update the contents of a CKEditor field with the content from an existing backend document. See my blog post on this: http://per.lausten.dk/blog/2012/12/xpages-dynamically-updating-rich-text-content-in-a-ckeditor.html

这篇关于如何将存储在富文本项目中的html添加到Xpages中的HTMLMail的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆