将MIME转换为RichText [英] Convert MIME to RichText

查看:194
本文介绍了将MIME转换为RichText的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用SSJSJavaData Type: MIME Part的Domino文档字段转换为后端中的Data Type: Rich Text吗?


我尝试与

合作

doc.computeWithForm(true, true);
doc.save(true, true);

但是这段代码没有效果.


提示:我可以使用前端中的Notes客户端(打开并保存文档)进行此转换,而不会出现任何问题.

有什么主意吗?预先感谢!

解决方案

作为API中自动将MIME转换为CD的通常不希望的副作用,您可以执行此操作.例如,这样的代码会将DB中第一个文档的正文"字段从MIME转换为复合数据:

boolean convertMime = session.isConvertMime();
session.setConvertMime(true);
Document doc = database.getAllDocuments().getFirstDocument();
RichTextItem rtitem = (RichTextItem)doc.getFirstItem("Body");
rtitem.compact();

doc.save();
session.setConvertMime(convertMime);

通过确保会话正在转换MIME(默认情况下为true,但最好保留任何先前存在的值),然后与MIME_PART项进行交互,它将为您将其转换为CD. /p>

I would like to convert a domino document field of Data Type: MIME Part into a Data Type: Rich Text in backend with SSJS or Java?


I have tried to work with

doc.computeWithForm(true, true);
doc.save(true, true);

but this piece of code has no effect.


Hint: I can do this conversion with a notes client in frontend (open and save the document) without any problems.

Any idea? Thanks in advance!

解决方案

You may be able to do this as part of the usually-undesirable side effect of automatic MIME-to-CD conversion in the API. For example, code like this will turn the Body field of the first doc in the DB from MIME to composite data:

boolean convertMime = session.isConvertMime();
session.setConvertMime(true);
Document doc = database.getAllDocuments().getFirstDocument();
RichTextItem rtitem = (RichTextItem)doc.getFirstItem("Body");
rtitem.compact();

doc.save();
session.setConvertMime(convertMime);

By making sure that the session is converting MIME (which is true by default, but it's best to maintain any previously-existing value) and then interacting with the MIME_PART item, it will mangle it into CD for you.

这篇关于将MIME转换为RichText的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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