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


PHP CreateDocx::addText方法代码示例

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


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

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

示例2: 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 radar chart 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' => 'radar', 'style' => 'radar', 'color' => '2', 'chartAlign' => 'center', 'sizeX' => '12', 'sizeY' => '10', 'legendPos' => 'r', 'legendOverlay' => '0', 'hgrid' => '1', 'vgrid' => '1');
$docx->addChart($paramsChart);
$docx->addText('And now the same radar chart but with filled style:');
$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' => 'radar', 'style' => 'filled', 'color' => '2', 'chartAlign' => 'center', 'sizeX' => '12', 'sizeY' => '10', 'legendPos' => 'r', 'legendOverlay' => '0', 'hgrid' => '1', 'vgrid' => '1');
$docx->addChart($paramsChart);
$docx->createDocx('example_addChart_6');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:14,代码来源:sample_6.php

示例3: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$link = new WordFragment($docx);
$link->addLink('Google', array('url' => 'http://www.google.es'));
$runs = array();
$runs[] = array('text' => 'Now we include a link to ');
$runs[] = $link;
$runs[] = array('text' => ' in the middle of a pragraph of plain text.');
$docx->addText($runs);
$docx->createDocx('example_addLink_2');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:13,代码来源:sample_2.php

示例4: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$docx->addHeading('First level title', 0);
$text = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' . 'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.';
$docx->addText($text);
$docx->addHeading('Second level title', 1);
$docx->addText($text);
$options = array('color' => 'FF0000', 'textAlign' => 'center', 'fontSize' => 13);
$docx->addHeading('Third level title with additional custom formatting', 2, $options);
$docx->addText($text);
$docx->createDocx('example_addHeading_1');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:14,代码来源:sample_1.php

示例5: CreateDocx

 * @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();
//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>
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:31,代码来源:example12.php

示例6: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$docx->addText('We write a math equation using MathMML:');
$mathML = '<math xmlns="http://www.w3.org/1998/Math/MathML">
	<mrow>
		<mi>A</mi> 
		<mo>=</mo>
		<mfenced open="[" close="]">
			<mtable>
				<mtr>
					<mtd>
						<mi>x</mi>
					</mtd> 
					<mtd>
						<mn>2</mn>
					</mtd>
				</mtr>
				<mtr>
					<mtd>
						<mn>3</mn>
					</mtd>
					<mtd>
						<mi>w</mi>
					</mtd>
				</mtr>
			</mtable>
		</mfenced>
	</mrow>
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:31,代码来源:sample_3.php

示例7: 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();
$docx = new CreateDocx();
$docx->addText('Hello world!');
$docx->createDocx('../word_documents/hello_world');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:20,代码来源:example1.php

示例8: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$docx->addText('This is just a simple text to help illustrate how to mark a document as final.');
$docx->addText('Beware that this \'protection\' can be easily removed by an expert user.');
$docx->setMarkAsFinal();
$docx->createDocx('example_setMarkAsFinal_1');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:9,代码来源:sample_1.php

示例9: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$docx->addText('This example illustrates how to add a mergefield to a Word document.');
$mergeParameters = array('format' => 'Upper', 'textBefore' => 'A mergefield example: ', 'textAfter' => ' and some text afterwards.');
$options = array('color' => 'B70000');
$docx->addMergeField('MyMergeField example', $mergeParameters, $options);
//remove the shading from the mergeField data
$docx->docxSettings(array('doNotShadeFormData' => 0));
$docx->createDocx('example_addMergeField_1');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:12,代码来源:sample_1.php

示例10: CreateDocx

<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
//You may first check the available styles using the parseStyles('../files/TemplateStyles.docx') methohd
$docx->importStyles('../../files/stylesTemplate.docx', 'merge', array('heading 1'));
$docx->addText('This is the resulting paragraph with a standard heading style.', array('pStyle' => 'Heading1'));
//You may also import a complete XML style sheet by
//$docx->importStyles('../files/TemplateStyles.docx', $type= 'replace');
$docx->createDocx('example_importStyles_2');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:11,代码来源:sample_2.php

示例11: 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 area chart 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' => 'area3DChart', 'color' => '2', 'perspective' => '30', 'rotX' => '30', 'rotY' => '30', 'font' => 'Arial', 'chartAlign' => 'center', 'showTable' => 1, 'sizeX' => '12', 'sizeY' => '10', 'legendPos' => 'r', 'legendOverlay' => '0', 'hgrid' => '3', 'vgrid' => '2');
$docx->addChart($paramsChart);
$docx->addText('And now the same chart in 2D with a different color scheme 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' => 'areaChart', 'color' => '5', 'chartAlign' => 'center', 'showTable' => 0, 'sizeX' => '12', 'sizeY' => '10', 'legendPos' => 'b', 'legendOverlay' => '0', 'hgrid' => '3', 'vgrid' => '1');
$docx->addChart($paramsChart);
$docx->createDocx('example_addChart_5');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:14,代码来源:sample_5.php

示例12: 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 to be inserted in the header of the document
$imageOptions = array('src' => '../../img/image.png', 'dpi' => 300);
$default = new WordFragment($docx, 'defaultFooter');
$default->addImage($imageOptions);
$first = new WordFragment($docx, 'firstFooter');
$first->addText('first page footer.');
$even = new WordFragment($docx, 'evenFooter');
$even->addText('even page footer.');
$docx->addFooter(array('default' => $default, 'first' => $first, 'even' => $even));
//add some text
$docx->addText('This is the first page of a document with different footers for the first and even pages.');
$docx->addBreak(array('type' => 'page'));
$docx->addText('This is the second page.');
$docx->addBreak(array('type' => 'page'));
$docx->addText('This is the third page.');
$docx->createDocx('example_addFooter_2');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:21,代码来源:sample_2.php

示例13: 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 surface chart to the Word document:');
$data = array('legend' => array('Series 1', 'Series 2', 'Series 3'), 'Value1' => array(4.3, 2.4, 2), 'Value2' => array(2.5, 4.4, 2), 'Value3' => array(3.5, 1.8, 3), 'Value4' => array(4.5, 2.8, 5), 'Value5' => array(5, 2, 3));
$paramsChart = array('data' => $data, 'type' => 'surfaceChart', 'legendpos' => 't', 'legendoverlay' => false, 'sizeX' => 12, 'sizeY' => 8, 'chartAlign' => 'center', 'color' => 2);
$docx->addChart($paramsChart);
$docx->createDocx('example_addChart_11');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:10,代码来源:sample_11.php

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

示例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('../word_documents/frontPageTemplate.docx');
//You should include the path to your base template
$docx->addText('This is a numbered Heading', array('pStyle' => 'Heading1PHPDOCX'));
$docx->addText('Hello world again!');
$docx->addText('This is a  Subheading', array('pStyle' => 'Heading2PHPDOCX'));
$docx->addText('No more Hello world, please!');
$docx->createDocx('../word_documents/front_page');
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:22,代码来源:example14.php


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