问题描述
我想使用SSJS
或Java
将Data 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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!