Search in sources :

Example 1 with HtmlReferenceData

use of com.ibm.domino.napi.c.html.HtmlReferenceData in project org.openntf.domino by OpenNTF.

the class RTtoHTMLUtil method getCustomText.

private static String getCustomText(final Document document, final String richTextName, final Map<String, Integer> converterArgs) {
    HtmlConverter htmlConverter = new HtmlConverter();
    try {
        htmlConverter.open();
        htmlConverter.setDBHandle(BackendBridge.getDatabaseHandleRO(document.getParentDatabase()));
        htmlConverter.setNoteHandle(BackendBridge.getDocumentHandleRW(document));
        htmlConverter.setFieldName(richTextName);
        ArrayList<String> argArrayList = new ArrayList<String>();
        for (String key : converterArgs.keySet()) {
            argArrayList.add(key + "=" + converterArgs.get(key));
        }
        String[] args = new String[argArrayList.toArray().length];
        System.arraycopy(argArrayList.toArray(), 0, args, 0, argArrayList.toArray().length);
        htmlConverter.ConvertItem(args);
        int i = htmlConverter.getNumRefs();
        if (i > 0) {
            HtmlReferenceData[] refData = htmlConverter.getReferences();
            for (int j = 0; j < i; ++j) {
                int k = refData[j].getRefType();
                int l = refData[j].getCmdID();
                if ((l != 5) || (k != 2)) {
                    generateCID(refData[j], richTextName);
                }
            }
        }
        String result = htmlConverter.getConvertText();
        if (result == null) {
            htmlConverter.close();
        }
        if (StringUtil.isNotEmpty(result)) {
        // result = insertNotesClientLinks852(result);
        }
        return result;
    } catch (NException ne) {
        ne.printStackTrace();
    } catch (IOException ieo) {
        ieo.printStackTrace();
    } finally {
        try {
            htmlConverter.close();
        } catch (Throwable t) {
            t.printStackTrace();
        }
    }
    return ("");
}
Also used : NException(com.ibm.domino.napi.NException) ArrayList(java.util.ArrayList) HtmlReferenceData(com.ibm.domino.napi.c.html.HtmlReferenceData) HtmlConverter(com.ibm.domino.napi.c.html.HtmlConverter) IOException(java.io.IOException)

Aggregations

NException (com.ibm.domino.napi.NException)1 HtmlConverter (com.ibm.domino.napi.c.html.HtmlConverter)1 HtmlReferenceData (com.ibm.domino.napi.c.html.HtmlReferenceData)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1