Today, I would like to briefly talk about how to change the column width and row height in list pages.
There are three ways to change the column width in Business Central.
1. You can change column width with Personalize and Design. (Designer is currently only available from a Business Central sandbox)
2. From Business Central 2019 Release Wave 2 (BC15) onwards, adjusting the width of any column just got easier. Without having to start personalizing, you can drag the border of any column header to resize it. Similar to Microsoft Excel, you can double-click the border (AutoFit) to automatically size the column so that the caption and value of all columns on the screen are displayed efficiently.
3. You can also use a page extension to set Width Property directly.
Width Property: Sets the width of a field when it appears as a column in a list. The width is specified by an integer that corresponds to the number of characters.
- Table Field
- Page Field
- Page Label
Syntax: Width = Integer
For example: The following example sets the column width to 50 characters.
You use the Width property to help to improve readability in lists. The property only takes effect on pages of the type List, ListPlus, ListPart, Document, or Worksheet; when the
field control is used in a
repeater control. It has no effect on Card pages.
- If you omit the property or set it to
0, the platform will automatically determine the optimal value based on the field’s data type and other columns in the list.
- Setting the property on a table field means that any page that uses the field will inherent the width from the setting on the table. However, if the property is set on both the page and its source table, the value of the property on the page is used.
- Because font sizes can vary depending on the screen, the specified number of characters might not display entirely.
- Users can override the width by personalizing the page that displays the field.
- You can use Designer to adjust column widths.
Different from changing the column width, you can not directly adjust the height of any row in Business Central. So many developers think it is impossible to expand the row height. But there is actually a way to do this. This is still valid in the current latest version (Tested on BC18.1).
MultiLine Property: Sets the value that indicates whether a field can display multiple lines of text.
- Page Label
- Page Field
Syntax: MultiLine = true
True if you want to display multiple lines; otherwise, false. The default is false.
First, you can not modify this property directly in a page extension.
However, you can use a page extension to add the field as a new field, then set the MultiLine property to true.
You can hide the original field or move the added field to the end.
Let’s look at a more detailed example.
Add multiline field to Item List, Sales Order Subform, and Customer Ledger Entries pages.
Hope this will help.
Thanks for reading.