POI 4 XPages – document generation works only once

Oliver, add the client-side JS call XSP.allowSubmit() to your button in order to allow new submits after pressing the button: <xp:button id=”button5″ styleClass=”btn btn-sm printbutton” style=”display:none”> <i class=”fa fa-print”></i> &#160; <xp:text> <xp:this.value><![CDATA[#{javascript:”Nach MS Word exportieren”}]]></xp:this.value> </xp:text> <xp:eventHandler event=”onclick” submit=”true” refreshMode=”complete”> <xp:this.action> <xp:actionGroup> <xp_1:generateDocument documentId=”wordprint” loaded=”true”> </xp_1:generateDocument> </xp:actionGroup> </xp:this.action> <xp:this.script><![CDATA[XSP.allowSubmit()]]></xp:this.script> </xp:eventHandler> </xp:button>

How to create a Word Document using Apache POI?

Your attached code file “DownloadAsMicrosoftWordDocument.java.txt” has a coding for file download functionality; no Word document creation. As you looking for Word Document creation, please find references below: HWPF Reference(.doc): POI trunk doesn’t have examples as XWPF do, However POI Scratchpad has Testcases around it, please find POI Scratchpad Javadoc HWPFDocument Javadoc org.apache.poi.hwpf.usermodel XWPF Reference(.docx): Examples … Read more