Detect when new column starts


02-18-2010, 2:27 PM
Hi!

I need to know when detail section starts to print next column.
I tryed group header AfterPrint event but it fires first time before start to print any details then print both columns in detail section. So second time AfterPrint fires AFTER second column detail already printed.

I tryed to calculate in detail_AfterPrint _currHeight += detail.Height and check if _currHeight <= _DetailHeight but sometime second column started when _currHeight + detail.Height <= _DetailHeight

Please help me to detect when second column started or at least heights of first and second columns.

-Mila

Re: Detect when new column starts


02-19-2010, 4:46 AM
Hello,

The beforeprint event of a section would give you the exact height of the controls and the section that is starting to get rendered. Please take a look at this help document regarding the events of a section.

However, please let us know the exact issue that you are facing. Do you need the sections to keep together? You may utilize the keeptogether property of the section for this purpose.

Regards,
Prantik

Re: Detect when new column starts


02-19-2010, 12:30 PM
I know heght of the detail section. The problem is - i don't know if it goes to the first or to the second column.
I use following code (you can see result in the attachment):

        private float _currHeight = 0F;
        private float _currHeight2 = 0F;
        private float _DetailHeight = 8.4F;

        private void rptEmployeeTransactions_PageEnd(object sender, EventArgs e)
        {
            float Y1 = this.PageSettings.Margins.Top + pageHeader.Height + gpHeader.Height + _currHeight;
            float Y2 = this.PageSettings.Margins.Top + pageHeader.Height + gpHeader.Height + _currHeight2;

            this.CurrentPage.ForeColor = System.Drawing.Color.Black;
            this.CurrentPage.PenStyle = DataDynamics.ActiveReports.Document.PenStyles.Solid;
            this.CurrentPage.PenWidth = 1;
            this.CurrentPage.DrawLine(lnBottom.X1 + this.PageSettings.Margins.Left, Y1, lnBottom.X2 + this.PageSettings.Margins.Left, Y1);
            this.CurrentPage.DrawLine(lnBottom2.X1 + this.PageSettings.Margins.Left, Y2, lnBottom2.X2 + this.PageSettings.Margins.Left, Y2);
           
        }

        bool _IsFirstColumn = true;
        private void detail_AfterPrint(object sender, EventArgs e)
        {
            if ( _IsFirstColumn && (_currHeight + detail.Height <= _DetailHeight))
            {
                _currHeight += detail.Height;
            }
            else
            {
                _IsFirstColumn = false;
                _currHeight2 += detail.Height;
            }
        }

        private void rptEmployeeTransactions_PageStart(object sender, EventArgs e)
        {
            _currHeight = 0;
            _currHeight2 = 0;
            _IsFirstColumn = true;
        }


Re: Detect when new column starts


02-22-2010, 2:12 AM
Hello,

From the image and the code that you have sent, it seems that you have set the column count of the detail section to 2 and you wish to have a line drawn at below the last record in a page. Please take a look at the attached sample where I have implemented this. The report is connected to the NorthWind.MDB.

Regards,
Prantik

Re: Detect when new column starts


02-23-2010, 12:55 PM
Hi!

Your example always draw line at the end of second column. At least seems like an end of second column.'

I need to draw line at the bottom of the first and second column. And columns are aneven because some rows placed in two lines and some are not. So I need to know when is the second column starts.

You simply add detail sections heights and divide by 2. This can be like this if you have no group keep together in your detail section. I do have group keep together and some details are big and some small so I have uneven columns.

-Mila

Re: Detect when new column starts


02-24-2010, 6:09 AM
Mila,

Could you send the RPX of the Report, so that I can check this further?

Regards,
Prantik

Re: Detect when new column starts


03-16-2010, 2:16 PM
Hi!

This is RPX file. Look at first page.

Thank you,
Mila

Re: Detect when new column starts


03-18-2010, 6:08 AM
Mila,

Unfortunately, the Active Reports engine doesn't throw any event for new a new column. Therefore it is rather tricky to detect when a new column starts. You may want to take a look at this forum post which has a similar question and in the meantime, we will try to find some additional information.

Regards,
Sankalp
Sankalp Sen
GrapeCity- DataDynamics