コード例 #1
1
<?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');
コード例 #2
1
<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
//You should include the relative path to the image you want to use as background
$docx->addBackgroundImage('../../img/image.jpg');
//add a paragraph of text
$docx->addText('Please, use a discrete background image so the text is easily readable.');
$docx->addText('This one is pretty annoying but it illustrates well the functionality :-)');
$docx->createDocx('example_addBackgroundImage_1');
コード例 #3
0
<?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');
コード例 #4
0
<?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');
コード例 #5
0
<?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');
コード例 #6
0
 * @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>
コード例 #7
0
<?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');
コード例 #8
0
<?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>
コード例 #9
0
<?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/TemplateStyles.docx', 'merge', array('crazyStyle'));
$docx->addText('This is the resulting paragraph with the "CrazyStyle".', array('pStyle' => 'crazyStyle'));
//You may also import a complete XML style sheet by
//$docx->importStyles('../files/TemplateStyles.docx', $type= 'replace');
$docx->createDocx('example_importStyles_1');
コード例 #10
0
<?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');
コード例 #11
0
<?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');
コード例 #12
0
<?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');
コード例 #13
0
<?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');
コード例 #14
0
<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$bookmarkStart = new WordFragment($docx);
$bookmarkStart->addBookmark(array('type' => 'start', 'name' => 'bookmark_name'));
$bookmarkEnd = new WordFragment($docx);
$bookmarkEnd->addBookmark(array('type' => 'end', 'name' => 'bookmark_name'));
$textRuns = array();
$textRuns[] = array('text' => 'We are only going to bookmark: ');
$textRuns[] = $bookmarkStart;
$textRuns[] = array('text' => 'this words.');
$textRuns[] = $bookmarkEnd;
$docx->addText($textRuns);
$docx->createDocx('example_addBookmark_2');
コード例 #15
0
<?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');
コード例 #16
0
<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
//Set the background color of the document
$docx->setBackgroundColor('FFFFCC');
//Include a paragraph of plain text
$docx->addText('This document should have a pale yellow background color.');
$docx->createDocx('example_setBackgroundColor_1');
コード例 #17
0
<?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');
コード例 #18
0
<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$docx->addText('Quisque ullamcorper, dolor eget eleifend consequat, 
    justo nunc ultricies quam, sed ullamcorper lectus urna ac justo. 
    Phasellus sed libero ut dui hendrerit tempus. Mauris tincidunt 
    laoreet sapien, feugiat viverra justo dictum eu. Cras at eros ac 
    urna accumsan varius. Vestibulum cursus gravida sollicitudin. 
    Donec vestibulum lectus id sem malesuada volutpat. Praesent et ipsum orci. 
    Sed rutrum eros id erat fermentum in auctor velit auctor. 
    Nam bibendum rutrum augue non pellentesque. Donec in mauris dui, 
    non sagittis dui. Phasellus quam leo, ultricies sit amet cursus nec, 
    elementum at est. Proin blandit volutpat odio ac dignissim. 
    In at lacus dui, sed scelerisque ante. Aliquam tempor, 
    metus sed malesuada vehicula, neque massa malesuada dolor, 
    vel semper massa ante eu nibh.');
//create a simple Word fragment to insert into the table
$textFragment = new WordFragment($docx);
$text = array();
$text[] = array('text' => 'Fit text and ');
$text[] = array('text' => 'Word fragment', 'bold' => true);
$textFragment->addText($text);
//stablish some row properties for the first row
$trProperties = array();
$trProperties[0] = array('minHeight' => 1000, 'tableHeader' => true);
$col_1_1 = array('rowspan' => 4, 'value' => '1_1', 'backgroundColor' => 'cccccc', 'borderColor' => 'b70000', 'border' => 'single', 'borderTopColor' => '0000FF', 'borderWidth' => 16, 'cellMargin' => 200);
$col_2_2 = array('rowspan' => 2, 'colspan' => 2, 'width' => 200, 'value' => $textFragment, 'backgroundColor' => 'ffff66', 'borderColor' => 'b70000', 'border' => 'single', 'cellMargin' => 200, 'fitText' => 'on', 'vAlign' => 'bottom');
$col_2_4 = array('rowspan' => 3, 'value' => 'Some rotated text', 'backgroundColor' => 'eeeeee', 'borderColor' => 'b70000', 'border' => 'single', 'borderWidth' => 16, 'textDirection' => 'tbRl');
//set teh global table properties
コード例 #19
0
<?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');
コード例 #20
0
<?php

error_reporting(-1);
ini_set("display_errors", 1);
//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$text = 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, ' . 'sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut ' . 'enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut' . 'aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit ' . 'in voluptate velit esse cillum dolore eu fugiat nulla pariatur. ' . 'Excepteur sint occaecat cupidatat non proident, sunt in culpa qui ' . 'officia deserunt mollit anim id est laborum.';
$paragraphOptions = array('bold' => true, 'font' => 'Arial');
$docx->addText($text, $paragraphOptions);
$docx->createDocx('D:\\inetpub\\qa\\doctopdf\\docx\\output\\example_addText_1');
コード例 #21
0
<?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);
$headerImage = new WordFragment($docx, 'defaultHeader');
$headerImage->addImage($imageOptions);
$docx->addHeader(array('default' => $headerImage));
//add some text
$docx->addText('This document has a header with just one image.');
$docx->createDocx('example_addHeader_1');
コード例 #22
0
<?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 pie chart to the Word document:');
$data = array('Legend 1' => array(20), 'Legend 2' => array(30), 'Legend 3' => array(40));
$paramsChart = array('data' => $data, 'type' => 'pie3DChart', 'rotX' => 20, 'rotY' => 20, 'perspective' => 30, 'color' => 2, 'sizeX' => 10, 'sizeY' => 5, 'chartAlign' => 'center', 'showPercent' => 1);
$docx->addChart($paramsChart);
$docx->addText('And now the same chart in 2D with a different color scheme and without the percentages:');
$data = array('Legend 1' => array(20), 'Legend 2' => array(30), 'Legend 3' => array(40));
$paramsChart = array('data' => $data, 'type' => 'pieChart', 'color' => 3, 'sizeX' => 10, 'sizeY' => 5, 'chartAlign' => 'center');
$docx->addChart($paramsChart);
$docx->createDocx('example_addChart_1');
コード例 #23
0
<?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 column chart "100% stacked" 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' => 'col3DChart', 'color' => '2', 'perspective' => '40', 'rotX' => '30', 'rotY' => '30', 'chartAlign' => 'center', 'showtable' => 1, 'sizeX' => '10', 'sizeY' => '10', 'legendPos' => 't', 'legendOverlay' => '0', 'border' => '1', 'hgrid' => '0', 'vgrid' => '0', 'groupBar' => 'percentStacked');
$docx->addChart($paramsChart);
$docx->addText('And now the same chart with a different color scheme and perspective, without the data table and simply stacked:');
$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' => 'col3DChart', 'color' => '3', 'perspective' => '10', 'rotX' => '10', 'rotY' => '10', 'chartAlign' => 'center', 'sizeX' => '10', 'sizeY' => '10', 'legendPos' => 'b', 'legendOverlay' => '0', 'border' => '1', 'hgrid' => '3', 'vgrid' => '0', 'groupBar' => 'stacked');
$docx->addChart($paramsChart);
$docx->createDocx('example_addChart_3');
コード例 #24
0
<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$docx->addText('We are going to insert now a full MHT document. Beware that this method is not compatible with legacy versions of Word running the docx compatibility pack.');
$docx->addExternalFile(array('src' => '../../files/Test.mht'));
$docx->addText('A new paragraph.');
$docx->createDocx('example_addMHT');
コード例 #25
0
<?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');
コード例 #26
0
<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
//Date in the header
$options_1 = array('bold' => true, 'fontSize' => 12, 'color' => 'b70000', 'dateFormat' => 'dd/MM/yyyy H:mm:ss');
$date = new WordFragment($docx);
$date->addDateAndHour($options_1);
$docx->addHeader(array('default' => $date));
$docx->addText('Let us include now different examples of the addDateAndHour with different date formatting:');
$options_2 = array('textAlign' => 'center', 'bold' => true, 'fontSize' => 14, 'color' => '333333', 'dateFormat' => "dd' of 'MMMM' of 'yyyy' at 'H:mm");
$docx->addDateAndHour($options_2);
$options_3 = array('bold' => true, 'fontSize' => 11, 'color' => '0000FF', 'dateFormat' => "MM'-'dd'-'yy");
$docx->addDateAndHour($options_3);
$docx->createDocx('example_addDateAndHour_1');
コード例 #27
0
<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$endnote = new WordFragment($docx, 'document');
$endnote->addEndnote(array('textDocument' => 'endnote', 'textEndnote' => 'The endnote we want to insert.'));
$text = array();
$text[] = array('text' => 'Here comes the ');
$text[] = $endnote;
$text[] = array('text' => ' and some other text.');
$docx->addText($text);
$docx->addText('Some other text.');
$docx->createDocx('example_addEndnote_1');
コード例 #28
0
<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
$docx->addText('We are now going to add a paragraph by inserting a chunk of WordML code.');
$wordML = '<w:p><w:r><w:t>A very simple paragraph with only text.</w:t></w:r></w:p>';
$docx->addWordML($wordML);
$docx->addText('Beaware that this is not, in general, a recommendable practice unless you are truly familiar with the OOXML standard.');
$docx->createDocx('example_addWordML_1');
コード例 #29
0
<?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');
コード例 #30
-1
<?php

//path to  the CreateDocx class within your PHPDocX installation
require_once '../../../classes/CreateDocx.inc';
$docx = new CreateDocx();
//create a Word fragment to insdert in the default header
$numbering = new WordFragment($docx, 'defaultHeader');
//sert some formatting options
$options = array('textAlign' => 'right', 'bold' => true, 'sz' => 14, 'color' => 'B70000');
$numbering->addPageNumber('numerical', $options);
$docx->addHeader(array('default' => $numbering));
//Now we include a couple of pages to better illustrate the example
$docx->addText('This is the first page.');
$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_addPageNumber_1');