Açıklama Yok

Sample_15_Link.php 802B

123456789101112131415161718192021222324252627
  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. // Begin code
  7. $section = $phpWord->addSection();
  8. // Add hyperlink elements
  9. $section->addLink(
  10. 'http://www.google.com',
  11. htmlspecialchars('Best search engine'),
  12. array('color' => '0000FF', 'underline' => \PhpOffice\PhpWord\Style\Font::UNDERLINE_SINGLE)
  13. );
  14. $section->addTextBreak(2);
  15. $phpWord->addLinkStyle('myOwnLinkStyle', array('bold' => true, 'color' => '808000'));
  16. $section->addLink('http://www.bing.com', null, 'myOwnLinkStyle');
  17. $section->addLink('http://www.yahoo.com', null, 'myOwnLinkStyle');
  18. // Save file
  19. echo write($phpWord, basename(__FILE__, '.php'), $writers);
  20. if (!CLI) {
  21. include_once 'Sample_Footer.php';
  22. }