number formating

Stimulsoft Reports.NET discussion
Post Reply
lubosh
Posts: 2
Joined: Wed Mar 07, 2007 3:00 pm

number formating

Post by lubosh »

Hi,

I have a decimal input, I need to format this number on the report in a way, that value 25.5 will display as 25.50, -25.5 will display as (25.50) and zero will display as "-" (simple dash).

usually I would format this number with format string "f2;(f2);-" but that doesn't seem to work in your control.

Any suggestions?
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

number formating

Post by Edward »

Please use the following expression in the Text property of the StiText component:

In the case of the DataColumn with the decimal type:

Code: Select all

{MyDataSource.MyDataColumn.ToString(“#0.00;(#0.00);-“)}
In the case of the column with the string type:

Code: Select all

{decimal.Parse(MyDataSource.MyDataColumn).ToString(“#0.00;(#0.00);-“)}
Thank you.
lubosh
Posts: 2
Joined: Wed Mar 07, 2007 3:00 pm

number formating

Post by lubosh »

thanks a lot. that makes perfect sense, I had no idea I can use .NET methods on my variables in your designer. anyway, that makes whole thing a lot more flexible.

problem solved, thanks again
Vital
Posts: 1278
Joined: Fri Jun 09, 2006 4:04 am

number formating

Post by Vital »

Please contact us if you need any help.

Thank you.
Post Reply