devxlogo

Passing Info to Word Processing Template

Passing Info to Word Processing Template

Question:
I have a couple of questions about passing information to aword processing template and controlling the saving of the template toanother name. I appreciate any guidance you can provide.

Our application is written using Delphi 1. Our word processingapplication is WordPerfect.

What happens is: A user will bring up information about a client (name, DOB, etc.) on the screen. We want to set up the application so the user can press a button and be taken into the word processing template, and all the relevant information for the client will be imported from the Paradox table into the word processing template. We are having trouble automatically putting the information into the template. The closest we have gotten is having a box come up so the user can enter the info to be placed into each template field.

The second part of our problem (the part we have no idea where to find an answer for) is that after the user has”done his thing” in the template and saves it, we want to save thefilename and location back to our Paradox table so the system will keeptrack of where the reports exist. We are not concerned what the name isor where the file resides, as long as we can track it.

The only thing Icould think of doing is to copy the template to another file name thatthe application would assign, allow the user to update the new fileand save it, but not allow the user to rename thefile. The application runs on a Novell network. I would appreciate anythoughts you might have.

Answer:
As far as the first problem is concerned, my feeling is that you’ll probablyhave to approach this with OLE. I haven’t worked with WordPerfect in thisrespect, but you should be able to get a set of commands that will place theinformation in the proper places. Other than that, you could copythe field values from your Delphi program into a string, like so:

FieldVal1;FieldVal2;FieldVal3;FieldVal4
Then copy the string to the clipboard. You can execute WordPerfect withShellExecute. Check the WordPerfect documentation for command line arguments(loading files, etc.). Anyway, from your template, execute a macro thatwill copy the clipboard contents to a local variable. Then, parse thestring and get the field values to insert into your WP fields.

As far as the second problem is concerned, again you’ll use the clipboard.However, this time, copy the file name of the file you saved to theclipbboard, then close WP. Once it’s closed, you can grab the value inDelphi and put it in the appropriate field in your database.

Granted, this is pretty conceptual, but it should get you pointed in theright direction.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist