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

Group KeepTogether...

edited June 2002 in General
Hi All,

I had couple of questions:

1.) I have set the "KeepTogether" property of a group to True but the header
still prints at the end of the page and the group detail prints on the next
page? Shouldn't the group header of the group also print on the next page
along with the group when "KeepTogether" is True? Am I missing something
here?
2.) Given a string, how do I get the length of the string in screenpixels or
Inches? I need this information to decide whether or not to print a
particular field depending on how much length it takes on the report.

Any help will be greatly appreciated.

Thanks,
Vikram

Comments

  • edited June 2002
    You can only set one group to be keep together. Nested KeepTogether on
    groups isn't supported.

    Use Report.Printer.Canvas methods to get the text width and text height.
    You can convet units by using ppUtils.pas You will find a couple of methods
    useful ppFromMMThousandths() and ppToMMThousandths. You'll have to add
    ppTypes to the uses clause to set pprtHorizontal as one of the parameters.

    uses
    ppUtils, ppTypes;

    procedure TForm1.Button1Click(Sender: TObject);
    var
    ldValue: Double;
    liValue: Integer;
    begin
    liValue := ppToMMTHousandths(5, utInches, pprtHorizontal,
    ppReport1.Printer);
    ldValue := ppFromMMThousandths(liValue, utScreenPixels, pprtHorizontal,
    ppReport1.Printer);

    showmessage(FloatToStr(ldValue));
    end;


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited June 2002
    1. Do you have nested groups? This behavior can occur if more than one group
    exists with KeepTogether set on multiple nested groups.

    2. Check out the following methods in the ppUtils.pas unit.

    ppFromMMTenths
    ppToMMTenths
    ppFromMMThousandths
    ppToMMThousandths
    ppToScreenPixels
    ppFromScreenPixels
    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

  • edited June 2002
    Thank you very much for your responses.

    group
    I am not sure if nested groups means having more than one group in a report.
    In my report I have 3 groups on different fields.
    What is the work around for this? Getting the header on one page and the
    actual group on another page isn't all that nice. Can I do something in the
    GroupHeader's OnBeforePrint event?

    I will look into the methods for the second question. Although I have one
    question about the last parameter in the
    ppToMMTHousandths(5, utInches, pprtHorizontal, ppReport1.Printer) call. I am
    not printing the report to the screen or the printer, instead I export it to
    HTML using Pragnaan's export devices. Which printer do I pass as the
    argument in this case?

    Regards,
    Vikram
  • edited June 2002
    You can pass nil as the last parameter.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

This discussion has been closed.