码迷,mamicode.com
首页 > Web开发 > 详细

20170724_phpword(phpoffice)———TemplateProcessor->cloneBlock()

时间:2017-07-25 11:21:40      阅读:1138      评论:0      收藏:0      [点我收藏+]

标签:div   sample   amp   doc   tin   default   sam   ase   office   

<?php
include_once ‘Sample_Header.php‘;

// Template processor instance creation
echo date(‘H:i:s‘) , ‘ Creating new TemplateProcessor instance...‘ , EOL;
$templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor(‘resources/Sample_23_TemplateBlock.docx‘);

// Will clone everything between ${tag} and ${/tag}, the number of times. By default, 1.
$templateProcessor->cloneBlock(‘CLONEME‘, 3);

// Everything between ${tag} and ${/tag}, will be deleted/erased.
$templateProcessor->deleteBlock(‘DELETEME‘);

echo date(‘H:i:s‘), ‘ Saving the result document...‘, EOL;
$templateProcessor->saveAs(‘results/Sample_23_TemplateBlock.docx‘);

echo getEndingNotes(array(‘Word2007‘ => ‘docx‘));
if (!CLI) {
    include_once ‘Sample_Footer.php‘;
}

 

20170724_phpword(phpoffice)———TemplateProcessor->cloneBlock()

标签:div   sample   amp   doc   tin   default   sam   ase   office   

原文地址:http://www.cnblogs.com/ArthurLaravel/p/7232887.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!