Solved

Delphi Merge with MS Word

Posted on 2004-03-30
6
439 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
6 Comments
 
LVL 11

Accepted Solution

by:
shaneholmes earned 125 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:SurferJoe
SurferJoe earned 125 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

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

Suggested Solutions

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…
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

770 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