Text Format Problem???

Stimulsoft Reports.NET discussion
Post Reply
jayakumargr
Posts: 85
Joined: Sat Jan 20, 2007 4:21 am

Text Format Problem???

Post by jayakumargr »

Hi,
I want to set Text Format to Particular Text. the Text(Numeric Field) Contains the value like 12.300000. I want this value as 12.30 only.

So i set Text Format as Like,

Text1.TextFormat = new Stimulsoft.Report.Components.TextFormats.StiNumberFormatService(1, ".", 2, ",", 4, true, false, " ");

It doesn't Work ???

Please Provide the Solutions...


Thanks in Advance,
Jayakumar

Guest
Posts: 182
Joined: Tue Jun 06, 2006 8:04 am

Text Format Problem???

Post by Guest »

Try to use: Text1.Text = String.Format("{0:0.00}", 12.300000);

Thank you.
atryass
Posts: 33
Joined: Mon Sep 15, 2008 7:42 am
Location: Iran

Text Format Problem???

Post by atryass »

tanx for your reply
but I have a StiText in DataBand and I change Format String in designer and don't work.
how can i set formating to StiText in DataBand in my c# Code?
or is a better way?
becuse I have too many StiText that I want to change format.(about 100)!!
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Text Format Problem???

Post by Jan »

Hello,

You can use following code:

Code: Select all

StiComponentsCollection comps = report.GetComponents();
foreach (StiComponent comp in comps)
{
  StiText text = comp as StiText;
  if (text != null)
  {
     text.TextFormat = .....//new text format
  }
}
Thank you.
atryass
Posts: 33
Joined: Mon Sep 15, 2008 7:42 am
Location: Iran

Text Format Problem???

Post by atryass »

StiComponentsCollection comps = report.GetComponents();
foreach (StiComponent comp in comps)
{
StiText text = comp as StiText;
if (text != null)
{
text.TextFormat = .....//new text format
}
}
i use this code before but it does not work for my report.
but below code work for me:

Code: Select all

text.Text = String.Format("{0:N2}", value)
but my problem is there that i don't know my value of text because it is on the DataBand and bind to one column of data base that have a variable value in every row of report.
plz help me.

Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Text Format Problem???

Post by Jan »

Hello,

Try to use following expression:

Code: Select all

{Products.UnitPrice.ToString("N2")}
Thank you.
Post Reply