Hello everyone,
I'm working on customizing an AL report (Cheque
) in Business Central. The report includes a field that converts numeric amounts into words (AmountInWords
). However, when the converted text exceeds 45 characters, it overflows the designated textbox area on the cheque layout, disrupting the overall layout.
What I Want to Achieve:
- Automatically insert a line break after 45 characters in the
AmountInWords
field. - Ensure that the text wraps to the next line without manual intervention.
- Maintain the portrait orientation and alignment consistent with other fields on the cheque
local procedure InsertLineBreak(InputText: Text; MaxLength: Integer): Text
var
FirstPart: Text[255];
SecondPart: Text[255];
begin
if STRLEN(InputText) <= MaxLength then
exit(InputText);
FirstPart := COPYSTR(InputText, 1, MaxLength);
SecondPart := COPYSTR(InputText, MaxLength + 1, STRLEN(InputText) - MaxLength);
exit(FirstPart + '\n' + SecondPart); // Tried using '\n', CRLF, and CHAR functions
end;