Make reports in Yii2 with Microsoft Word Templates.
This package is auto-updated.
Last update: 2022-07-24 20:31:59 UTC
A Yii2 library to generate Word / PDF reports using Microsoft Word Templates.
The preferred way to install this extension is through composer.
Note: Check the composer.json for this extension's requirements and dependencies. You must set the
devin the composer.json file in your application root folder before installation of this extension OR if your
minimum-stabilityis set to any other value other than
dev, then set the following in the require section of your composer.json file
Read this web tip /wiki on setting the
minimum-stability settings for your application's composer.json.
$ php composer.phar require kartik-v/yii2-word-report "@dev"
require section of your
use kartik\wordreport\TemplateReport; $report = new TemplateReport([ 'format' => TemplateReport::FORMAT_BOTH, 'inputFile' => 'Invoice_Template_01.docx', 'outputFile' => 'Invoice_Report_' . date('Y-m-d'), 'values' => ['invoice_no' => 2001, 'invoice_date' => '2020-02-21'], 'images' => ['company_logo' => '@webroot/images/company.jpg', 'customer_logo' => '@webroot/images/company.jpg'], 'rows' => [ 'item' => [ ['item' => 1, 'name' => 'Potato', 'price' => '$10.00'], ['item' => 2, 'name' => 'Tomato', 'price' => '$20.00'], ] ], 'blocks' => [ 'customer_block' => [ ['customer_name' => 'John', 'customer_address' => 'Address for John'], ['customer_name' => 'Bill', 'customer_address' => 'Address for Bill'], ], ] ]); // Generate the report $report->generate();
yii2-word-report is released under the BSD-3-Clause License. See the bundled
LICENSE.md for details.