晨曦520 / docx-merge
用于将多个 MS Word ".docx" 文件合并成一个的简单库
v1.0.0
2015-11-03 11:54 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- phpunit/phpunit: 4.8.*
This package is not auto-updated.
Last update: 2024-09-23 07:38:48 UTC
README
用于将多个 MS Word ".docx" 文件合并成一个的简单库
特性
- 为 MS Office 2007 及以上版本创建有效的 docx 文件
详细信息
- 在处理 docx 的 ZIP 文件时,我使用 TbsZip
安装
php composer.phar require krustnic/docx-merge
合并示例
require "vendor/autoload.php";
use DocxMerge\DocxMerge;
$dm = new DocxMerge();
$dm->merge( [
"templates/TplPage1.docx",
"templates/TplPage2.docx"
], "/tmp/result.docx" );
setValues 示例
# Use "${NAME}" in docx file to create placeholders
require "vendor/autoload.php";
use DocxMerge\DocxMerge;
$dm = new DocxMerge();
$dm->setValues( "templates/template.docx",
"templates/result.docx",
array( "NAME" => "Sterling", "SURNAME" => "Archer" ) );
或者使用样式("粗体","斜体","下划线")
$dm->setValues( "templates/template.docx",
"templates/result.docx",
[
"NAME" => [
[
"value" => "Sterling",
"decoration" => [ "bold", "italic" ]
],
[
"value" => "Archer",
"decoration" => [ "bold", "underline" ]
]
]
]);