Format Decimal Point

Stimulsoft Reports.NET discussion
Post Reply
Siang Hwee
Posts: 50
Joined: Mon Mar 26, 2007 6:32 pm
Location: Malaysia

Format Decimal Point

Post by Siang Hwee »

Hi,

I want to format the decimal value to 2 decimal point such as 1,234.56 thru the StiText component in C#. I found there is a property call TextFormat and a method call Format. But i just have no idea how to format the data. Please assist.

Thanks and Regards,
Goh
Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

Format Decimal Point

Post by Brendan »

Hi,

Yes, you can use the TextFormat Property. You can right click on the text component and choose 'Text Format' from the context menu or press the elipsis button from the properties window.

This will bring up the Text Formatting window and from here you can choose 'Number' from the listing on the left. I think the default options maybe be all you need but these might initally come from your regional settings.

Siang Hwee
Posts: 50
Joined: Mon Mar 26, 2007 6:32 pm
Location: Malaysia

Format Decimal Point

Post by Siang Hwee »

Brendan,

Thanks for your reply. What i need is actually format from programming side. inside the C# code i found the StiText object has the property TextFormat but i just don't know how to format thru this property, besides, there is another property StringFormat but not clear how to use it. Please assist.

Thanks and Regards,
Goh
Brendan wrote:Hi,

Yes, you can use the TextFormat Property. You can right click on the text component and choose 'Text Format' from the context menu or press the elipsis button from the properties window.

This will bring up the Text Formatting window and from here you can choose 'Number' from the listing on the left. I think the default options maybe be all you need but these might initally come from your regional settings.
Brendan
Posts: 309
Joined: Sun Jul 16, 2006 12:42 pm
Location: Ireland

Format Decimal Point

Post by Brendan »

Hi,

When setting the TextFormat property through code for an StiText entity you can use the StiNumberFormatService class.

Code: Select all

txtName.TextFormat = new Stimulsoft.Report.Components.TextFormats.StiNumberFormatService(1, ".", 2, ",", 3, true, true, " ");
where txtName is an StiText instance.

The StiNumberFormatService has an overloaded constructor for different options.
Siang Hwee
Posts: 50
Joined: Mon Mar 26, 2007 6:32 pm
Location: Malaysia

Format Decimal Point

Post by Siang Hwee »

Thanks for your help. My problem solved.

Post Reply