Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Multi Column Sub Report with Lines

edited December 2014 in General
Hi,

I'm wanting to add some lines into my Sub Report so my report ends up
looking something like the following:


Some text up here in main report

----------------------------
| Sub Report header |
----------------------------
| Col 1 | Col 2 | Col 3 |
| Col 1 | Col 2 | Col 3 |
| Col 1 | Col 2 | Col 3 |
----------------------------


However I'm having trouble trying to figure out the best method to
achieve this (the vertical lines in the detail band)

I thought maybe using tppLines, and on the right hand side one making it
so it's only visible when printing in the 4th column, but I can't find
any way to reference which column is printing at the time.

The other option I considered was borders, but it seems as though the
last column prints it's border over the far right side of the page (on
the page's actual border), and not the column start + column width, so
I'm unable to manipulate where that prints.

I was just wondering what is the best / simplest method to achieve what
I'm attempting.

Thanks & Regards

Adam.

Comments

  • edited December 2014
    Hi Adam,

    I am a bit unclear about your specifications. Are you using Report
    columns or are these columns in a single detail band? Have you tried
    using vertical lines with ParentHeight set to True?

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2014
    Hi Nico,

    Sorry - I'll try and make myself more clear...

    I have a subreport.

    On the subreport - Page Setup - Layout I change the number of columns
    from 1 to 4. I also change Column Traversal to "Left to Right"

    I wish to have some lines seperating each column record. (There are 4
    columns, so I want 5 lines in total.

    |Col1|Col2|Col3|Col4|

    The problem with using vertical lines is that each one will print 4
    times. If I put one on either side of the column I will get double ups
    between each column:

    |Col1||Col2||Col3||Col4|

    If I only put it on the left hand side I end up with:

    |Col1|Col2|Col3|Col4

    (No finishing line on the right hand side of the 4th column).

    I could use vertical lines if there was a way for me to determine which
    column is being printed. (So I could have the right side line only print
    on the 4th column), but I can't see how to do that.

    I'm also wondering if there's an easier way to achieve creating this grid.

    Thanks & Regards

    Adam.
  • edited December 2014
    Hi Adam,

    Try using the band count to determine whether the vertical line on the
    right should display or not. In my quick testing, the following code
    worked as expected.

    procedure TForm1.ppDetailBand1BeforePrint(Sender: TObject);
    var
    lBandNo: Integer;
    begin

    lBandNo := ppDetailBand1.Count + 1; //Increment to make value 1-based

    ppLine2.Visible := (lBandNo mod ppReport1.Columns) = 0;

    end;

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2014
    Hi Nico,

    That does the job. Thank you.

    Adam.
This discussion has been closed.