use of com.ibm.domino.napi.c.html.HtmlConverter 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 ("");
}
Aggregations