Created
November 28, 2016 13:12
-
-
Save theredstapler/b9f75d5b9aa32ae73a1399796d7625a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'vendor/autoload.php'; | |
use PhpOffice\PhpWord\Shared\Converter; | |
$phpWord = new \PhpOffice\PhpWord\PhpWord(); | |
$section = $phpWord->addSection(); | |
$categories = array('A', 'B', 'C', 'D', 'E'); | |
$series1 = array(5, 3, 4, 2, 7); | |
$series2 = array(15, 2, 9, 5, 9); | |
$chart = $section->addChart('line', $categories, $series1); | |
$chart->getStyle()->setWidth(Converter::inchToEmu(2.5))->setHeight(Converter::inchToEmu(2)); | |
$chart->addSeries($categories,$series2); | |
header('Content-Type: application/octet-stream'); | |
header('Content-Disposition: attachment;filename="test.docx"'); | |
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007'); | |
$objWriter->save('php://output'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment