03-15-2003, 08:07 PM
I've made a db of contacts and clients, but now I've been akes to expand on that. I need it to be able to print the addresses of the people onto labels. I thought it would be easiest to set up a template word document with the margins and spacing set up for the labels, then input the required data. Is this possible. Can you input data into an already created word document and if so, how?
03-15-2003, 08:38 PM
to do what you want to do
1)open word and click mail merge (tools>mail merge)
2) Click create>Mailing Labels
3) get data>Open data source, locate your file
4)Then click merge
03-16-2003, 01:42 AM
But can I automate this througha php script?
03-17-2003, 04:14 AM
You can create a Word document via the COM (http://www.php.net/COM) extension though documentation is sparse , if you have already done this sort of thing with VB etc then you would have a head start.
I cheat and use RichTextFormat , create your document in word and save it as .rtf , anything you want to replace make identifiable, i.e. I use
"welcome [[NAME]] [[SURNAME]] to the wonderful ...." etc
then you can open the .rtf in PHP and str_replace your [[$var]] with whatever.
it takes a bit of messing around but can work out quite nicely.
I also have to make a nice printouts from my database, and I think I'm going to do it with pdf.
I'm going to use the fpdf library (http://www.fpdf.org/) I haven't used it very much, so I can't say how easy/handy it is.
But you don't need a word on the client pc, only acrobat reader.
Maybe an idea :)
03-18-2003, 02:41 AM
if you go the PDF route also look at http://www.ros.co.nz/pdf/ which is a great free PDF library that requires no extensions if your host does not support it , I use it & whilst a little odd its very very useful.