No Description

Sample_22_CheckBox.php 654B

123456789101112131415161718192021
  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. $section = $phpWord->addSection();
  7. $section->addText(htmlspecialchars('Check box in section'));
  8. $section->addCheckBox('chkBox1', htmlspecialchars('Checkbox 1'));
  9. $section->addText(htmlspecialchars('Check box in table cell'));
  10. $table = $section->addTable();
  11. $table->addRow();
  12. $cell = $table->addCell();
  13. $cell->addCheckBox('chkBox2', htmlspecialchars('Checkbox 2'));
  14. // Save file
  15. echo write($phpWord, basename(__FILE__, '.php'), $writers);
  16. if (!CLI) {
  17. include_once 'Sample_Footer.php';
  18. }