Jump to content
We've recently updated our Privacy Statement, available here ×

How to combine the two line table header into one row in excel?


yongkang

Recommended Posts

Hi Guys,

I have a table like below, and I use jasper report jasperreports-6.5.1.jar to generate the report.

Role Name             |             Role Access Timing
                               |               From                  |             To
ADMINISTRATOR   |   27 Sep 2012 16:00 hrs  |  02 Jan 2050 16:00 hrs

I had put the 4 labels in "Column Header", when it generated pdf no issue , there is a empty cell next to "Role Name" when generated as excel(before use jasper report 3.7.1 no such issue).

Below is my config before generate the report.

         SimpleXlsReportConfiguration config = new SimpleXlsReportConfiguration();

            config.setOnePagePerSheet(true);
            config.setRemoveEmptySpaceBetweenColumns(Boolean.TRUE);
            config.setRemoveEmptySpaceBetweenRows(Boolean.TRUE);
            config.setCollapseRowSpan(Boolean.TRUE);

Is there any way to set the "Role Name" rowspan as 2?

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi Pavlo, 

      Below is column header in jrxml:

<columnHeader>
    <band height="60" splitType="Stretch">
        <staticText>
            <reportElement x="0" y="0" width="802" height="20" />
            <textElement verticalAlignment="Middle">
                <font fontName="Arial" size="10" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1256" isPdfEmbedded="true"/>
            </textElement>
            <text><![CDATA[Table 1 - Role Access Timing]]></text>
        </staticText>
        <staticText>
            <reportElement style="table" x="0" y="20" width="35" height="40" >
                <property name="com.jaspersoft.layout.grid.rowspan" value="2"/>
            </reportElement>
            <textElement textAlignment="Center" verticalAlignment="Middle">
                <font fontName="Arial" size="10" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1256" isPdfEmbedded="true"/>
            </textElement>
            <text><![CDATA[s/No.]]></text>
        </staticText>
        <staticText>
            <reportElement style="table" x="35" y="20" width="110" height="40" >
                <property name="com.jaspersoft.layout.grid.rowspan" value="2"/>
            </reportElement>
            <textElement textAlignment="Center" verticalAlignment="Middle">
                <font fontName="Arial" size="10" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1256" isPdfEmbedded="true"/>
            </textElement>
            <text><![CDATA[Role Name]]></text>
        </staticText>
        <staticText>
            <reportElement style="table" x="145" y="20" width="100" height="40" >
                <property name="com.jaspersoft.layout.grid.rowspan" value="2"/>
            </reportElement>
            <textElement textAlignment="Center" verticalAlignment="Middle">
                <font fontName="Arial" size="10" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1256" isPdfEmbedded="true"/>
            </textElement>
            <text><![CDATA[Role Status]]></text>
        </staticText>
        <elementGroup>
            <staticText>
                <reportElement style="table" x="485" y="40" width="40" height="20" />
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Arial" size="10" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1256" isPdfEmbedded="true"/>
                </textElement>
                <text><![CDATA[Daily]]></text>
            </staticText>
            <staticText>
                <reportElement style="table" x="365" y="40" width="120" height="20" />
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Arial" size="10" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1256" isPdfEmbedded="true"/>
                </textElement>
                <text><![CDATA[To]]></text>
            </staticText>
            <staticText>
                <reportElement style="table" x="245" y="20" width="280" height="20" >
                    <property name="com.jaspersoft.layout.grid.colspan" value="3"/>
                </reportElement>
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Arial" size="10" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1256" isPdfEmbedded="true"/>
                </textElement>
                <text><![CDATA[Role Access Timing]]></text>
            </staticText>
            <staticText>
                <reportElement style="table" x="245" y="40" width="120" height="20" />
                <textElement textAlignment="Center" verticalAlignment="Middle">
                    <font fontName="Arial" size="10" isBold="true" pdfFontName="Helvetica-Bold" pdfEncoding="Cp1256" isPdfEmbedded="true"/>
                </textElement>
                <text><![CDATA[From]]></text>
            </staticText>
        </elementGroup>
    </band>
</columnHeader>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...