Search code examples
crystal-reports

How to set height of all textboxes be equal size in an report? - Crystal Reports


I'm working on an existing report created using Crystal Reports.

In this report, a new column was added, but, the value of the column/row surpasses the default design of the report.

NOTE: The following example is in the "Details section" of the report and is equivalent of the rows of a table.

Example:

 ____________________________ 
| Name      | Worker type    |  // (Worker type) is the new column
|___________|________________|
|  Item 1   | Text 1         |  // Row 1
|  Item 2   | Text 2         | 
|___________| Text 3         |    
|  Item 3   | Text 4         |  
|  Item 4   |________________|
|___________| Text 2         |  // Row 2 - might be bigger "height" than "Name" column.
|  Item 5   | Text 1         |
|  Item 6   | Text 2         |
|___________|________________| 

The desired rendered result is:

 ____________________________   
| Name      | Worker type    |  // (Worker type) is the new column
|___________|________________|
|  Item 1   | Text 1         |  // Row 1
|  Item 2   | Text 2 Text 3  | 
|___________|________________|    
|  Item 3   | Text 4         |  // Row 2  
|  Item 4   |                |
|───────────|────────────────|
|  Item 5   | Text 2         |  // Row 3 - all rows / columns has appropiate design size.
|  Item 5   | Text 1         |
|  Item 6   | Text 2         |
|___________|________________| 

I had tried:

  1. Removing box objects: the original report uses them for set a black border on the "details section" - resulting in the example above.
  2. By removing the box objects, I set the border of the data fields - or textboxes - directly. This leads to border lines didn't increase/expand to the next row.

Example of the modification made - described in the point # 2 - not consistent design:

 ____________________________ 
| Name      | Worker type    |  // (Worker type) is the new column
|___________|________________|
|  Item 1   | Text 1         |  // Row 1
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|  Item 2   | Text 2         |  // Row 2
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ 
|  Text 3   | Text 3         |  // Row 3  
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯           
|  Item 4   |                |
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|  Item 5   | Text 1         |
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|  Item 6   | Text 2         |
|___________|________________| 
  1. Use the "Can Grow" option for each datafield - no results adjusting the size of the other columns to be the same as the "Worker type" new column.
  2. Search on internet and here, in Stack Overflow: no results so far.

I don't know how to proceed for set the same size for all datafields/textboxes in the report.

Is there a way to set all files to have equal size in Crystal Reports?


Solution

  • After search deeper in both Google and in Stack Overflow (and honestly, after a weekend break), I found the solution:

    In this answer says:

    Do not use borders of text box to make cell borders, instead use lines to create borders one horizontal line above the text boxes and one below the text boxes. both lines having width long as the detail section. and for vertical borders use vertical lines. that starts from top of group header section and ends at bottom of detail section. now when the height of cell increases when the content is large then all the rows will be set accordingly.

    This this in mind, I have to use the "Line Object" and draw the lines that divides the rows, then, by selecting the lines drawn and press "Format Multiple Objects", I marked/checked these two options on the Line - Format Editor window:

    • Extend to Bottom of section when Printing
    • Repeat on Horizontal Pages

    I think the first one is the one who makes the "magic" - i.e, extending the line, but, just to be sure, the second option should be marked too.

    After these changes, I did get the desired result:

     ____________________________   
    | Name      | Worker type    |  // (Worker type) is the new column
    |___________|________________|
    |  Item 1   | Text 1         |  // Row 1
    |  Item 2   | Text 2 Text 3  | 
    |___________|________________|    
    |  Item 3   | Text 4         |  // Row 2  
    |  Item 4   |                |
    |───────────|────────────────|
    |  Item 5   | Text 2         |  // Row 3 - now all rows / columns has appropiate design size.
    |  Item 5   | Text 1         |
    |  Item 6   | Text 2         |
    |___________|________________|