Forum


Replies: 4   Views: 2806
Search bookmark from the template
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by swatir  · 14-09-2016 - 07:02

I need some solution where I can find bookmark from the template by bookmark name and replace my data into that bookmark.

Can you please suggest me?

Posted by swatir  · 20-09-2016 - 11:42

Hello,

I have been tried with the DOCXPATH but it could not work for me. 

What I wanted to do is, I have a template file in which there is some bookmarked content with the bookmark name as 'bookmark_name'. I have to find out that perticular bookmark by bookmark name and replace the content under that perticular bookmark only. Could you please suggest me how could I achive this?

Thanks,

Swati 

Posted by swatir  · 20-09-2016 - 12:22

I want something like this,

$current_date = date("m/d/Y"); 


//get the bookmark and create a new MS Word Range (to enable text substitution) 
$bookmarkname = "TODAYDATE"; 
$objBookmark = $word->ActiveDocument->Bookmarks($bookmarkname); 
$range = $objBookmark->Range; 


//substitute the bookmark with actual value 
$range->Text = $current_date; 

Posted by admin  · 20-09-2016 - 13:41

Hello,

As your user doesn't have any license tied, please use the contact form (http://www.phpdocx.com/contact) to send the username and email of the user who purchased the license.

Regards.