Expand Row Height to Match Content
You can expand rows to easily match the height of your content. You can even use Lines and Rectangles to expand with a field's content. Here's how to do it.
DynamicPDF Designer is a powerful tool for graphically creating rich PDF reports. One feature of Designer is its ability to expand a field on a row in the report's Body section to fit the field's content width.
Set a RecordBox or FormattedRecordBox element's expandable property to true
to resize the row to fit the field's content.
Automatically Expand a Row to Expandable
Let's illustrate expanding a row using the Create a PDF (dlex-layout) sample project.
- Open
SimpleReportWithCoverPage.dlex
into Designer.
- Scroll to the Body and note the
ProductName
field.
- Open the JSON data and modify the first
ProductName
to a string value too large to fit in the field's width.
- Run the report and notice the text is not fully displayed.
- Select the
ProductName
field in Designer and change the expandable property totrue
.
- Re-run the report and notice the full text is displayed.
Add a Line to Report
Now let's add a line to the report that repeats for each row of data.
- Add a Line to the Body.
- Select ProductName and notice the
x
andy
position.
It is much easier to modify dimensions through the Properties pane then to use your mouse to fine-tune positions and sizes of layout elements.
- Move the line to match the the line's
y
value asy + width
from theProductName
, thex1
position to0
, and thex2
position512
(the report's width).
- Run the report and notice the line repeats for each row and is placed in the proper location.
If you do not position the line to be equal or below the field's value, then the line will not display correctly nor repeat.
Add a Rectangle to Report
You are not limited to using lines when formatting a report with expanding field content and repeating rows. You can also use a Rectangle element.
- Delete the Line and add a Rectangle to the report's Body.
- Resize the rectangle to match the row's top and width and resize the rectangle to match the report's width.
- Run the report and the rectangle is repeated for each row and resizes it's height to accommodate the largest height of the elements in the row.