tedhill Posted March 17, 2011 Share Posted March 17, 2011 I am trying to create a simple report based on a JTable TableModel for a data source.My problem is with the column names.In my jrxml file I have done this for column names:=======================================<field name="COLUMN_0" class="java.lang.String"/><columnHeader> <band height="61" splitType="Stretch"> <staticText> <reportElement x="26" y="0" width="100" height="20"/> <textElement> <font size="12" isBold="true"/> </textElement> <text><![CDATA[COLUMN_0]]></text> </staticText> </band> </columnHeader>and this for a table row cell:=====================<detail> <band height="42" splitType="Stretch"> <textField> <reportElement x="26" y="0" width="100" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{COLUMN_0}]]></textFieldExpression> </textField></detail>In the finished report, the content of the rows is the data pulled from the TableModel, this is good.However, the names of the columns are not being pulled from the TableModel data source, they appear as the stringsCOLUMN_0, etc.How can I get the column names from the TableModel to appear in the report without "hard coding" them into the jrxml?Is there some way to pass the column names as a parameter list and then access the parameters in the jrxml file?Thanks,Ted Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now