本文整理汇总了PHP中CreateDocx::embedHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP CreateDocx::embedHTML方法的具体用法?PHP CreateDocx::embedHTML怎么用?PHP CreateDocx::embedHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CreateDocx
的用法示例。
在下文中一共展示了CreateDocx::embedHTML方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CreateDocx
//path to the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$html = '<h1 style="color: #b70000">An embedHTML() example</h1>';
$html .= '<p>We draw a table with border and rawspans and colspans:</p>';
$html .= '<table border="1" style="border-collapse: collapse">
<tbody>
<tr>
<td style="background-color: yellow">1_1</td>
<td rowspan="3" colspan="2">1_2</td>
</tr>
<tr>
<td>Some random text.</td>
</tr>
<tr>
<td>
<ul>
<li>One</li>
<li>Two <b>and a half</b></li>
</ul>
</td>
</tr>
<tr>
<td>3_2</td>
<td>3_3</td>
<td>3_3</td>
</tr>
</tbody>
</table>';
$docx->embedHTML($html);
$docx->createDocx('example_embedHTML_1');
示例2: array
$myList = array($myItem, 'item 2', array('subitem 2_1', 'subitem 2_2'), 'item 3', array('subitem 3_1', 'subitem 3_2', array('sub_subitem 3_2_1', 'sub_subitem 3_2_1')), 'item 4');
$docx->addList($myList, array('val' => 1));
$valuesTable = array(array('cell_1_1', 'cell_1_2', 'cell_1_3', 'cell_1_4'), array('cell_2_1', 'cell_2_2', 'cell_2_3', 'cell_2_4'), array('cell_3_1', 'cell_3_2', 'cell_3_3', 'cell_3_4'));
$paramsTable = array('TBLSTYLEval' => 'MediumGrid3-accent5PHPDOCX');
$docx->addTable($valuesTable, $paramsTable);
$myHTML = '<br /><p style="font-family: Calibri; font-size: 11pt">We include a table with rowspans and colspans using the embedHTML method.</p>
<table style="font-family: Calibri; font-size: 11pt">
<tr>
<td>header 1</td>
<td>header 2</td>
<td>header 3</td>
<td>header 4</td>
</tr>
<tr>
<td rowspan="2" colspan="2">cell_1_1</td>
<td>cell_1_3</td>
<td>cell_1_4</td>
</tr>
<tr>
<td>cell_2_3</td>
<td>cell_2_4</td>
</tr>
<tr>
<td>cell_3_1</td>
<td>cell_3_2</td>
<td>cell_3_3</td>
<td>cell_3_4</td>
</tr>
</table>';
$docx->embedHTML($myHTML, array('tableStyle' => 'MediumGrid3-accent5PHPDOCX'));
$docx->createDocx('../word_documents/example_table_style_HTML');
示例3: CreateDocx
<?php
//path to the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$docx->embedHTML('<h1 style="color: #b70000">The Wikipedia Article on the Periodic Table</h1>');
$html = file_get_contents('http://en.wikipedia.org/wiki/Periodic_table');
$options = array('parseDivsAsPs' => true, 'baseURL' => 'http://en.wikipedia.org/', 'downloadImages' => true, 'filter' => '#bodyContent');
$docx->embedHTML($html, $options);
$docx->modifyPageLayout('A3-landscape');
$docx->createDocx('example_embedHTML_2');