Quantcast
Channel: BIRT Exchange Forum Feed
Viewing all articles
Browse latest Browse all 542

Setting column decimal format with Java Design API

$
0
0
Hi, I am trying to set the format of a numeric cell using the Design API to 2 decimal places to no avail.

I have tried the method suggested by the following post : Changing column decimal format with the DE
to no avail.

My code looks like this:

String colFormat="#0.00";
DataItemHandle dih =(DataItemHandle)cell.getContent().get(0);
NumberFormatValue nfs=new NumberFormatValue();
nfs.setPattern(colFormat);
dih.clearProperty(StyleHandle.NUMBER_FORMAT_PROP);
dih.setProperty( StyleHandle.NUMBER_FORMAT_PROP, nfs );


but to no avail. It formats the string 1 only as "1.0" instead of "1.00" as I would expect.

I took a look at what was in the report design file and the XML for the column looks like this:

 <cell id="341">
                        <property name="paddingBottom">0.1pt</property>
                        <data name="data_ratio" id="342">
                            <structure name="numberFormat">
                                <property name="pattern">#0.00</property>
                            </structure>
                            <property name="textAlign">center</property>
                            <property name="height">8pt</property>
                            <property name="width">24pt</property>
                            <property name="resultSetColumn">ratio</property>
                        </data>
                    </cell>


Does anyone have any ideas?

Thanks.

Viewing all articles
Browse latest Browse all 542