Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Relational Databases
Expertise: Beginner
Mar 28, 1997

Passing Info to Word Processing Template

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

Our application is written using Delphi 1. Our word processing application 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 the filename and location back to our Paradox table so the system will keep track of where the reports exist. We are not concerned what the name is or where the file resides, as long as we can track it.

The only thing I could think of doing is to copy the template to another file name that the application would assign, allow the user to update the new file and save it, but not allow the user to rename the file. The application runs on a Novell network. I would appreciate any thoughts you might have.

Answer:
As far as the first problem is concerned, my feeling is that you'll probably have to approach this with OLE. I haven't worked with WordPerfect in this respect, but you should be able to get a set of commands that will place the information in the proper places. Other than that, you could copy the 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 with ShellExecute. Check the WordPerfect documentation for command line arguments (loading files, etc.). Anyway, from your template, execute a macro that will copy the clipboard contents to a local variable. Then, parse the string 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 the clipbboard, then close WP. Once it's closed, you can grab the value in Delphi and put it in the appropriate field in your database.

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

DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date