Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8631143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T09:10:38+00:00 2026-06-12T09:10:38+00:00

My client has asked me to set up a mail merge structure with an

  • 0

My client has asked me to set up a mail merge structure with an existing database of contacts. They want to be able to upload some sort of Microsoft office document into the system, then I need to be able to generate this file as a printable loop replacing the set fields matching the database.

e.g. Dear %%FIRST_NAME%% would change to Dear John or whatever the record is within the database.

So I am wondering what file type they can export out of Microsoft word to upload into my system that I could use fwrite to string replace these variables and then somehow set up a loop to be able to print these all out.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T09:10:39+00:00Added an answer on June 12, 2026 at 9:10 am

    You can use PHPWord for this. http://phpword.codeplex.com/

    It allows you to open the doc/docx file and edit it, although for .doc files you need some compatibility pack (hopefully you can get docx files which are just zips of XML files)

    If you can, I would recommend you using their template system, since that would greatly facilitate your life.

    All you need: instead of doing this:

    Dear %%FIRST_NAME%%, I still listen to your music, man!
    

    Do something like this:

    Dear ${FirstName}, I still listen to your music, man!
    

    Then in your PHP code you can do this:

    <?php
    require_once('PHPWord.php');
    
    $phpWord = new PHPWord();
    $doc = $phpWord->loadTemplate("yourdoc.docx");
    $document->setValue("FirstName", "John Lennon");
    $document->save("yourdoc_modified.docx");
    

    An extra I forgot to say: You don’t require running the PHP server on Windows for using this. As long as you have the zip and XML libraries installed, you’re all fine.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My client has asked me to set the opacity (alpha) for various different MKPlacemarks
My client / has asked me to set the opacity (alpha) for various different
Client has asked that a whole div is dragable, the div contains some text
I have a new client who has asked me to make some label changes
My client has asked me to create a different perspective for an existing cube
So a client has asked me if I could build an interface where they
A client has asked for a page loader, something attractive to let the visitor
A client has asked me to make their YouTube channel look similar this one:
a client has asked me for a Facebook application similar to a news reader,
My client has recently taken ownership of an existing web site, with final deliverable

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.