Page 1 of 1

How to add PageNofM???

Posted: Fri Jun 08, 2007 5:08 am
by jayakumargr
Hi,

i want to add page number in system text at run time.so i tried following,

StiPageFooterBand PageFooterBand1 = new Stimulsoft.Report.Components.StiPageFooterBand();
PageFooterBand1.ClientRectangle = new Stimulsoft.Base.Drawing.RectangleD(0, 10.71, 7.49, 0.2);
PageFooterBand1.Dock = System.Windows.Forms.DockStyle.Bottom;
PageFooterBand1.Name = "PageFooterBand1";
PageFooterBand1.Border = new Stimulsoft.Base.Drawing.StiBorder(Stimulsoft.Base.Drawing.StiBorderSides.None, System.Drawing.Color.Black, 1, Stimulsoft.Base.Drawing.StiPenStyle.Solid, false, 4, new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Black));
PageFooterBand1.Brush = new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Transparent);
page.Components.Add(PageFooterBand1);

StiSystemText SystemText1 = new Stimulsoft.Report.Components.StiSystemText();
SystemText1.ClientRectangle = new Stimulsoft.Base.Drawing.RectangleD(0, 0, 7.49, 0.2);
SystemText1.Dock = System.Windows.Forms.DockStyle.Fill;
SystemText1.HorAlignment = Stimulsoft.Base.Drawing.StiTextHorAlignment.Right;
SystemText1.Name = "SystemText1";
SystemText1.Border = new Stimulsoft.Base.Drawing.StiBorder(Stimulsoft.Base.Drawing.StiBorderSides.Top, System.Drawing.Color.DimGray, 0.5, Stimulsoft.Base.Drawing.StiPenStyle.Solid, false, 4, new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Black));
SystemText1.Brush = new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Transparent);
SystemText1.Font = new System.Drawing.Font("Arial Unicode MS", 8F);
SystemText1.Margins = new Stimulsoft.Report.Components.StiMargins(0, 0, 0, 0);
SystemText1.TextBrush = new Stimulsoft.Base.Drawing.StiSolidBrush(System.Drawing.Color.Black);
SystemText1.TextFormat = new Stimulsoft.Report.Components.TextFormats.StiGeneralFormatService();
SystemText1.TextOptions = new Stimulsoft.Base.Drawing.StiTextOptions(false, false, false, 0F, System.Drawing.Text.HotkeyPrefix.None, System.Drawing.StringTrimming.None);

PageFooterBand1.Components.Add(SystemText1);

But i dont know, how to add PageNofM???

Please Provide the solution....

Thanks in advance,
Jaykumar

How to add PageNofM???

Posted: Fri Jun 08, 2007 7:17 am
by EDV Gradl
What about:

SystemText1.Text = "{PageNofM}";


??

Marco

How to add PageNofM???

Posted: Sat Jun 09, 2007 3:32 am
by jayakumargr
Hi,
Systemtext1.Text="{PageNofM}"

The above statement doesn't work.

Please provide any other solutions....


Thanks in advance,
Jayakumar

How to add PageNofM???

Posted: Mon Jun 11, 2007 6:33 am
by Edward
In the latest prerelease versions of StimulReport.Net StiText has some improvements. These improvements make a StiText component able fully Replace a StiSystemText component.

Creating and placement of the both components is the same.

Assigning the Text property of the StiText component in runtime you can do as following:

(report.Pages[0].GetComponents()["MyText"] as StiText).Text = "{PageNofM}";

This will work only for the reports' template, when the report later needs Compile() method. If you need add an aggregate function into the compiled report, then it is a bit more complex task.

Do you need add an aggregate function in the compiled report?

Thank you.

How to add PageNofM???

Posted: Thu Jun 14, 2007 10:47 am
by jayakumargr
Hi,

I have Stimulsoft 2007.1. In that Version How to Add Page number using SystemText ?

And also i need ,aggregate function in the compiled report?


Thanks in Advance,
Jayakumar

How to add PageNofM???

Posted: Mon Jun 18, 2007 2:10 am
by Edward
jayakumargr wrote:I have Stimulsoft 2007.1. In that Version How to Add Page number using SystemText ?
If you need to do this in the Designer, then please use SystemText component from the ToolBox. After placing SystemText component on the page in the Editor of the component you should select

Code: Select all

{Page Number} or Page {Page Number} to {Total Page Count} 
or

Code: Select all

{Page Number}

system variable.

Also you can use these system variables in the StiText standard component.
jayakumargr wrote:And also i need ,aggregate function in the compiled report?
Please use the following code:

Code: Select all

// if report loaded from a template then use this line of code. If report is declared as class then this line of code is not necessary
report.Compile();

StiSystemText mySystemText = new StiSystemText(new RectangleD(new PointD(0, 0), new SizeD(20, 20)));
mySystemText.Name = "mySystemText";
// We place this component on the HeaderBand for example:
StiHeaderBand myHeader = report.CompiledReport.GetComponents()["HeaderBand1"] as StiHeaderBand;
myHeader.Components.Add(mySystemText);            

mySystemText.GetValue += new Stimulsoft.Report.Events.StiGetValueEventHandler(mySystemText__GetValue);
report.CompiledReport.EndRender += new System.EventHandler(this.ReportWordsToEnd__EndRender);

report.Show();
...
 
         public void mySystemText__GetValue(object sender, Stimulsoft.Report.Events.StiGetValueEventArgs e)
        {
            e.Value = "";
            e.StoreToPrinted = true;
        }

        public System.String mySystemText_GetValue_End(Stimulsoft.Report.Components.StiComponent component)
        {
            return report.CompiledReport.PageNofM.ToString();
        }

        public void ReportWordsToEnd__EndRender(object sender, System.EventArgs e)
        {
            (report.CompiledReport.GetComponents()["mySystemText"] as StiSystemText).SetText(new Stimulsoft.Report.Components.StiGetValue(mySystemText_GetValue_End));
        }
Thank you.