当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPWord::addLinkStyle方法代码示例

本文整理汇总了PHP中PHPWord::addLinkStyle方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPWord::addLinkStyle方法的具体用法?PHP PHPWord::addLinkStyle怎么用?PHP PHPWord::addLinkStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPWord的用法示例。


在下文中一共展示了PHPWord::addLinkStyle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PHPWord

<?php

require_once '../PHPWord.php';
// New Word Document
$PHPWord = new PHPWord();
// New portrait section
$section = $PHPWord->createSection();
// Add style definitions
$PHPWord->addParagraphStyle('pStyle', array('spacing' => 100));
$PHPWord->addFontStyle('BoldText', array('bold' => true));
$PHPWord->addFontStyle('ColoredText', array('color' => 'FF8080'));
$PHPWord->addLinkStyle('NLink', array('color' => '0000FF', 'underline' => PHPWord_Style_Font::UNDERLINE_SINGLE));
// Add text elements
$textrun = $section->createTextRun('pStyle');
$textrun->addText('Each textrun can contain native text or link elements.');
$textrun->addText(' No break is placed after adding an element.', 'BoldText');
$textrun->addText(' All elements are placed inside a paragraph with the optionally given p-Style.', 'ColoredText');
$textrun->addText(' The best search engine: ');
$textrun->addLink('http://www.google.com', null, 'NLink');
$textrun->addText('. Also not bad: ');
$textrun->addLink('http://www.bing.com', null, 'NLink');
// Save File
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save('Textrun.docx');
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:24,代码来源:Textrun.php

示例2: PHPWord

<?php

require_once '../PHPWord.php';
// New Word Document
$PHPWord = new PHPWord();
// New portrait section
$section = $PHPWord->createSection();
// Add hyperlink elements
$section->addLink('http://www.google.com', 'Best search engine', array('color' => '0000FF', 'underline' => PHPWord_Style_Font::UNDERLINE_SINGLE));
$section->addTextBreak(2);
$PHPWord->addLinkStyle('myOwnLinkStyle', array('bold' => true, 'color' => '808000'));
$section->addLink('http://www.bing.com', null, 'myOwnLinkStyle');
$section->addLink('http://www.yahoo.com', null, 'myOwnLinkStyle');
// Save File
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save('Link.docx');
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:16,代码来源:Link.php


注:本文中的PHPWord::addLinkStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。