项目作者: jupitern

项目描述 :
docx tools - template engine, merge docx files
高级语言: PHP
项目地址: git://github.com/jupitern/docx.git
创建时间: 2016-02-15T10:27:17Z
项目社区:https://github.com/jupitern/docx

开源协议:MIT License

下载


jupitern/docx

PHP Docx tolls.

  • docx template system
  • merge docx files on one file
  • optionally add page break between merged files

Requirements

PHP 5.4 or higher.

Installation

Include jupitern/docx in your project, by adding it to your composer.json file.

  1. {
  2. "require": {
  3. "jupitern/docx": "1.*"
  4. }
  5. }

Usage

  1. $dir = 'C:\\www\\docx\\';
  2. // Docx template
  3. $docx = \Jupitern\Docx\Docx::instance()
  4. ->setTemplate($dir.'template.docx')
  5. ->setData(['{name}' => 'john doe', '{address}' => 'at the end of the road'])
  6. ->save($dir.'result.docx');
  7. // Merge Docx files
  8. $docxMerge = \Jupitern\Docx\DocxMerge::instance()
  9. // add array of files to merge
  10. ->addFiles([$dir.'file1.docx', $dir.'file2.docx'])
  11. // output filepath and pagebreak param
  12. ->save($dir.'result.docx', true);

Contributing

  • welcome to discuss a bugs, features and ideas.

License

jupitern/docx is release under the MIT license.

You are free to use, modify and distribute this software