问题
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