0
votes

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
OT: why would anyone want to convert MIME to Richtext? I think that way would cause more trouble than having it in MIME - except your app has to display it "comfortably" in the client.Oliver Busse
@OliverBusse: I have to deal with a 3rd party pdf renderer which works better with RichText instead of MIME.Georg Kastenhofer
@KnutHerrmann: Thanks for your answer, I will try it...Georg Kastenhofer
@KnutHerrmann: I have rewritten the code (www-10.lotus.com/ldd/nd85forum.nsf/…) in SSJS but It doesn't work for me :(Georg Kastenhofer

1 Answers

4
votes

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.