Page 1 of 1

Dynamically add/ remove Text component from Databand

Posted: Tue May 14, 2013 1:33 pm
by prajan
Hi,
Could you please tell me how we can dynamically add/ remove Text components from databand.

Thanks in advance

Re: Dynamically add/ remove Text component from Databand

Posted: Wed May 15, 2013 6:02 am
by HighAley
Hello.

Sorry, maybe we did not exactly understand your question. Could you explain your issue more detailed?

Thank you.

Re: Dynamically add/ remove Text component from Databand

Posted: Fri May 17, 2013 3:39 am
by prajan
Hi,
I need to generate a report based on the data retrieved from a SQL stored procedure. The number of columns returned by the proc vary each time. Accordingly I need to change the number of columns displayed. That is why I asked how text components can be dynamically added in the databand under a group header. Can you please let me know how this can be handled?
Thanks

Re: Dynamically add/ remove Text component from Databand

Posted: Fri May 17, 2013 7:21 am
by Alex K.
Hello,

Please see the sample report in attachment.

Thank you.

Re: Dynamically add/ remove Text component from Databand

Posted: Fri May 17, 2013 8:55 am
by prajan
Thanks for the sample report. I will get back in case of any queries.

Re: Dynamically add/ remove Text component from Databand

Posted: Fri May 17, 2013 10:06 am
by Alex K.
Hello,

Ok. Let us know if you need any additional help.

Re: Dynamically add/ remove Text component from Databand

Posted: Tue May 28, 2013 8:57 am
by prajan
Hi,
I am working on a web application and tried as mentioned in the sample. But I am getting the error "DragDrop registration did not succeed" in report.Show(). My code is as shown below. Please let me know if I have missed anything:

Code: Select all

StiReport report = new StiReport();

            report.Dictionary.Clear();
            report.Dictionary.Databases.Clear();
            report.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("SQLConnection", SqldBConnectString));

            DataSet dsBSReport = null;

            StiPage LiabRep = report.Pages[0];
            
            dsBSReport = objBSReport.m_BalanceSheetReport(11, "1/5/2013", "GL", true, "ABC");

            DataTable dtRepDet = dsBSReport.Tables[0];
            DataTable dtUserPC = dsBSReport.Tables[1];
            DataTable dtRepLiab = dsBSReport.Tables[2];
            DataTable dtRepAsst = dsBSReport.Tables[3];

            report.RegData(dsBSReport);

            report.Dictionary.Synchronize();

           
            //Create header group for headers

            StiHeaderBand LiabRepHeader = new StiHeaderBand();
            LiabRepHeader.Height = 0.7;
            LiabRepHeader.Name = "LiabReportHeader";

            LiabRep.Components.Add(LiabRepHeader);

            double columnWidth = LiabRep.Width / ((dtUserPC.Rows.Count + 1) * 2);
            double pos = 0;

            // Add databand in the header text

            StiDataBand dbLiabRepHeader = new StiDataBand();
            dbLiabRepHeader.Height = 0.7;
            dbLiabRepHeader.Name = "dbLiabRepHeader";

            LiabRepHeader.Components.Add(dbLiabRepHeader);

            // Add 'Liabilities' header text

            StiText stitxtLiab = new StiText(new RectangleD(pos, 0, (columnWidth * 2), 0.7));
            stitxtLiab.Text = "Liabilities";
            stitxtLiab.HorAlignment = StiTextHorAlignment.Center;
            stitxtLiab.VertAlignment = StiVertAlignment.Center;
            stitxtLiab.Border.Side = StiBorderSides.All;

            dbLiabRepHeader.Components.Add(stitxtLiab);

            // Add header text for each of the PCs
            int nameIndex = 1;
            foreach (DataRow drUserPC in dtUserPC.Rows)
            {
                pos = pos + (columnWidth * 2);
                StiText hText = new StiText(new RectangleD(pos, 0, (columnWidth * 2), 0.7));
                hText = new StiText(new RectangleD(pos, 0, columnWidth, 0.5));

                hText.Text.Value = drUserPC["ProfitCenter"].ToString() + "/n Amount in Rs.";
                hText.HorAlignment = StiTextHorAlignment.Center;
                hText.Name = "HeaderText" + nameIndex.ToString();
                hText.Border.Side = StiBorderSides.All;
                dbLiabRepHeader.Components.Add(hText);
                nameIndex++;
            }

            report.Compile();

           
            report.Show();

Thanks

Re: Dynamically add/ remove Text component from Databand

Posted: Tue May 28, 2013 12:08 pm
by Alex K.
Hello,

Please send us a sample project which reproduces the issue.
Also please check the sample in attachment.

Thank you.