|
| 1 | +<?php |
| 2 | +include_once 'Sample_Header.php'; |
| 3 | + |
| 4 | +// New Word document |
| 5 | +echo date('H:i:s'), " Create new PhpWord object", EOL; |
| 6 | + |
| 7 | +$phpWord = new \PhpOffice\PhpWord\PhpWord(); |
| 8 | +$phpWord->addTitleStyle(1, array('size' => 14, 'bold' => true)); |
| 9 | + |
| 10 | +$section = $phpWord->addSection(); |
| 11 | + |
| 12 | +// Arc |
| 13 | +$section->addTitle('Arc', 1); |
| 14 | +$section->addShape( |
| 15 | + 'arc', |
| 16 | + array( |
| 17 | + 'points' => '-90 20', |
| 18 | + 'frame' => array('width' => 120, 'height' => 120), |
| 19 | + 'outline' => array('color' => '#333333', 'weight' => 2, 'startArrow' => 'oval', 'endArrow' => 'open'), |
| 20 | + ) |
| 21 | +); |
| 22 | + |
| 23 | +// Curve |
| 24 | +$section->addTitle('Curve', 1); |
| 25 | +$section->addShape( |
| 26 | + 'curve', |
| 27 | + array( |
| 28 | + 'points' => '1,100 200,1 1,50 200,50', 'connector' => 'elbow', |
| 29 | + 'outline' => array('color' => '#66cc00', 'weight' => 2, 'dash' => 'dash', 'startArrow' => 'diamond', 'endArrow' => 'block'), |
| 30 | + ) |
| 31 | +); |
| 32 | + |
| 33 | +// Line |
| 34 | +$section->addTitle('Line', 1); |
| 35 | +$section->addShape( |
| 36 | + 'line', |
| 37 | + array( |
| 38 | + 'points' => '1,1 150,30', |
| 39 | + 'outline' => array('color' => '#cc00ff', 'line' => 'thickThin', 'weight' => 3, 'startArrow' => 'oval', 'endArrow' => 'classic'), |
| 40 | + ) |
| 41 | +); |
| 42 | + |
| 43 | +// Polyline |
| 44 | +$section->addTitle('Polyline', 1); |
| 45 | +$section->addShape( |
| 46 | + 'polyline', |
| 47 | + array( |
| 48 | + 'points' => '1,30 20,10 55,20 75,10 100,40 115,50, 120,15 200,50', |
| 49 | + 'outline' => array('color' => '#cc6666', 'weight' => 2, 'startArrow' => 'none', 'endArrow' => 'classic'), |
| 50 | + ) |
| 51 | +); |
| 52 | + |
| 53 | +// Rectangle |
| 54 | +$section->addTitle('Rectangle', 1); |
| 55 | +$section->addShape( |
| 56 | + 'rect', |
| 57 | + array( |
| 58 | + 'roundness' => 0.2, |
| 59 | + 'frame' => array('width' => 100, 'height' => 100, 'left' => 1, 'top' => 1), |
| 60 | + 'fill' => array('color' => '#FFCC33'), |
| 61 | + 'outline' => array('color' => '#990000', 'weight' => 1), |
| 62 | + 'shadow' => array(), |
| 63 | + ) |
| 64 | +); |
| 65 | + |
| 66 | +// Oval |
| 67 | +$section->addTitle('Oval', 1); |
| 68 | +$section->addShape( |
| 69 | + 'oval', |
| 70 | + array( |
| 71 | + 'frame' => array('width' => 100, 'height' => 70, 'left' => 1, 'top' => 1), |
| 72 | + 'fill' => array('color' => '#33CC99'), |
| 73 | + 'outline' => array('color' => '#333333', 'weight' => 2), |
| 74 | + 'extrusion' => array(), |
| 75 | + ) |
| 76 | +); |
| 77 | + |
| 78 | +// Save file |
| 79 | +echo write($phpWord, basename(__FILE__, '.php'), $writers); |
| 80 | +if (!CLI) { |
| 81 | + include_once 'Sample_Footer.php'; |
| 82 | +} |
0 commit comments