Alex Sham
Alex Sham

Reputation: 458

How to add row header to crosstab?

I am using crosstab with 7 row groups in Jasper Studio. Here is the result, that I get.

real result

So you can see, that it's quite difficult to understand, what data is presented in Row Groups. I'd like to add Row Group Headers, but there is no clear way to perform it!

Here is the result, that I expect.

expected result

I've tried to add static text, but it intersects with crosstab element and disappears, when report is exported to Excel. Is there any way to add row group headers to crosstab?

Upvotes: 1

Views: 5025

Answers (1)

Petter Friberg
Petter Friberg

Reputation: 21710

This header since you have no <crosstabTotalRowHeader> can be added in the <crosstabHeaderCell>

Example

<crosstab columnBreakOffset="100">
    <reportElement x="0" y="0" width="802" height="443" uuid="a9b70522-f87a-4366-9ab5-934ed94b02f6"/>
    <crosstabHeaderCell>
        <cellContents>
            <staticText>
                <reportElement style="Crosstab Data Text" x="0" y="0" width="100" height="26" uuid="0696b52c-76ef-46ef-a7f5-d5edffd1177f"/>
                <text><![CDATA[City]]></text>
            </staticText>
            <staticText>
                <reportElement style="Crosstab Data Text" x="100" y="0" width="100" height="26" uuid="336200c6-96c6-4eb1-b3ab-5cbeeb55c81c"/>
                <text><![CDATA[Accident date]]></text>
            </staticText>
            .....
       </cellContents>
   </crosstabHeaderCell>
   <rowGroup name="city" width="100">
   ....
</crosstab>

I tested to export to excel and could find no problem.

Upvotes: 4

Related Questions