I created a webpage and want to allow the users to export the content of the pages. For that I used the Apache-POI libs. That works fine for text. But how can I export mime content? If I change the rich-text properties to 'Store content as html/mime' (because I want to format the content in Notes and sometimes the content contains an image). If that is not possible what are useable alternatives in a xpage?
The code below will be executed as a xAgent.
Thanks Armin
importPackage(java.io);
importPackage(org.apache.poi.hwpf);
importPackage(org.apache.poi.hwpf.usermodel);
importPackage(org.apache.poi.poifs.filesystem);
var docID = sessionScope.contentUNID;
var nv:NotesView = database.getView("(allByKey)");
var doc:NotesDocument = nv.getDocumentByKey(docID, true);
var fs:POIFSFileSystem = new POIFSFileSystem(new FileInputStream("empty.doc"));
var wdoc:HWPFDocument = new HWPFDocument(fs);
var wdRange:Range = wdoc.getRange();
wdRange.insertBefore(doc.getItemValueString("title"));
wdRange.insertAfter(doc.getMIMEEntity("content")); !!!doesn'twork
var extCont = facesContext.getExternalContext();
var pageResponse = extCont.getResponse();
var pageOutput = pageResponse.getOutputStream();
pageResponse.setContentType("application/vnd.ms-word");
pageResponse.setHeader("Cache-Control", "no-cache");
pageResponse.setHeader("Content-Disposition","inline; filename=export.doc");
wdoc.write(pageOutput);
pageOutput.flush();
pageOutput.close();
facesContext.responseComplete();