Welcome! Log In Create A New Profile

Advanced

WD Version 25 Print Selection from a text memo

Posted by Al 
Al
WD Version 25 Print Selection from a text memo
December 19, 2025 10:14AM
Hello All,

Many years ago, I wrote a simple job card program for a plumber friend. The app was in DOS Foxpro and I have just managed to get him off that program - now running in DosBox - and into Windev due mainly to the fact that his old parallel printer finally died and the old DOS Foxpro program cannot print to USB printers.

So, enough history, the problem I have is that the memo field where details of work performed was recorded has, in some cases, a hundred of more lines of text - lines are added at each visit to the job site - and he doesn't want to print all that out every time a job card is printed. He only wants the last 20 or so lines. Foxpro had a really handy feature to do just that but I can't figure out how to just extract a set number of text lines from the bottom of a Windev text memo and print them in a text block on a report. The text doesn't have many carriage returns as the original data was just typed in and was automatically wrapped as it was entered.

I have been checking out the Windev string functions but there doesn't seem to be any way to do what I need. An alternative, that I also can't figure out how to do, might be to display all the text onscreen before reporting and ask the user to select a block of text to be printed.

Regards
Al
JP
Re: WD Version 25 Print Selection from a text memo
December 19, 2025 02:19PM
Al

Extracting a substring based on a string separator Hide the details. If the lines are CRLF seperated you could use that as the line seperator.

<Result> = ExtractString(<Initial string> , <Index> [, <Separator> [, <Browse direction>]])

If no line separator then extract the last 20x80=1600 characters block of text (for example), and then manually split that block into 20 lines of 80 characters (for example).



Edited 2 time(s). Last edit at 12/19/2025 02:21PM by JP.
Re: WD Version 25 Print Selection from a text memo
December 19, 2025 04:08PM
Maybe this works:

When he added text, save the cursorposition (textlength). Next time he enters text you can select the text between the new and the old cursorposition and print it.
Al
Re: WD Version 25 Print Selection from a text memo
December 19, 2025 04:19PM
Hello JP & Markus,

Thank you for your solutions, I will investigate them both.

Regards
Al
Re: WD Version 25 Print Selection from a text memo
December 21, 2025 09:02AM
Hello AI.
If user does not press ENTER on the end of line, there is no CR or CRLF so you can try to count number of words for every line.
So maybe you can say 'I have 15 words for every line', so you can precount words and divide with 15 and get number of virtual rows.
After that you can go trough your memo field and create 3-4 last rows.

Regards !
Al
Re: WD Version 25 Print Selection from a text memo
December 21, 2025 12:11PM
Hello IsmirB,

Thank you for your suggestion

I was looking for a code process but I have ended up with a simple user driven solution.

I have provided print options for a full report with all the text and a text selection report.
If the text selection report is chosen, I open a popup window with all the memo text displayed and ask the user to select the text they want in the report and for them to cut and paste it into a separate text box that I then use for the report.

Regards
Al
Re: WD Version 25 Print Selection from a text memo
December 22, 2025 05:45PM
greetings
Maybe you should have set up the application logic differently
Why are you putting all these events in the same memo field?
Maybe it would be better to create a subtable that only contains the records that the plumber writes, each new entry goes as a new record and then you have the option to print a single record and when you need to print the entire content then you fill the content from the subtable.
I think this is more logical from a programming perspective and I think it is also simpler for your plumber
Al
Re: WD Version 25 Print Selection from a text memo
December 22, 2025 10:45PM
Hello Infos,

Your suggestions are valid, but the mind of a plumber is a mysterious thing.
In 1991 no-one was very tech savvy and certainly not my friend who just wanted to press a button and see the history of work performed at the work site in a continuous flow from the first call out to the present time.
I can't remember what technical resources were available to me or the level of my expertise at the time but he is happy as it does exactly what he wants.

Regards
Al
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: