denisristic/word-service-provider
Composer 安装命令:
composer require denisristic/word-service-provider
包简介
A wrapper for PHPWord usage in Silex 2 projects
README 文档
README
Introduction
This service provider for Silex allows you to quickly generate Word (*.doc) documents. Either pass in a query result set, and a list of headers, or use the Doctrine functionality to convert a html to a document.
Installation
Require the provider using composer:
composer require denisristic/word-service-provider
Register the provider in your application somewhere:
$app->register(new \denisristic\WordServiceProvider\Provider\WordServiceProvider());
Usage
Generate a document from HTML:
$word = $app['word']->generateDOC('<h1>Test HTML header</h1>');
Forcing a download of the spreadsheet:
$controllers->get('/download', function () use($app) { $word = $app['word']->generateDOC('<h1>Test HTML header</h1>'); $docName = 'entries-' . date('Y-m-dhis') . '.doc'; $response = new Response($word); $response->headers->add(array( 'Content-Type' => 'application/vns.ms-word' ,'Content-Disposition' => 'inline; filename="' . $docName . '"' ,'Pragma' => 'no-cache' ,'Expired' => 0 )); return $response; })->bind('download');
统计信息
- 总下载量: 32
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-13