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

arunv

Members
  • Posts

    1
  • Joined

  • Last visited

arunv's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. I am generating a report in PDF,Html,Excel,CSV formats using JasperReport. I am getting the column header on each page of the report. In fact I need the column header only on the first page. I am using velocity to generate dynamic reports, i.e, the report fields can be dynamic. Please help... my .vm file is like below: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE jasperReport PUBLIC "-//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"> <jasperReport name="BasicReport" pageWidth="565" pageHeight="842" isIgnorePagination="false" columnWidth="545" leftMargin="10" rightMargin="10" topMargin="30" bottomMargin="30" resourceBundle="reports/rep1/rep1i18nprops"> <parameter name="BaseDir" class="java.io.File"></parameter> <parameter name="ImageFile" class="java.lang.String"></parameter> #foreach ($field in $fieldList) <field name="$field.name" class="$field.clazzName"></field> #end <title> #set( $baseDir = '$P{BaseDir}' ) #set( $imageFile = '$R{image}' ) <band height="50"> <line> <reportElement x="0" y="0" width="520" height="1" /> <graphicElement /> </line> <image scaleImage="Clip" vAlign="Middle"> <reportElement x="0" y="5" width="32" height="32" /> <graphicElement /> <imageExpression class="java.io.File"> <![CDATA[new File($baseDir, $imageFile)]]> </imageExpression> </image> #set( $reportTitle = '$R{title}' ) <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement x="40" y="10" width="420" height="30" /> <textElement textAlignment="Left"> <font size="24" isBold="true"/> </textElement> <textFieldExpression class="java.lang.String"><![CDATA[$reportTitle]]></textFieldExpression> </textField> </band> </title> <columnHeader> <band height="20"> #set( $x = 0 ) #foreach ($column in $columnList) #set( $reportColHeader = '"'+$column.name+'"') <textField isStretchWithOverflow="true" isBlankWhenNull="true"> <reportElement mode="Opaque" x="$x" y="5" width="$column.width" height="15" forecolor="#ffffff" backcolor="#bbbbbb" /> <textElement textAlignment="Left"> <font size="16" isItalic="true" pdfFontName="Helvetica-Oblique"/> </textElement> <textFieldExpression>str($reportColHeader)</textFieldExpression> </textField> #set( $x = $x + $column.width ) #end </band> </columnHeader> <detail> <band height="20"> #set( $x = 0 ) #foreach ($column in $columnList) <textField> <reportElement x="$x" y="4" width="$column.width" height="15" /> <textElement textAlignment="$column.alignment" /> <textFieldExpression class="$column.clazzType"> <![CDATA[$column.expression]]> </textFieldExpression> </textField> #set( $x = $x + $column.width ) #end <line> <reportElement positionType="Float" x="0" y="19" width="520" height="1" forecolor="#808080" /> <graphicElement /> </line> </band> </detail> </jasperReport>
×
×
  • Create New...