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

Problem formating textfields


Recommended Posts

By: Jessica Daniel - jrdatorbital

Problem formating textfields

2003-02-03 12:26

I am having trouble getting my report to respond to the pattern I have set. I have included the code segment and resulting xml. Any suggestions appreciated. The pattern is stored in a database table and retrieved using a sql result set.

Thanks

Jessica

 

Code

//detail

textField = new JRDesignTextField();

 

if(cInfo.getColumnOrder() == cInfo.getColumnCount()){

textField.setWidth(cInfo.getColumnWidth() + columnInfo.getLastColumnPadding());

}else{

textField.setWidth(cInfo.getColumnWidth() + columnInfo.getColumnPadding());

}

 

textField.setHeight(10);

textField.setX(columnInfo.getXColumn());

textField.setY(1);

font.setReportFont(fonts[7]);

textField.setFont(font);

textField.setForecolor(color.BLACK);

textField.setPattern(cInfo.getAttribute().getFormat());

textField.setMode(textField.MODE_OPAQUE);

textField.setPositionType(textField.POSITION_TYPE_FIX_RELATIVE_TO_TOP);

 

if(cInfo.getAttribute().getJustification().equals("Left")){

textField.setTextAlignment(element.TEXT_ALIGN_LEFT);

}else{

textField.setTextAlignment(element.TEXT_ALIGN_RIGHT);

}

 

//set textField expression

JRDesignExpression expression = new JRDesignExpression();

 

expression.setText("$F{" + cInfo.getFieldName() + "}");

expression.setName(cInfo.getColumnName());

 

valueClass = getValueClassName(cInfo.getDataType());

expression.setValueClass(valueClass);

textField.setExpression(expression);

 

detailChildren.add(textField);

 

Generated SQL

 

<textField pattern="#0.0" isStretchWithOverflow="false" evaluationTime="Now" isBlankWhenNull="false" hyperlinkType="None">

<reportElement mode="Opaque" x="228" y="1" width="45" height="10" positionType="FixRelativeToTop" isPrintRepeatedValues="true" isRemoveLineWhenBlank="false" isPrintInFirstWholeBand="false" isPrintWhenDetailOverflows="false" />

- <textElement textAlignment="Right" lineSpacing="Single">

<font reportFont="SubColumn" />

</textElement>

- <textFieldExpression class="java.lang.Double">

- <![CDATA[ $F{DrySandRate}

]]>

</textFieldExpression>

</textField>

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

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...