具有phpword中动态行数的表(Laravel-templateprocessor)

时间:2019-05-10 00:22:25

标签: php laravel-5 phpword

是否可以创建带有动态行的表?

我想知道如何在已经放置在模板中的表中插入更多行。

FileWordController.php(Laravel)

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class FileWordController extends Controller
{
    public function crearWordDocx(){
        $templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor(Storage_path('template.docx'));
        $title = "Warehouse";
        $templateProcessor->setValue('title_company',$title);
        $templateProcessor->saveAs('Document02.docx');
        header("Content-Disposition: attachment; filename=Document02.docx; charset=iso-8859-1");
        echo file_get_contents("Document02.docx");
    }
}

0 个答案:

没有答案