jupitern/docx

docx工具 - 模板引擎,合并docx文件

1.0.2 2016-12-16 10:18 UTC

This package is auto-updated.

Last update: 2024-09-17 14:38:44 UTC


README

PHP Docx工具。

  • docx模板系统
  • 将多个docx文件合并为一个文件
  • 可选地在合并的文件之间添加分页符

需求

PHP 5.4或更高版本。

安装

通过将jupitern/docx添加到您的composer.json文件中,将其包含到您的项目中。

{
    "require": {
        "jupitern/docx": "1.*"
    }
}

用法

$dir = 'C:\\www\\docx\\';

// Docx template
$docx = \Jupitern\Docx\Docx::instance()
			->setTemplate($dir.'template.docx')
			->setData(['{name}' => 'john doe', '{address}' => 'at the end of the road'])
			->save($dir.'result.docx');

// Merge Docx files
$docxMerge = \Jupitern\Docx\DocxMerge::instance()
    // add array of files to merge
	->addFiles([$dir.'file1.docx', $dir.'file2.docx'])
    // output filepath and pagebreak param
	->save($dir.'result.docx', true);

贡献

  • 欢迎讨论错误、功能和想法。

许可协议

jupitern/docx采用MIT许可协议发布。

您可自由使用、修改和分发此软件。