Convert MIME to RichText

前端 未结 1 1464
自闭症患者
自闭症患者 2021-01-28 23:44

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

1条回答
  •  情话喂你
    2021-01-29 00:28

    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.

    0 讨论(0)
提交回复
热议问题