Page 1 of 1

Text Format Problem???

Posted: Tue Jun 19, 2007 4:43 am
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


Text Format Problem???

Posted: Tue Jun 19, 2007 9:36 am
by Guest
Try to use: Text1.Text = String.Format("{0:0.00}", 12.300000);

Thank you.

Text Format Problem???

Posted: Sat Apr 17, 2010 9:47 am
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)!!

Text Format Problem???

Posted: Sun Apr 18, 2010 2:01 am
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.

Text Format Problem???

Posted: Sun Apr 18, 2010 7:23 am
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.


Text Format Problem???

Posted: Thu Apr 22, 2010 5:50 am
by Jan
Hello,

Try to use following expression:

Code: Select all

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