how do I get a Section to grow to fit its content?

22,973

Page footers don't resize, so you can't easily do what you want.

Here's a hack that, while far, far from ideal, may help:

  1. Add a section that will repeat with every detail row (something like your primary key), and suppress the group header.
  2. Create a formula with the following contents: shared numbervar recordcount := recordcount + 1; and put it in your new group footer.
  3. Create another formula that resets the variable: shared numbervar recordcount := 0; and put it in the page footer.
  4. Open the section expert and choose your new group footer. Choose "Print at Bottom of Page". In the suppress formula use: shared numbervar recordcount; recordcount < 50 // Magic Number Alert
  5. Add your page footer text to the group footer

This will print the group footer at the bottom of the page after every 50 records have printed. The group footer will expand to fit the text in your field.

I'm thinking that you could make the magic number vary according to the length of your footer text, so your suppression formula would be recordcount < (if length({my.field}) > 100 then 25 else 50; or something like that, which would vary the number of records before a page break according to your text length.

Share:
22,973
jcollum
Author by

jcollum

Updated on February 09, 2020

Comments

  • jcollum
    jcollum about 4 years

    I've got a text field in a CR Report that is variable in size and in it's own section. I'd like the section to fit the content of the field and grow if the field grows. The text is in the page footer and needs to print on every page.

    Currently I've got these set on the Text Object: Keep Object Together, Close Border on Page Break, Can Grow. The section that it's in is a Page Footer and these are checked: Free Form Placement, Keep Together (set but grayed out/disabled).

    What do I need to do to the text and section so that the section is always exactly the size of the text that's contained in it? Can Grow seems like all I should need to do but when I set that and minimize the section the text in the field gets cut off. I want to set the report up so that if I add 4 lines to the text in the footer I don't have to go in and re-edit the rpt, it just sizes automatically.

  • jcollum
    jcollum about 14 years
    Wow, that's complicated. Well, if it does the job... pretty sure you're right about the footer not resizing. I see no reason why it couldn't, but whadyagunnado.
  • Graham
    Graham about 14 years
    Who the heck knows why it can't adjust the footer size on the fly, but it can't. The footer space is reserved and then the page generated. You can see this effect by adding a large conditionally suppressed section to the page footer. It will reserve the largest size, regardless of whether or not it is being used.