<?php /** * Insert a link into a Word document. * * @category Phpdocx * @package examples * @subpackage easy * @copyright Copyright (c) Narcea Producciones Multimedia S.L. * (http://www.2mdc.com) * @license LGPL * @version 3.0 * @link http://www.phpdocx.com * @since File available since Release 3.0 */ require_once '../../classes/CreateDocx.inc'; $docx = new CreateDocx(); $docx->addLink('Link to Google', array('url' => 'http://www.google.es', 'font' => 'Arial', 'color' => 'blue', 'u' => 'single')); $docx->createDocx('../docx/example_link');
<?php /** * Create a DOCX file. Link example * * @category Phpdocx * @package examples * @subpackage easy * @copyright Copyright (c) 2009-2011 Narcea Producciones Multimedia S.L. * (http://www.2mdc.com) * @license LGPL * @version 2.0 * @link http://www.phpdocx.com * @since File available since Release 2.0 */ require_once '../../classes/CreateDocx.inc'; $docx = new CreateDocx(); $docx->addLink('Link to Google', 'http://www.google.es', 'Arial'); $docx->createDocx('example_link');
<?php //path to the CreateDocx class within your PHPDocX installation require_once '../../../classes/CreateDocx.inc'; $docx = new CreateDocx(); $docx->addLink('Link to Google', array('url' => 'http://www.google.es')); $docx->addText('And now the same link with some additional formatting:'); $linkOptions = array('url' => 'http://www.google.es', 'color' => 'B70000', 'underline' => 'none'); $docx->addLink('Link to Google in red color and not underlined', $linkOptions); $docx->createDocx('example_addLink_1');