Print Multiple Lines of Description

jessielai
Member Posts: 6
I got problem in printing multiple lines with the following conditions.
1. Print multiple lines of item descriptions, only allow to print 25 characters per line.
2. If item description less than 25 characters, the system must not print additional blank line (that's what happen when you use MultiLine = Yes and adjust the height of the textbox). The following have been incorporate into the report but the result does not meet our requirement.
3. If item description print more than a line (25 characters per line), the system must print the "whole" word instead of "cut" the word into two portion and print it on two separate lines. For an example, the last word for the first line is "sample" and 25th character end at "m", the system should print "sample" on the second line instead of printing "sam" for the first line and "ple" for the second line.
Appreciate any advice to the above issue.
1. Print multiple lines of item descriptions, only allow to print 25 characters per line.
2. If item description less than 25 characters, the system must not print additional blank line (that's what happen when you use MultiLine = Yes and adjust the height of the textbox). The following have been incorporate into the report but the result does not meet our requirement.
v_DescLen := STRLEN(Description); IF ((v_DescLen > 0) OR (pint_StartDesc = 1)) THEN BEGIN CurrReport.SHOWOUTPUT := TRUE; IF (v_DescLen > 25) THEN gtxt_Description := COPYSTR(Description,pint_StartDesc,25) ELSE IF (gint_DescLen > 0) THEN gtxt_Description := COPYSTR(Description,pint_StartDesc,gint_DescLen);
3. If item description print more than a line (25 characters per line), the system must print the "whole" word instead of "cut" the word into two portion and print it on two separate lines. For an example, the last word for the first line is "sample" and 25th character end at "m", the system should print "sample" on the second line instead of printing "sam" for the first line and "ple" for the second line.
Appreciate any advice to the above issue.

0
Comments
-
Hi
The following will wrap the text based on a space ' ' or '-' or ','
You can add more 'breakpoints' if you wish.
It will not print any more characters than maximum specified, then work backwards to find the first 'breakpoint' character as specified.
This is how you can achieve it.
Create a var DescriptionText2
Add another body section for Line which only prints the variable DescriptionText2
add code to the section:CurrReport.SHOWOUTPUT(DescriptionText2 <> '');
Call the following from Line.OnAfterGetRecordDescriptionText2 := "Wrap Text"(25,"Line".Description); //Wrap
create the new function that you call as below (first line shows you that the function accepts 2 variables and returns a text):Wrap Text(MaxLength : Integer;VAR wrapText1 : Text[250]wrapText2 : Text[250]) IF (STRLEN(wrapText1) < MaxLength) OR (STRLEN(wrapText1) = 0) THEN EXIT(''); //find the space in WrapText1 as it now is > the Maximum length FOR iCount := MaxLength DOWNTO 1 DO BEGIN IF wrapText1[iCount] IN [' ','-',','] THEN BEGIN iSplit := iCount; iCount := 1; END; END; wrapText2 := COPYSTR(wrapText1,iSplit+1,STRLEN(wrapText1)); wrapText1 := COPYSTR(wrapText1,1,iSplit);
Hope this helps,
gus0 -
I normaly make two sections. One section a normal description, in the second a multiline version of the description. (Set the multi line property of the textbox to Yes and make it two or three lines).
Then print the normal section if the description is < 25 and print the multiline section if descripion > 25.CurrReport.SHOWOUTPUT := STRLEN(Description) < 25;
This way the wrap of the description will be done quite nice, not dumb after 25 charaters."Real programmers don't comment their code.
If it was hard to write, it should be hard to understand."0 -
Dear friends
Thanks for all your help! I got the result that I need... Thank you, thank you, thank you......0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions