Problem formating textfields

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>
2002 JI Open Discussion's picture
Joined: Aug 10 2006 - 3:28am
Last seen: 16 years 9 months ago

0 Answers:

No answers yet
Feedback