design report in run time

Stimulsoft Reports.NET discussion
Post Reply
eli_dani22
Posts: 7
Joined: Sat Jul 16, 2011 3:11 am

design report in run time

Post by eli_dani22 »

Hi
i wanna add a field to my report header in runtime.it means in design time there is nothing but after running a field exist in header or any where i want.how can i do this.plz help me on that
thanx alot
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

design report in run time

Post by Jan »

Hello,

Please check following url:

http://stimulsoft.helpserve.com/index.p ... icleid=331

Thank you.
eli_dani22
Posts: 7
Joined: Sat Jul 16, 2011 3:11 am

design report in run time

Post by eli_dani22 »

it was so usefull but i send just a table too my report.all the definiton of report ,page and its components is in Stimulsoft Reports Designer .how can i access to page in Reports Designer from my .Net program?
Thank you
eli_dani22
Posts: 7
Joined: Sat Jul 16, 2011 3:11 am

design report in run time

Post by eli_dani22 »

i worked as following :

DataTable Dt = null;
RetriveData(ref Dt);
if (Dt == null)
{
return;
}
frmStimReportPreview f = new frmStimReportPreview(this, reportList1);
((FormManager)PreForm).New(f);

reportList1.ShowReport("GoodsSupplyAmount", Dt);


in this way how can i add a text to my report in runtime
Ivan
Posts: 960
Joined: Thu Aug 10, 2006 1:37 am

design report in run time

Post by Ivan »

Hello,

Please try to use the following code, for example:

Code: Select all

            StiReport mainreport = new StiReport();
            mainreport.Load("test.mrt");

            StiBand band = (StiBand)mainreport.GetComponentByName("ReportHeader1");
            StiText textbox = new StiText(new RectangleD(0, 0, 5, 1));
            textbox.Name = "TextOnReportHeader1";
            textbox.Page = band.Page;
            textbox.Text = "Test string";
            band.Components.Add(textbox);

            mainreport.Show();
Thank you.
eli_dani22
Posts: 7
Joined: Sat Jul 16, 2011 3:11 am

design report in run time

Post by eli_dani22 »

Hello
thank you very much.your codes was sooo usefull.i find the solution.
Andrew
Posts: 4109
Joined: Fri Jun 09, 2006 3:58 am

design report in run time

Post by Andrew »

Great! Have a nice day!
eli_dani22
Posts: 7
Joined: Sat Jul 16, 2011 3:11 am

design report in run time

Post by eli_dani22 »

Hi
In previous topics we make a new StiBand and add a textBox to it.now if i want to add a text box to one of my existent band like "PageHeaderBand1" how it's possible.
Thanx for your regard
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

design report in run time

Post by Alex K. »

Hello,

In the code, in the previous topic we did not create a new StiBand. We get it from a loaded report. For this we use the following code:

Code: Select all

StiBand band = (StiBand)mainreport.GetComponentByName("ReportHeader1");
In your case you can use the following code:

Code: Select all

StiPageHeaderBand band = (StiPageHeaderBand)mainreport.GetComponentByName("PageHeaderBand1");
Thank you.
Post Reply