nikita_kalitin / odt_utills
Requires
- php: >=7.2.0
- seblucas/tbszip: >=2.16.1
Requires (Dev)
- phpunit/phpunit: ^8.0
This package is auto-updated.
Last update: 2024-09-29 05:09:31 UTC
README
用于重新编译 *.odt 文件的工具
在处理模板 OpenTBS 时,常常会遇到模板文件损坏的问题。添加了样式和/或分页分隔符。该工具可以修复此类文件。
- 工具:重新编译存档中的 xml(参见 odt 格式)
- 因此:重新编译后可能会损坏样式
使用: tbszip
控制台模式启动
修复
php san_pb2.php -s "<输入文件路径>" -d "<输出文件路径>"
清除页面分隔符(文本:soft-page-break/)
php san_pb.php -s "<输入文件路径>" -d "<输出文件路径>"
使用包装类
use OdtHelper\TemplateRepair;
/**
* @param $path_to_inputfile
* @param $path_to_outputfile
* @return string
*/
TemplateRepair::repair($path_to_inputfile, $path_to_outputfile);
以下类型的损坏
<text:p text:style-name="P1">[krit_w.1. <text:span text:style-name="T13">name_krit</text:span> </text:p>
<text:p text:style-name="P1">К[krit_w.4.nu<text:soft-page-break/>m_pok_plus_krit] </text:p>
<text:p text:style-name="P1">К[krit_w.10.n<text:soft-page-break/>um_pok_plus_krit] </text:p>
修复结果
<text:p text:style-name="P1">[krit_w.1.name_krit]<text:span text:style-name="T13"></text:span> </text:p>
<text:p text:style-name="P1">К[krit_w.4.num_pok_plus_krit]<text:soft-page-break/> </text:p>
<text:p text:style-name="P1">К[krit_w.10.num_pok_plus_krit]<text:soft-page-break/> </text:p>