Delphi Merge with MS Word

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
AdamFredAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
shaneholmesConnect With a Mentor Commented:
Check out this site:

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

There is a tip on how to insert text

Shane
0
 
shaneholmesCommented:
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
 
Greg RowlandConnect With a Mentor Software Designer, SysDBA, WebMaster OwnerCommented:
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
All Courses

From novice to tech pro — start learning today.