Skip to content

joecampo/docxfindandreplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DOCX Find & Replace

Latest Version on Packagist Software License Latest Version on Packagist Build Status

This is a simple find and replace utility for DOCX files. Simple way to take a DOCX template, map some variables, and save a new copy.

Installation

Via Composer

$ composer require campo/docxfindandreplace

Usage

In your DOCX template you will need to wrap any variables you would like to replace with curly braces (e.g. {FIRSTNAME}. Be sure to use variables in your template that are all uppercase as Microsoft Word's spell check will create issues.

\Campo\DocxFindAndReplace\Docx::create(__DIR__ . "/template.docx")->replace(
    [
        'FIRSTNAME' => 'Joe',
        'LASTNAME' => 'Campo',
    ]
)->save(__DIR__ . '/newfile.docx');

License

The MIT License (MIT). Please see License File for more information.

About

Find and replace variables in a DOCX template.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages