Solved

Delphi Merge with MS Word

Posted on 2004-03-30
6
436 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 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

20 Experts available now in Live!

Get 1:1 Help Now