PHP code example of denisristic / word-service-provider
1. Go to this page and download the library: Download denisristic/word-service-provider library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
denisristic / word-service-provider example snippets
$word = $app['word']->generateDOC('<h1>Test HTML header</h1>');
$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');