Appreciate if there is any expert can advise the following. Print item description with 25 characters per line and no blank line if the description is less than 25 characters. I have set MultiLine = Yes in the textbox properties and increase textbox’s height but the result is not acceptable [V] Then, someone help me to create a function which count the number of characters per line and print the 26th characters and the remaining text on next row. However, this is not presentable as a word will be “copped” into two portion and print on two different row. I need to print the “whole” word on next row if the last word is exceed the length of 25 characters. Willing to pay to solve the above. Looking forward to hear from someone… [:(]
quote:
Print item description with 25 characters per line and no blank line if the description is less than 25 characters. I have set MultiLine = Yes in the textbox properties and increase textbox’s height
Your approach is correct, but you’ll need to use 2 sections, on with a normal textbox, height 1 line, and “CurrReport.SHOWOUTPUT(NoOfCaracters <= 25)” in the ONPreSectionTrigger. Put in a second section where you have the textbox with heigth 2 lines and the follosing code in the OnPreSection trigger: “CurrReport.SHOWOUTPUT(NoOfCaracters > 25)”. That should give you some acceptable result. The other approach with chopping apart the text will be more difficult…
quote:
Willing to pay to solve the above
That one is for free [;)] Saludos Nils
Try this: You need two new Global Variables: DescriptionPart1, Text25 DescriptionPart2, Text25 Also create one new Global Function: Parameters: Description, Text30 (change the length of this variable to suit your description length) VAR, Part1, Text25 VAR, Part2, Text25 Local Variables: Pos, Integer SplitDescription(Description : Text[30];VAR Part1 : Text[25];VAR Part2 : Text[25]) CLEAR(Part1); CLEAR(Part2); IF STRLEN(Description) <= MAXSTRLEN(Part1) THEN Part1 := Description ELSE BEGIN Pos := MAXSTRLEN(Part1); WHILE (Description[Pos] <> ' ') AND (Pos > 0) DO Pos -= 1; IF Pos = 0 THEN Pos := MAXSTRLEN(Part1) + 1; Part1 := COPYSTR(Description,1,Pos - 1); Part2 := COPYSTR(Description,Pos + 1,MAXSTRLEN(Part2)); END;
Next, call this function from the OnAfterGetRecord trigger of the relevant DataItem: SplitDescription(Description,DescriptionPart1,DescriptionPart2); Then you need 2 Sections on the Report (just like Nils explained), the first one containing a TextBox control with SourceExpr DescriptionPart1 and a second one containing another TextBox control with SourceExpr DescriptionPart2. Add the following line to the OnPreSection trigger of the second Section: CurrReport.SHOWOUTPUT := DescriptionPart2 <> ‘’; I think that will solve your problem. It’s however too late here in Portugal and I haven’t properly tested this, so consider this my disclaimer. [:p] [:D]