Dynamically Setting Table Cell Width Using Custom Property
In Bold Reports, you can let readers change the width of a table cell while viewing a report by linking the Dynamicwidth custom property to a report parameter. The width updates at runtime, so no one needs to edit the report design. This article shows how to set up the Dynamicwidth property so a table cell takes its width from a parameter value.
Applies To:
- Bold Reports Web Designer
- Bold Reports Server
- Bold Reports Embedded Reporting Tools (.NET Core, ASP.NET, Angular, React, Blazor)
Steps to Configure
1. Create a Parameter
- Go to the Parameters panel and click New Parameter.
- Name the parameter ColumnWidthParameter and set the Data Type to Integer. This is the name the expression in Step 4 refers to. If you choose a different name, use that name in the expression.
This integer value represents the width in pixels (px).
2. Select the Target Cell
- In your report, select the table cell whose width you want to control dynamically.
3. Open Custom Attributes
- Navigate to the Properties panel.
- Expand the Miscellaneous section.
- Locate Custom Attributes, click Set Attributes, and then click Add to create a new custom property.
4. Add the Custom Property Details
- Add a new custom property with the following details.
Property Name:
Dynamicwidth
Property Value (Expression):
=Parameters!ColumnWidthParameter.Value
5. Preview the Report
-
Enter a value for the parameter to set the width you want, for example
100. The report preview updates to use that width.
-
Preview the report again with a different value, for example
250, to see the difference.
Conclusion
Linking a custom property to a report parameter gives readers direct control over the width of a table cell, with no changes to the report design. It makes layout adjustments quicker and the report easier to adapt to different needs.
You can download a sample report here.