In my document I had put a Rich Text field for file attachment. How to attach a file programmatically?(Provided the file path).
For other types (Text field for example) I can use replaceItemValue to assign the value. But it doesn’t work for rich text field. Here is my java agent example:
String field = “ExtraFile”; // field name
Item item = document.getFirstItem(field);
RichTextItem rit;
if (item == null) {
rit = doc.createRichTextItem(field);
}
else {
rit = (RichTextItem)item;
}
String filePath = “C:\Info.xls”;
rit.embedObject(EmbeddedObject.EMBED_ATTACHMENT, “”,filePath,“”);
document.replaceItemValue(field, rit);
There is an error “4263 Item value cannot be set to object of this type” when I run it.
Please advise. Thank you.