mkdreams/mdword
Composer 安装命令:
composer require mkdreams/mdword
包简介
OFFICE WORD 动态数据 绑定数据 生成报告;OFFICE WORD Dynamic data binding data generation report.
README 文档
README
中文文档
Project General Name
Template: a word which will be revised.
Block: the part which will be replaced or cloned.
Project Introduction
Main Use: to generate word dynamically.
Advantage: focus only on dynamic data and logic, rather than adjusting the style, which can modulate the template with the help of office word.
Comparison between MDword & PHPword
- PHP Package.
- Both can be used to generate office word.
- PHPword concentrates on writing elements one by one. However, it is more powerful and efficient for Mdword just to revise them on the template.
- For updating text styles, adding covers, headers and footers, MDword just modifies the template by office word, while PHPword complicate the task-adjusting every element.
- Directories(Table of content) can be automatically generated.
Tutotials
// Method 1
composer require mkdreams/mdword
// Method 2, Autoloading Template
require_once('Autoloader.php');
-
Invocation Methods (more and richer approaches, for example: tests\samples\simple for readme, such as catalog, sequence number, etc.)
// New class,load template
$TemplateProcessor = new WordProcessor();
$template = 'temple.docx';
$TemplateProcessor->load($template);
// Set Value
$TemplateProcessor->setValue('value', 'r-value');
// Clone
$TemplateProcessor->clones('people', 3);
$TemplateProcessor->setValue('name#0', 'colin0');
$TemplateProcessor->setValue('name#1', [
['text'=>'colin1','style'=>'style','type'=>MDWORD_TEXT],
['text'=>1,'type'=>MDWORD_BREAK],
['text'=>'86','style'=>'style','type'=>MDWORD_TEXT]
]);
$TemplateProcessor->setValue('name#2', 'colin2');
$TemplateProcessor->setValue('sex#1', 'woman');
$TemplateProcessor->setValue('age#0', '280');
$TemplateProcessor->setValue('age#1', '281');
$TemplateProcessor->setValue('age#2', '282');
// set value for image
$TemplateProcessor->setImageValue('image', dirname(__FILE__).'/logo.jpg');
// Delete a paragraph
$TemplateProcessor->deleteP('style');
// Save
$rtemplate = __DIR__.'/r-temple.docx';
$TemplateProcessor->saveAs($rtemplate);
More samples
Communication
Note: Exchange idea on MDword.
Project Plans
mkdreams/mdword 适用场景与选型建议
mkdreams/mdword 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.48k 次下载、GitHub Stars 达 52, 最近一次更新时间为 2020 年 03 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 mkdreams/mdword 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 mkdreams/mdword 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1.48k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 54
- 点击次数: 4
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2020-03-27



