[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Delphi Merge with MS Word

Posted on 2004-03-30
6
Medium Priority
?
447 Views
Last Modified: 2010-04-06
Hi,
I am making a program for my As level called Tod's Tyres and it is all about storing information and then invoicing. I was wondering if there was an easy way of transfering data from Editboxes to sections on a MS Word doccument. So forexample like where you have <<Firstname>> on a word doccument it gets replaced by the contents of EdFirstname.text    etc..

Like you do to a memo box, only taking it to a different application.

This would Really help my program as i could have a seperate invoice doccument that i can customise under word. It would also make it much user friendly!

Thanx

Adam
0
Comment
Question by:AdamFred
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
shaneholmes earned 500 total points
ID: 10713993
Check out this site:

http://www.djpate.freeserve.co.uk/AutoWord.htm

There is a tip on how to insert text

Shane
0
 
LVL 11

Expert Comment

by:shaneholmes
ID: 10714027
Also, from this link:  (eugenem)

http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20443348.html?query=TWordDocument&searchType=topic

procedure wordReplace( range : Range; source : String; target : Variant );
var
  vFindText, vReplaceWith, vMatchCase, vMatchWholeWord, vReplace : OleVariant;
begin
  if vartype(target) = varNull then target := '';
  vFindText := source;
  vReplaceWith := target;
  vMatchCase := true;
  vMatchWholeWord := true;
  vReplace := wdReplaceAll;
  range.Find.Execute( vFindText, vMatchCase, vMatchWholeWord, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, EmptyParam, vReplaceWith, vReplace, EmptyParam, EmptyParam, EmptyParam, EmptyParam );
end;


usage:

d : WordDocument

wordReplace( d.range, 'source', 'target' )

Shane
0
 
LVL 4

Assisted Solution

by:Greg Rowland
Greg Rowland earned 500 total points
ID: 10715719
We accomplished this by creating a document template, containing bookmarks for the data items, then writing to the template bookmarks.

What version of Delphi and word are you targeting?


0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Loops Section Overview
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

831 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