• Export to MicroSoft word - working very badly

    By Lisa Gerlich 8 years ago

    Hello,
    I have just spent the afternoon attempting to utilize the POI Document widget to export data to a word document.

    Our version of Lotus Notes is

    Release 9.0.1
    Revision 20131022.1138 (Release 9.0.1)
    Standard Configuration
    L-GHUS-968PRV

    With
    1.2.6.201312211419 versions of the biz.webgate poi libraries.

    The excel functionality has worked well. The word functionality does not work well at all. Sometimes, I will be able to export one field. Here is the source code to a very simple example:


    <xp:view xmlns:xp=“http://www.ibm.com/xsp/core” xmlns:xc=“http://www.ibm.com/xsp/custom”

    xmlns:wgpoi="http://www.webgate.biz/xsp/poi">
    <xp:this.beforeRenderResponse><![CDATA[#{javascript:sessionScope.Firstname = "Lisa";
    

    sessionScope.Lastname = “Gerlich”}]]>

    <xp:panel id="WrapperPanel">
        <xp:div align="left">
            <xp:table styleClass="ApplicationRadio">
                <xp:tr>
                    <xp:td align="left">
                        <xp:label id="label4" value="Today's Date">
                        </xp:label>
                        :
                    </xp:td>
                    <xp:td align="left">
                        <xp:text escape="true" id="computedField1">
                            <xp:this.converter>
                                <xp:convertDateTime type="both">
                                </xp:convertDateTime>
                            </xp:this.converter>
                            <xp:this.value><![CDATA[#{javascript:sessionScope.now = new Date();
    

    return sessionScope.now;}]]>

                        </xp:text>
                    </xp:td>
                </xp:tr>
                <xp:tr>
                    <xp:td></xp:td>
                    <xp:td></xp:td>
                </xp:tr>
                <xp:tr>
                    <xp:td align="left">
                        <xp:label id="label5" value="Firstname:  ">
                        </xp:label>
                    </xp:td>
                    <xp:td align="left">
                        <xp:text escape="true" id="computedField2" value="#{sessionScope.Firstname}">
                        </xp:text>
                    </xp:td>
                </xp:tr>
                <xp:tr>
                    <xp:td align="left">
                        <xp:label id="label6" value="Lastname:">
                        </xp:label>
                    </xp:td>
                    <xp:td align="left">
                        <xp:text escape="true" id="computedField3" value="#{sessionScope.Lastname}">
                        </xp:text>
                    </xp:td>
                </xp:tr>
                <xp:tr>
                    <xp:td></xp:td>
                    <xp:td></xp:td>
                </xp:tr>
                <xp:tr>
                    <xp:td colspan="2" align="center">
                        <xp:button disableTheme="true" id="button1" value="Print to Word">
                            <xp:eventHandler event="onclick" submit="true"
                                refreshMode="complete" id="eventHandler1">
                                <xp:this.action>
                                    <wgpoi:generateDocument documentId="docexport">
                                    </wgpoi:generateDocument>
                                </xp:this.action>
                            </xp:eventHandler>
                        </xp:button>
                        <wgpoi:document id="docexport" downloadFileName="info.docx">
                            <wgpoi:this.templateSource>
                                <wgpoi:resourcetemplate fileName="Simple.docx">
                                </wgpoi:resourcetemplate>
                            </wgpoi:this.templateSource>
                            <wgpoi:this.bookmarks>
                                <wgpoi:docbookmark value="#{javascript:sessionScope.Firstname}"
                                    name="Firstname">
                                </wgpoi:docbookmark>
                                <wgpoi:docbookmark value="#{javascript:sessionScope.Lastname}"
                                    name="Lastname">
                                </wgpoi:docbookmark>
                            </wgpoi:this.bookmarks>
                        </wgpoi:document>
                    </xp:td>
                </xp:tr>
            </xp:table>
        </xp:div>
    </xp:panel>
    

    The microsoft docx looks like this:

    <>

    <>

    Here is the resulting export:

    «Firstname»

    Gerlich


    I know there must be people out there using this functionality successfully. At least I hope so, we could really use this.


    Thanks,

    —Lisa&

    • By Christian Güdemann 8 years ago

      Hi Lisa

      The
      effect is well known, has mostly to do with the spellchecker. Please
      shutdown the spellchecker in word and resave your template.

      Best regards
      Christian

      • By Lisa Gerlich 8 years ago

        Indeed it was the spellchecker. Once I disabled the spellchecker and created a fresh template, everything exported beautifully.
        Thanks so much for the POI4XPages libraries. It is a great help.
        —Lisa&