Solved

Using Delphi3 with Wordperfect

Posted on 1998-05-27
5
228 Views
Last Modified: 2010-04-06
How do I accomplish the following: Start Wordperfect8, open an existing document having bookmarks, insert some text into certain bookmarked fields from my Delphi3 paradox app, saveas another document name and then let the user take control of Wp to finish the document.
0
Comment
Question by:jfreisen
  • 3
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
ahalya earned 100 total points
ID: 1348145
i do this with WP7 & guess this shoud work with 8 as well.


Var WP : Variant;

begin
WP := CreateOleObject( 'WordPerfect.PerfectScript');
WP.FileOpen (YourFileName) ;
WP.BookmarkFind ('Introduction') ;
WP.KeyType ('typing some text at bookmark introduction') ;
WP.BookmarkFind ('theory') ;
WP.KeyType ('some more texty into the second bookmark') ;
WP.FileSave (NewFileName,  4 ) ;
end;

0
 

Author Comment

by:jfreisen
ID: 1348146
That worked great except how can I first check to see if WP is loaded and if it is use that instance else start it up. I get an error on the fileopen line if WP was already loaded.
0
 
LVL 7

Expert Comment

by:ahalya
ID: 1348147
i'm not sure why. normally if WP is already loaded then the CreateOLE function activates the already loaded instance (at least it does so in my machine).

i check the "Number of Open Documents" function and the "document blank" functions to see whether some other documents are open in WP or it is only my OLE doc. (at the end i do the following)

var i : intreger;
    b : boolean;

WP.FileClose;
i := WP.EnvNumberOpenDocuments;
b := WP.EnvDocBlank ;
if (i =1) and b then  //there is only one blank doc open !
    objWP.ExitWordPerfect;

0
 

Author Comment

by:jfreisen
ID: 1348148
Thanks, I will give that a try.  Where do I find a list of all the functions I can use in Delphi to control WP?
0
 
LVL 7

Expert Comment

by:ahalya
ID: 1348149
In Word perfect macro help you can find all the available commands and the variables. (wp variable ?DocBlank becomes EnvDocBlank in delphi).

You can get the complete syntax in WP help. (WP macro programming -since the introduction of PerfectScript- is essentially the same as OLE commands)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now