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


PHP CreateDocx::addList方法代码示例

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


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

示例1: CreateDocx

 */
require_once '../../classes/CreateDocx.inc';
$docx = new CreateDocx();
//Importing header and footer from external .docx file
$docx->importHeadersAndFooters('../word_documents/templateHeaderAndFooter.docx');
$text = array();
$text[] = array('text' => 'I am going to write');
$text[] = array('text' => ' Hello World!', 'b' => 'single');
$text[] = array('text' => ' using bold characters.');
$docx->addText($text);
//We first prepare an item list element with more sophisticated formatting:
$paramsItem = array(array('text' => 'This is the text associated with the first item', 'b' => 'single', 'color' => 'b70000'), array('text' => ' now without bold'), array('text' => ' and blue', 'color' => '0000b7'));
$myItem = $docx->addElement('addText', $paramsItem);
//Let us now to add a nested unordered list
$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>
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:31,代码来源:example8.php

示例2: exportCompleteReportDOC

 /**
  * Exports the complete report as a DOCX file
  * @return	boolean		False on error
  * @todo use unoconv
  */
 public function exportCompleteReportDOC($data)
 {
     $_course = api_get_course_info();
     $filename = 'gb_results_' . $_course['code'] . '_' . gmdate('YmdGis');
     $filepath = api_get_path(SYS_ARCHIVE_PATH) . $filename;
     //build the results
     $inc = api_get_path(LIBRARY_PATH) . 'phpdocx/classes/CreateDocx.inc';
     require_once api_get_path(LIBRARY_PATH) . 'phpdocx/classes/CreateDocx.inc';
     $docx = new CreateDocx();
     $paramsHeader = array('font' => 'Courrier', 'jc' => 'left', 'textWrap' => 5);
     $docx->addHeader(get_lang('FlatView'), $paramsHeader);
     $params = array('font' => 'Courrier', 'border' => 'single', 'border_sz' => 20);
     $lines = 0;
     $values[] = implode("\t", $data[0]);
     foreach ($data[1] as $line) {
         $values[] = implode("\t", $line);
         $lines++;
     }
     //$data = array();
     //$docx->addTable($data, $params);
     $docx->addList($values, $params);
     //$docx->addFooter('', $paramsHeader);
     $paramsPage = array('orient' => 'landscape');
     $docx->createDocx($filepath, $paramsPage);
     //output the results
     $data = file_get_contents($filepath . '.docx');
     $len = strlen($data);
     //header("Content-type: application/vnd.ms-word");
     header('Content-type: application/vnd.openxmlformats-officedocument.wordprocessingml.document');
     //header('Content-Type: application/force-download');
     header('Content-length: ' . $len);
     header("Content-Disposition: attachment; filename=\"{$filename}.docx\"");
     header('Expires: 0');
     header('Cache-Control: must-revalidate, post-check=0,pre-check=0');
     header('Pragma: public');
     echo $data;
     return true;
 }
开发者ID:ragebat,项目名称:chamilo-lms,代码行数:43,代码来源:gradebook_result.class.php

示例3: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
//Custom options
$latinListOptions = array();
$latinListOptions[0]['type'] = 'lowerLetter';
$latinListOptions[0]['format'] = '%1.';
$latinListOptions[1]['type'] = 'lowerRoman';
$latinListOptions[1]['format'] = '%1.%2.';
//Create the list style with name: latin
$docx->createListStyle('latin', $latinListOptions);
//List items
$myList = array('item 1', array('subitem 1.1', 'subitem 1.2'), 'item 2');
//Insert custom list into the Word document
$docx->addList($myList, 'latin');
//Save the Word document
$docx->createDocx('example_createListStyle_1');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:19,代码来源:sample_1.php

示例4: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$itemList = array('Line 1', array('Line A', 'Line B', 'Line C'), 'Line 2', 'Line 3');
//we set the style type to 2: ordered list
$docx->addList($itemList, 2);
$docx->createDocx('example_addList_2');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:9,代码来源:sample_2.php

示例5: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$itemList = array('Line 1', 'Line 2', 'Line 3', 'Line 4', 'Line 5');
//stablish some global run properties for each list item
$options = array('font' => 'Arial', 'italic' => true, 'fontSize' => 14, 'color' => 'b70000');
//we set the style type to 1: unordered list
$docx->addList($itemList, 1, $options);
$docx->createDocx('example_addList_4');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:11,代码来源:sample_4.php

示例6: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
//we prepare some formatted text for insertion in the list
$textData = new WordFragment($docx);
$text = array();
$text[] = array('text' => 'We insert some ');
$text[] = array('text' => 'bold text', 'b' => 'on');
$textData->addText($text);
//and also some simple HTML to illustrate the fexibility of the method
$htmlData = new WordFragment($docx);
$html = '<i>Some HTML code</i> with a <a href="http://www.phpdocx.com">link</a>';
$htmlData->embedHTML($html);
$itemList = array('In this example we use a custom list (val = 5) that comes bundled with the default PHPdocX template.', array($textData, 'Line B', 'Line C'), $htmlData, 'Line 3');
//we set the style type to 5: other predefined Word list style
$docx->addList($itemList, 5);
$docx->createDocx('example_addList_3');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:19,代码来源:sample_3.php

示例7: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$itemList = array('Line 1', 'Line 2', 'Line 3', 'Line 4', 'Line 5');
//we set the style type to 1: unordered list
$docx->addList($itemList, 1);
$docx->createDocx('example_addList_1');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:9,代码来源:sample_1.php

示例8: CreateDocx

<?php

/**
 * Create a DOCX file. List 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();
$valuesList = array('Line 1', 'Line 2', 'Line 3', 'Line 4', 'Line 5');
$paramsList = array('val' => 1);
$docx->addList($valuesList, $paramsList);
$docx->createDocx('example_list');
开发者ID:AquinoTest,项目名称:PHP-Digital-Format-Convert-Epub-Mobi-PDF,代码行数:21,代码来源:List.php


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