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


PHP CreateDocx::createDocx方法代码示例

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


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

示例1: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$footnote = new WordFragment($docx, 'document');
$footnote->addFootnote(array('textDocument' => 'footnote', 'textFootnote' => 'The footnote we want to insert.'));
$text = array();
$text[] = array('text' => 'Here comes the ');
$text[] = $footnote;
$text[] = array('text' => ' and some other text.');
$docx->addText($text);
$docx->addText('Some other text.');
$docx->createDocx('example_addFootnote_1');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:14,代码来源:sample_1.php

示例2: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
//Style options
$style = array('color' => '999999', 'border' => 'single', 'borderLeft' => 'double', 'borderColor' => '990000', 'borderRightColor' => '000099', 'borderWidth' => 12, 'borderTopWidth' => 24, 'indentLeft' => 920);
//Create custom style
$docx->createParagraphStyle('myStyle', $style);
//insert a paragraph with that style
$text = 'A paragraph in grey color with borders. All borders are red but the right one that is blue. ';
$text .= 'The general border style is single but the left border that is double. The top border is also thicker. ';
$text .= 'We also include big left indentation.';
$docx->addText($text, array('pStyle' => 'myStyle'));
$docx->createDocx('example_createParagraphStyle_1');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:15,代码来源:sample_1.php

示例3: CreateDocx

<?php 
/**
 * Sets the default language of the 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->setLanguage('es-ES');
$docx->AddText('Este documento tiene el español de España como idioma por defecto (The default document language has been set to Spanish-Spain).');
$docx->createDocx('../docx/example_setLanguage');
开发者ID:rana07i,项目名称:nr-betaRelease,代码行数:19,代码来源:SetLanguage.php

示例4: array

$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');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:30,代码来源:example8.php

示例5: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$docx->addText('We will now add a 3D line chart with a title to the Word document:');
$data = array('legend' => array('Series 1', 'Series 2', 'Series 3'), 'data 1' => array(10, 7, 5), 'data 2' => array(20, 60, 3), 'data 3' => array(50, 33, 7), 'data 4' => array(25, 0, 14));
$paramsChart = array('data' => $data, 'type' => 'line3DChart', 'title' => 'Three dimensional line chart', 'color' => '2', 'perspective' => '30', 'rotX' => '30', 'rotY' => '30', 'font' => 'Arial', 'chartAlign' => 'center', 'showTable' => 0, 'sizeX' => '12', 'sizeY' => '10', 'legendPos' => 't', 'legendOverlay' => '0', 'haxLabel' => 'Horizontal label', 'vaxLabel' => 'Vertical label', 'haxLabelDisplay' => 'horizontal', 'vaxLabelDisplay' => 'horizontal', 'hgrid' => '3', 'vgrid' => '1');
$docx->addChart($paramsChart);
$docx->addText('And now the same chart in 2D with a different color schem and options:');
$data = array('legend' => array('Series 1', 'Series 2', 'Series 3'), 'data 1' => array(10, 7, 5), 'data 2' => array(20, 60, 3), 'data 3' => array(50, 33, 7), 'data 4' => array(25, 0, 14));
$paramsChart = array('data' => $data, 'type' => 'lineChart', 'color' => '5', 'chartAlign' => 'center', 'showTable' => 0, 'sizeX' => '12', 'sizeY' => '10', 'legendPos' => 'b', 'legendOverlay' => '0', 'haxLabel' => 'X Axis', 'vaxLabel' => 'Y Axis', 'haxLabelDisplay' => 'horizontal', 'vaxLabelDisplay' => 'vertical', 'hgrid' => '3', 'vgrid' => '1');
$docx->addChart($paramsChart);
$docx->createDocx('example_addChart_4');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:14,代码来源:sample_4.php

示例6: array

  </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->addBreak();
$text = 'We are going to locate three pictures in a row just below this text. And we are going to use Trebuchet MS font to change a little bit :-)';
$paramsText = array('font' => 'Trebuchet MS');
$docx->addText($text, $paramsText);
$images = array('../img/image.png', '../img/image.png', '../img/image.png');
$wordImages = array();
foreach ($images as $image) {
    $paramsImg = array('name' => $image, 'dpi' => 120, 'scaling' => 90, 'spacingTop' => 10, 'spacingBottom' => 10, 'spacingLeft' => 10, 'spacingRight' => 10, 'textWrap' => 1);
    array_push($wordImages, $docx->addElement('addImage', $paramsImg));
}
$paramsTable = array('TBLSTYLEval' => 'NormalTablePHPDOCX');
$valuesTable = array($wordImages);
$docx->addTable($valuesTable, $paramsTable);
$legends = array('legend' => array('sequence 1', 'sequence 2', 'sequence 3'), 'Category 1' => array(9.300000000000001, 2.4, 2), 'Category 2' => array(8.5, 4.4, 1), 'Category 3' => array(6.5, 1.8, 0.5), 'Category 4' => array(8.5, 3, 1), 'Category 5' => array(6, 5, 2.6));
$args = array('data' => $legends, 'type' => 'colBar', 'title' => 'Chart with table', 'sizeX' => 15, 'sizeY' => 15, 'legendPos' => 't', 'border' => 1, 'vgrid' => 1, 'showtable' => 1);
$docx->addChart($args);
$docx->createDocx('../word_documents/example_chart_showtable');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:30,代码来源:example12.php

示例7: array

	  <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->addBreak();
$text = 'We are going to locate three pictures in a row just below this text. And we are going to use Trebuchet MS font to change a little bit :-)';
$paramsText = array('font' => 'Trebuchet MS');
$docx->addText($text, $paramsText);
$images = array('../img/image.png', '../img/image.png', '../img/image.png');
$wordImages = array();
foreach ($images as $image) {
    $paramsImg = array('name' => $image, 'dpi' => 120, 'scaling' => 90, 'spacingTop' => 10, 'spacingBottom' => 10, 'spacingLeft' => 10, 'spacingRight' => 10, 'textWrap' => 1);
    array_push($wordImages, $docx->addElement('addImage', $paramsImg));
}
$paramsTable = array('TBLSTYLEval' => 'NormalTablePHPDOCX');
$valuesTable = array($wordImages);
$docx->addTable($valuesTable, $paramsTable);
$docx->createDocx('../word_documents/example_image_table');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:30,代码来源:example10.php

示例8: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$footnote = new WordFragment($docx, 'document');
$html = new WordFragment($docx, 'footnote');
//notice the different "target"
$htmlCode = '<p>This is some HTML code with a link to <a href="http://www.2mdc.com">2mdc.com</a> and a random image: 
<img src="../../img/image.png" width="35" height="35" style="vertical-align: middle"></p>';
$html->embedHTML($htmlCode, array('downloadImages' => true));
$footnote->addFootnote(array('textDocument' => 'footnote', 'textFootnote' => $html, 'footnoteMark' => array('customMark' => '*')));
$text = array();
$text[] = array('text' => 'Here comes the ');
$text[] = $footnote;
$text[] = array('text' => ' and some other text.');
$docx->addText($text);
$docx->addText('Some other text.');
$docx->createDocx('example_Footnote_2');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:19,代码来源:sample_2.php

示例9: 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

示例10: CreateDocx

<?php

/**
 * Inserts a simple table into the 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();
$valuesTable = array(array(11, 12), array(21, 22));
$paramsTable = array('border' => 'single', 'border_sz' => 20);
$docx->addTable($valuesTable, $paramsTable);
$docx->createDocx('../docx/example_table');
开发者ID:rana07i,项目名称:nr-betaRelease,代码行数:21,代码来源:Table.php

示例11: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$docx->addText('In this first example we just add an image with a dashed border:');
$options = array('src' => '../../img/image.png', 'imageAlign' => 'center', 'scaling' => 50, 'spacingTop' => 10, 'spacingBottom' => 0, 'spacingLeft' => 0, 'spacingRight' => 20, 'textWrap' => 0, 'borderStyle' => 'lgDash', 'borderWidth' => 6, 'borderColor' => 'FF0000');
$docx->addImage($options);
$docx->addText('This is a closing paragraph.');
$docx->createDocx('example_addImage_1');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:10,代码来源:sample_1.php

示例12: CreateDocx

<?php

/**
 * Create a DOCX file. Two charts in the same DOCX
 *
 * @category   Phpdocx
 * @package    examples
 * @subpackage intermediate
 * @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();
$legends = array('legend1' => array(10, 11, 12), 'legend2' => array(0, 1, 2), 'legend3' => array(40, 41, 42));
$args = array('data' => $legends, 'type' => 'pie3DChart', 'title' => 'Title first chart', 'cornerX' => 20, 'cornerY' => 20, 'cornerP' => 30, 'color' => 2, 'textWrap' => 0, 'sizeX' => 10, 'sizeY' => 10, 'jc' => 'left', 'showPercent' => 1, 'font' => 'Times New Roman');
$docx->addGraphic($args);
$legends = array('0' => array('sequence 1', 'sequence 2', 'sequence 3'), 'Category 1' => array(9.300000000000001, 2.4, 2), 'Category 2' => array(2.5, 4.4, 1), 'Category 3' => array(3.5, 1.8, 0.5), 'Category 4' => array(1.5, 8, 1));
$args = array('data' => $legends, 'type' => 'colChart', 'title' => 'Title second chart', 'color' => 2, 'textWrap' => 0, 'sizeX' => 17, 'sizeY' => 7, 'jc' => 'center', 'font' => 'Arial');
$docx->addGraphic($args);
$docx->createDocx('example_chart');
开发者ID:aodkrisda,项目名称:PHP-Digital-Format-Convert-Epub-Mobi-PDF,代码行数:24,代码来源:Chart.php

示例13: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
//create a Word fragment with an image
$image = new WordFragment($docx);
$imageOptions = array('src' => '../../img/image.png', 'scaling' => 50, 'float' => 'right', 'textWrap' => 1);
$image->addImage($imageOptions);
//create a Word fragment with a link
$link = new WordFragment($docx);
$linkOptions = array('url' => 'http://www.google.es', 'color' => '0000FF', 'underline' => 'single');
$link->addLink('link to Google', $linkOptions);
//create a Word fragment with a footnote
$footnote = new WordFragment($docx);
$footnote->addFootnote(array('textDocument' => 'here it is', 'textFootnote' => 'This is the footnote text.'));
//now we insert the different runs of text with created content and some text
$text = array();
$text[] = $image;
$text[] = array('text' => 'I am going to write a link: ', 'bold' => true);
$text[] = $link;
$text[] = array('text' => ' to illustrate how to include links. ');
$text[] = array('text' => ' As you may see it is extremely simple to do so and it can be done with any other Word element. For example to include  a footnote is also as simple as this: ');
$text[] = $footnote;
$text[] = array('text' => ' , as you may check there is a footnote at the bootom of the page. ', 'color' => 'B70000');
$docx->addText($text);
$docx->createDocx('example_addText_3');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:27,代码来源:sample_3.php

示例14: CreateDocx

<?php

/**
 * Insert an unordered list 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();
$valuesList = array('Line 1', 'Line 2', 'Line 3', 'Line 4', 'Line 5');
$paramsList = array('val' => 1);
$docx->addList($valuesList, $paramsList);
$docx->createDocx('../docx/example_list');
开发者ID:rana07i,项目名称:nr-betaRelease,代码行数:21,代码来源:List.php

示例15: CreateDocx

<?php 
/**
 * Tutorial example
 *
 * @category   Phpdocx
 * @package    tutorial
 * @subpackage easy
 * @copyright  Copyright (c) 2009-2011 Narcea Producciones Multimedia S.L.
 *             (http://www.2mdc.com)
 * @license    http://www.phpdocx.com/wp-content/themes/lightword/pro_license.php
 * @version    1.8
 * @link       http://www.phpdocx.com
 * @since      01/03/2012
 */
require_once '../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$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);
$docx->createDocx('../word_documents/hello_world2');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:22,代码来源:example2.php


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