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.
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
he means autotext, and i will try and give you a solutions by monday.
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.
do you know how to create these "anchors" in word as ive not used that before.
ASKER
Nope, I'm not even sure if they are called anchors, I was just taking a guess with that word...
ASKER
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.
worst comes to worst might just have to do a search replace on the strings.
ASKER
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->Boo kmarks($bo okmarkname );
$range = $objBookmark->Range;
$range->Text = $fullname;
?>
"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->Boo
$range = $objBookmark->Range;
$range->Text = $fullname;
?>
and that doesn't work?
ASKER
It does, I just thought you had a better way :)
not that i know of sorry :(
ASKER
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 :)