alignment - Jasper Reports - align dynamic text fields and their labels horizontally -


i'm using jasper report 5.2, ireport 5.2 , exporting report in rtf , pdf formats.

in report want add few text fields along (static text)labels aligned horizontally

         name:  $f{name}           age:  $f{age} date of birth:  $f{dateofbirth} 

but i'm unable align them. tried

  • position type: float (for static text , fields)
  • stretch type: no stretch (for static text , fields)
  • stretch overflow: true (for dynamic text fields)

the image shows , want. moreover, text field's content dynamic i.e. content size vary. enter image description here

i've read many forums not find solution, please suggest.

thanks

it can done of container - frame element.

you should put frame position type float , put them both statictext (label) , textfield.

for textfield i've set position type float stretch overlfow true.

the sample

the jrxml file:

<?xml version="1.0" encoding="utf-8"?> <jasperreport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="textfields_allign" language="groovy" pagewidth="595" pageheight="842" whennodatatype="allsectionsnodetail" columnwidth="555" leftmargin="20" rightmargin="20" topmargin="20" bottommargin="20" uuid="d855bf18-5e9b-4060-8caa-3fdd08abce3b">     <parameter name="name" class="java.lang.string"/>     <parameter name="id" class="java.lang.string"/>     <parameter name="date" class="java.lang.string"/>     <title>         <band height="69" splittype="stretch">             <frame>                 <reportelement uuid="314bfd5b-7b0a-42f4-aca3-e61f0283f126" positiontype="float" x="213" y="1" width="243" height="20"/>                 <statictext>                     <reportelement uuid="e07201bb-a677-4dc9-a332-f94e6eca2722" positiontype="float" x="0" y="0" width="100" height="20" isprintwhendetailoverflows="true"/>                     <textelement/>                     <text><![cdata[name]]></text>                 </statictext>                 <textfield isstretchwithoverflow="true">                     <reportelement uuid="66c93a44-9015-4ae9-bf05-b68b2420f3ef" positiontype="float" x="121" y="0" width="100" height="20" isprintwhendetailoverflows="true"/>                     <textelement/>                     <textfieldexpression><![cdata[$p{name}]]></textfieldexpression>                 </textfield>             </frame>             <frame>                 <reportelement uuid="8311a483-955e-4280-a9ac-513d7d34495b" positiontype="float" x="213" y="21" width="243" height="20"/>                 <statictext>                     <reportelement uuid="da404b4e-7908-40ae-8e1b-38e19d9ddc7f" positiontype="float" x="0" y="0" width="100" height="20" isprintwhendetailoverflows="true"/>                     <textelement/>                     <text><![cdata[id]]></text>                 </statictext>                 <textfield isstretchwithoverflow="true">                     <reportelement uuid="e0e312e8-cd2f-48af-8ae8-df95c6195488" positiontype="float" x="121" y="0" width="100" height="20" isprintwhendetailoverflows="true"/>                     <textelement/>                     <textfieldexpression><![cdata[$p{id}]]></textfieldexpression>                 </textfield>             </frame>             <frame>                 <reportelement uuid="8ff2baf9-b0ec-4c8a-b54a-9edd08b200cc" positiontype="float" x="213" y="41" width="243" height="20"/>                 <statictext>                     <reportelement uuid="b8d97db0-250a-43c8-a2f3-2fa3668c5d15" positiontype="float" x="0" y="0" width="100" height="20" isprintwhendetailoverflows="true"/>                     <textelement/>                     <text><![cdata[date]]></text>                 </statictext>                 <textfield isstretchwithoverflow="true">                     <reportelement uuid="4daa4d17-28be-4ac8-8e1e-2efbeec5f690" positiontype="float" x="121" y="0" width="100" height="20" isprintwhendetailoverflows="true"/>                     <textelement/>                     <textfieldexpression><![cdata[$p{date}]]></textfieldexpression>                 </textfield>             </frame>         </band>     </title> </jasperreport> 

the report's design in ireport:

enter image description here

the result (via ireport preview):

enter image description here


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -