Geen omschrijving

Sample_31_Shape.php 2.5KB

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