Enable Text Wrapping Using TDL
Text Wrapping capabilities introduced in Release 7.1 improve the readability of lengthy text in reports, invoices, and data entry screens. Developers can control how text wraps, the number of lines displayed, and the columns where wrapping is applied.
Text Wrapping is supported at both Collection and Field levels.
Prerequisites
Text Wrapping depends on the Auto Wrap Text configuration in TallyPrime.
Go to:
F1 (Help) > Settings > Display > Application > Auto Wrap Text
Alternatively, you can override this configuration by setting the optional override parameter in the Word Wrap attribute.
Collection Level Text Wrapping
Word Wrap
Use the Word Wrap attribute in a Collection to enable automatic wrapping of text within a table column instead of compressing the content into a single line.
Syntax
[Collection: <Collection Name>]
Word Wrap: <Logical Expression>: <Compression Level>[: <Logical Value>]
Where,
<Collection Name> is the name of the collection where the word wrap is enabled.
<Logical Expression> is an expression to evaluate a logical value to specify whether the word wrap is enabled on the first column or not.
<Compression Level> specifies when the compression/wrapping should be triggered. This parameter is considered only when the first parameter is set to Yes. It accepts three values and the default value is Low.
- Low – Applies minimal compression to maintain better readability (20% compression).
- High – Applies higher compression while keeping the content readable (50% compression).
- Maximum – Applies the highest level of compression and starts word wrapping only after the content reaches 65% compression.
<Logical Value> specifies whether the Word Wrap attribute should override the global configuration “Auto Wrap Text”, and accepts logical values Yes or No. This is an optional parameter. If it is not specified, the default value is No, and the attribute remains dependent on the F1 Help Configuration “Auto Wrap Text”.
Max Lines
Use Max Lines to control the maximum number of lines displayed at Collection (Table) and it works only for the first column of the table. This attribute is used to limit the number of wrapped lines.
Syntax
[Collection: <Collection Name>]
Max Lines: <Number of Lines>
Where,
<Collection Name> is the name of the collection in which the maximum word wrap line limit needs to be applied.
<Number of Lines> sets the maximum number of lines allowed. Default value will be set as 7. The maximum supported value is 50. If a value greater than 50 is specified, it will be treated as 50.
Word Wrap Column
By default, word wrapping is applied to the first column of a table. Use Word Wrap Column to apply wrapping to a different column.
Syntax
[Collection: <Collection Name>]
Word Wrap Column : <Column Number>
Where,
<Column Number> specifies the column on which word wrapping should be applied.
Example
[Collection: TSPLDefault]
Word Wrap : Yes : Low
Max Lines : 7
Word Wrap Column : 2
Behavior
- Text wrapping is applied to table columns.
- By default, wrapping is enabled for the first column.
- Use Word Wrap Column to apply wrapping to a different column.
- Use Max Lines to limit the number of wrapped lines.
- Long text is displayed across multiple lines instead of being compressed.
- Auto Wrap Text must be enabled, unless overridden in the Word Wrap attribute.
- Words are wrapped only at supported break characters and are not split using hyphens.
Field Level Text Wrapping
Field-level attributes provide control over multiline text display and editing within String fields.
Word Wrap
Use Word Wrap at Field level to enable or disable automatic wrapping of text in String data type fields. It helps display long text in multiple lines for better readability instead of showing the text in a highly compressed single line.
When word wrap is enabled, Input Text Scroll is automatically applied to support smooth cursor movement and easy editing of long text within the field.
Syntax
[Field: <Field Name>]
Word Wrap : <Applicability Keyword> : <Compression Level>[: <Logical Value>]
Where,
<Field Name> is the name of the field in which word wrap needs to be applied.
<Applicability Keyword> specifies when word wrap should be enabled for the field. The supported values are:
- Always → Always enables word wrap for the field.
- Never → Disables word wrap.
- Default → Applies word wrap when the field is in a repeated line or when the field is editable (non-skip field).
<Compression Level> specifies when the compression/wrapping should be triggered. This parameter is considered only when the first parameter is set to Yes. It accepts three values and the default value is Low.
- Low – Prioritizes better readability (~20% compression). Wrapping starts earlier.
- High – Allows more compression while maintaining readability (~50% compression). Wrapping starts later.
- Maximum – Allows the highest level of compression while keeping the content readable (~65% compression). Wrapping starts much later.
<Logical Value> specifies whether the Word Wrap attribute should override the global configuration “Auto Wrap Text”, and accepts logical values Yes or No. This is an optional parameter and the default value is No.
Max Edit Lines
Use Max Edit Lines at Field level to define the maximum number of lines to which text in a String field can wrap while the field is in edit mode. It helps control how much vertical space is used when entering or modifying long text.
Syntax
[Field: <Field Name>]
Max Edit Lines : <Number of Lines>
Where,
<Field Name> is the name of the field in which the edit mode line limit needs to be applied.
<Number of Lines> specifies the maximum wrapped lines allowed in edit mode. Default value will be set as 3. The maximum supported value is 50. If a value greater than 50 is specified, it will be treated as 50.
Max Display Lines
Use Max Display Lines at Field level to define the maximum number of lines to which text in a String field can wrap while the field is in display mode. It helps improve readability of long text without occupying unlimited space.
Syntax
[Field: <Field Name>]
Max Display Lines : <Number of Lines>
Where,
<Field Name> is the name of the field in which the display mode line limit needs to be applied
<Number of Lines> specifies the maximum wrapped lines allowed in display mode. Default value will be set as 3. The maximum supported value is 50. If a value greater than 50 is specified, it will be treated as 50.
Behaviour
- Text wrapping is applied to String fields.
- Long text is displayed across multiple lines for better readability.
- Use Max Edit Lines to limit wrapped lines in edit mode.
- Use Max Display Lines to limit wrapped lines in display mode.
- Input Text Scroll is automatically enabled when word wrap is used.
- Auto Wrap Text must be enabled, unless overridden in the Word Wrap attribute.
- Words are wrapped only at supported break characters and are not split using hyphens.
Example
[Collection: TSPL StockItem]
Title : “List of Stock Item”
Word Wrap : Yes : Low
Max Lines : 3
[#Field: MST Name]
Word Wrap : Default : Low
Max Edit Lines : 3
Max Display Lines : 7
This configuration enables wrapping for long text values, limits table wrapping to 3 lines, restricts edit mode to 3 lines, and allows up to 7 lines in display mode.
Word Break Characters
Text wrapping occurs only at the following characters:
| Constant | Symbol |
|
C_SPACE |
|
|
C_PERIOD |
. |
|
C_COMMA |
, |
|
C_OPEN_ROUND |
( |
|
C_CLOSE_ROUND |
) |
|
C_PLUS |
+ |
|
C_MINUS |
– |
|
C_MULT |
* |
|
C_DIVIDE |
/ |
|
C_POWER |
^ |
|
C_PERCENT |
% |
|
C_EQUAL |
= |
|
C_GREATER |
> |
|
C_LESSER |
< |
|
C_NOT |
! |
|
C_OR |
| |
|
C_AND |
& |
