Link to home
Start Free TrialLog in
Avatar of drakkarnoir
drakkarnoir

asked on

MS Word Template for PHP/MySQL

Could anybody do a small sample regular Word document with anchors (is that what they are called?) so that I could propogate those with MySQL entries? IE:

Hello {firstname}{lastname},

Thanks for your interest in our product.

Where {firstname}{lastname} would be values from a row of MySQL and the columns firstname, lastname.
ASKER CERTIFIED SOLUTION
Avatar of venkateshwarr
venkateshwarr

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jkna_gunn
jkna_gunn

he means autotext, and i will try and give you a solutions by monday.
Avatar of drakkarnoir

ASKER

Still here jkna_gunn?
yeah sorry, was a holiday here. ive not had a chance to look into it yet.
do you know how to create these "anchors" in word as ive not used that before.
Nope, I'm not even sure if they are called anchors, I was just taking a guess with that word...
Still here jkna_gunn?
im here but i need to find out how to do these "anchors" in word first.

worst comes to worst might just have to do a search replace on the strings.
You mean bookmarks?

"To create a Bookmark in a MS Word document, click on Insert/Bookmark. You can highlight a word or sentence and make them a Bookmark."

So then using that idea, we just have to tell MS Word using COM+ to look for the bookmark, and select the range of it, and replace the value of it with our value:

<?php
$fullname = $firstname . $lastname;
$bookmarkname = "NAME";
$objBookmark = $word->ActiveDocument->Bookmarks($bookmarkname);
$range = $objBookmark->Range;
$range->Text = $fullname;
?>

and that doesn't work?
It does, I just thought you had a better way :)
not that i know of sorry :(
Hmmmm, in that case, I'm going to have to award venkateshwarr with the points, as he pointed me to the link which spoke about that, and give some points to madwax for his input. Thanks for your participation jkna_gunn, I really apppreciated your help with my labeling question :)