Convert MIME to RichText

心不动则不痛 提交于 2020-01-16 12:22:49

问题


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!


回答1:


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.



来源:https://stackoverflow.com/questions/31273275/convert-mime-to-richtext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!