當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。