pmartha
pmartha

Reputation: 87

Unable to add extra content into exported word doument from jasper report

I am using TIBCO Jaspersoft Studio-6.2.0.final for generating report . I am able to generate report in word (.docx).

I added some sample text. In export word sample text shown inside a frame. But when I am trying to update or add any extra text into that report in word, its hiding inside the frame. When I expand that frame, then it showing.

How I can generate report in word without any frame like normal word? So that I can add any text, so it will show normally.

Below I added jrxml code.

<queryString>
    <![CDATA[SELECT 1 FROM DUal]]>
</queryString>
<field name="1" class="java.math.BigDecimal"/>
<detail>
    <band height="20" splitType="Stretch">
        <textField isStretchWithOverflow="true" isBlankWhenNull="true">
            <reportElement x="0" y="1" width="510" height="19" uuid="68ec5b9f-416e-45d6-b2aa-4d1f31a08250">
                <property name="com.jaspersoft.studio.unit.x" value="pixel"/>
                <property name="com.jaspersoft.studio.unit.y" value="pixel"/>
            </reportElement>
            <textElement>
                <font fontName="Arial" size="11"/>
            </textElement>
            <textFieldExpression><![CDATA["This is the sample text for testing.To test in word"]]></textFieldExpression>
        </textField>
    </band>
</detail>

Update: Is any one having any update on this?

Upvotes: 1

Views: 1169

Answers (2)

MrDemien
MrDemien

Reputation: 74

Jasper export .docx as grid/table. In your exported document use Layout -> View Gridlines to show those tables. You can edit them manually if it's a single report what you need. Else, check Aspose library or try to implement manually a custom exporter.
If your only problem is that fields doesn't expand when you write, just add this code to your report properties:

<property name="net.sf.jasperreports.export.docx.flexible.row.height" value="true"/>  

Upvotes: 0

shertage
shertage

Reputation: 236

Currently there is no possibility to generate paragraph-oriented docx content. The built-in .docx exporter is a grid-layout exporter, so it will generate a table-based document. This is why enclosing frames/table cells are present in the document. Even if you'd use a single huge textfield for your entire document, a table with a single cell will be generated as docx output. The only way to get the desired behavior is to implement and use a custom paragraph-oriented docx exporter, based on existing JasperReports APIs.

I hope this helps.

Upvotes: 0

Related Questions