From 4dcde8c0a9283a4b4d94adf6eeafd937b187e65c Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Sun, 9 Mar 2014 16:06:35 +0700 Subject: [PATCH 01/10] PHPWord_Shared_Drawing::centimetersToPixels() conversion --- Classes/PHPWord/Shared/Drawing.php | 2 +- changelog.txt | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Classes/PHPWord/Shared/Drawing.php b/Classes/PHPWord/Shared/Drawing.php index dba204e3..064e6fcc 100755 --- a/Classes/PHPWord/Shared/Drawing.php +++ b/Classes/PHPWord/Shared/Drawing.php @@ -128,7 +128,7 @@ class PHPWord_Shared_Drawing public static function centimetersToPixels($pValue = 0) { if ($pValue != 0) { - return $pValue * 0.028; + return $pValue / 0.028; } else { return 0; } diff --git a/changelog.txt b/changelog.txt index 4ad31be9..09ffc81f 100755 --- a/changelog.txt +++ b/changelog.txt @@ -44,7 +44,10 @@ Changes in branch for release 0.7.1 : - Feature: (ivanlanin) GH-87 - Paragraph: Ability to define parent style (basedOn) and style for following paragraph (next) - Feature: (jeroenmoors) GH-44 GH-88 - Clone table rows on the fly when using a template document - Feature: (deds) GH-16 - Initial addition of basic footnote support -- Feature: (ivanlanin) GH-91 - Paragraph: Ability to define paragraph pagination: widow control, keep next, keep lines, and page break before +- Feature: (ivanlanin) GH-92 - Paragraph: Ability to define paragraph pagination: widow control, keep next, keep lines, and page break before +- General: (ivanlanin) GH-93 - General: PHPWord_Style_Font refactoring +- General: (ivanlanin) GH-93 - Font: Use points instead of halfpoints internally. Conversion to halfpoints done during XML Writing. +- Bugfix: (ivanlanin) GH-94 - General: PHPWord_Shared_Drawing::centimetersToPixels() conversion - QA: (Progi1984) - UnitTests Changes in branch for release 0.7.0 : From 537f49eeb4639c58c9b0d36ff4c4c7e7701f3747 Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Sun, 9 Mar 2014 17:44:16 +0700 Subject: [PATCH 02/10] Fix non-existing functions in Writer/ODText/Content.php --- Classes/PHPWord/Writer/ODText/Content.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Classes/PHPWord/Writer/ODText/Content.php b/Classes/PHPWord/Writer/ODText/Content.php index 84806f48..fad07d5a 100755 --- a/Classes/PHPWord/Writer/ODText/Content.php +++ b/Classes/PHPWord/Writer/ODText/Content.php @@ -115,7 +115,7 @@ class PHPWord_Writer_ODText_Content extends PHPWord_Writer_ODText_WriterPart $numPStyles++; $pPHPWord->addParagraphStyle('P' . $numPStyles, array()); - $element->setParagraph('P' . $numPStyles); + $element->setParagraphStyle('P' . $numPStyles); } } } @@ -338,4 +338,15 @@ class PHPWord_Writer_ODText_Content extends PHPWord_Writer_ODText_WriterPart private function _writeEndSection(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section $section) { } + + /** + * Dummy function just to make all samples produce ODT + * + * @todo Create the real function + */ + private function _writeSection( + PHPWord_Shared_XMLWriter $objWriter = null, + PHPWord_Section $section) + { + } } From d177b4744b6668c7cc7f349bb389d3510b8dadce Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Sun, 9 Mar 2014 17:47:04 +0700 Subject: [PATCH 03/10] New function PHPWord_Style_Paragraph::setTabs() and unit test for PHPWord_Style_Paragraph --- Classes/PHPWord/Style/Paragraph.php | 37 +++++++---- Tests/PHPWord/Style/ParagraphTest.php | 90 +++++++++++++++++++++++++++ changelog.txt | 1 + 3 files changed, 115 insertions(+), 13 deletions(-) create mode 100644 Tests/PHPWord/Style/ParagraphTest.php diff --git a/Classes/PHPWord/Style/Paragraph.php b/Classes/PHPWord/Style/Paragraph.php index 70732f86..5942ec34 100755 --- a/Classes/PHPWord/Style/Paragraph.php +++ b/Classes/PHPWord/Style/Paragraph.php @@ -145,24 +145,21 @@ class PHPWord_Style_Paragraph /** * Set Style value * - * @param string $key - * @param mixed $value + * @param string $key + * @param mixed $value */ public function setStyleValue($key, $value) { - if ($key == '_indent') { - $value = $value * 720; // 720 twips per indent - } - if ($key == '_hanging') { + if ($key == '_indent' || $key == '_hanging') { $value = $value * 720; } if ($key == '_spacing') { $value += 240; // because line height of 1 matches 240 twips } - if ($key === '_tabs') { - $value = new PHPWord_Style_Tabs($value); + $method = 'set' . ucwords(substr($key, 1)); + if (method_exists($this, $method)) { + $this->$method($value); } - $this->$key = $value; } /** @@ -311,6 +308,20 @@ class PHPWord_Style_Paragraph return $this->_tabs; } + /* + * Set tabs + * + * @param array $pValue + * @return PHPWord_Style_Paragraph + */ + public function setTabs($pValue = null) + { + if (is_array($pValue)) { + $this->_tabs = new PHPWord_Style_Tabs($pValue); + } + return $this; + } + /** * Get parent style ID * @@ -374,7 +385,7 @@ class PHPWord_Style_Paragraph public function setWidowControl($pValue = true) { if (!is_bool($pValue)) { - $pValue = false; + $pValue = true; } $this->_widowControl = $pValue; return $this; @@ -396,7 +407,7 @@ class PHPWord_Style_Paragraph * @param bool $pValue * @return PHPWord_Style_Paragraph */ - public function setKeepNext($pValue = true) + public function setKeepNext($pValue = false) { if (!is_bool($pValue)) { $pValue = false; @@ -421,7 +432,7 @@ class PHPWord_Style_Paragraph * @param bool $pValue * @return PHPWord_Style_Paragraph */ - public function setKeepLines($pValue = true) + public function setKeepLines($pValue = false) { if (!is_bool($pValue)) { $pValue = false; @@ -446,7 +457,7 @@ class PHPWord_Style_Paragraph * @param bool $pValue * @return PHPWord_Style_Paragraph */ - public function setPageBreakBefore($pValue = true) + public function setPageBreakBefore($pValue = false) { if (!is_bool($pValue)) { $pValue = false; diff --git a/Tests/PHPWord/Style/ParagraphTest.php b/Tests/PHPWord/Style/ParagraphTest.php new file mode 100644 index 00000000..c0850cde --- /dev/null +++ b/Tests/PHPWord/Style/ParagraphTest.php @@ -0,0 +1,90 @@ + null, + 'widowControl' => true, + 'keepNext' => false, + 'keepLines' => false, + 'pageBreakBefore' => false, + ); + foreach ($attributes as $key => $default) { + $method = 'get' . ucwords($key); + $object->setStyleValue("_$key", null); + $this->assertEquals($default, $object->$method()); + $object->setStyleValue("_$key", ''); + $this->assertEquals($default, $object->$method()); + } + } + + /** + * Test setting style values with normal value + */ + public function testSetStyleValueNormal() + { + $object = new PHPWord_Style_Paragraph(); + + $attributes = array( + 'align' => 'justify', + 'spaceAfter' => 240, + 'spaceBefore' => 240, + 'indent' => 1, + 'hanging' => 1, + 'spacing' => 120, + 'basedOn' => 'Normal', + 'next' => 'Normal', + 'widowControl' => false, + 'keepNext' => true, + 'keepLines' => true, + 'pageBreakBefore' => true, + ); + foreach ($attributes as $key => $value) { + $method = 'get' . ucwords($key); + $object->setStyleValue("_$key", $value); + if ($key == 'align') { + if ($value == 'justify') { + $value = 'both'; + } + } elseif ($key == 'indent' || $key == 'hanging') { + $value = $value * 720; + } elseif ($key == 'spacing') { + $value += 240; + } + $this->assertEquals($value, $object->$method()); + } + } + + /** + * Test tabs + */ + public function testTabs() + { + $object = new PHPWord_Style_Paragraph(); + $object->setTabs(array( + new PHPWord_Style_Tab('left', 1550), + new PHPWord_Style_Tab('right', 5300), + )); + $this->assertInstanceOf('PHPWord_Style_Tabs', $object->getTabs()); + } + +} diff --git a/changelog.txt b/changelog.txt index 09ffc81f..a6a63214 100755 --- a/changelog.txt +++ b/changelog.txt @@ -48,6 +48,7 @@ Changes in branch for release 0.7.1 : - General: (ivanlanin) GH-93 - General: PHPWord_Style_Font refactoring - General: (ivanlanin) GH-93 - Font: Use points instead of halfpoints internally. Conversion to halfpoints done during XML Writing. - Bugfix: (ivanlanin) GH-94 - General: PHPWord_Shared_Drawing::centimetersToPixels() conversion +- Feature: (ivanlanin) - Paragraph: setTabs() function - QA: (Progi1984) - UnitTests Changes in branch for release 0.7.0 : From 68a4387dcfd8fc8b482c0f71da7b1ebd2bbc7382 Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Sun, 9 Mar 2014 17:47:42 +0700 Subject: [PATCH 04/10] Reformat code samples on README.md to max 80 char per line --- README.md | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 09556559..111070fd 100755 --- a/README.md +++ b/README.md @@ -50,21 +50,25 @@ The following is a basic example of the PHPWord library. ```php $PHPWord = new PHPWord(); -// Every element you want to append to the word document is placed in a section. So you need a section: +// Every element you want to append to the word document is placed in a section. +// To create a basic section: $section = $PHPWord->createSection(); // After creating a section, you can append elements: $section->addText('Hello world!'); // You can directly style your text by giving the addText function an array: -$section->addText('Hello world! I am formatted.', array('name'=>'Tahoma', 'size'=>16, 'bold'=>true)); +$section->addText('Hello world! I am formatted.', + array('name'=>'Tahoma', 'size'=>16, 'bold'=>true)); -// If you often need the same style again you can create a user defined style to the word document -// and give the addText function the name of the style: -$PHPWord->addFontStyle('myOwnStyle', array('name'=>'Verdana', 'size'=>14, 'color'=>'1B2232')); -$section->addText('Hello world! I am formatted by a user defined style', 'myOwnStyle'); +// If you often need the same style again you can create a user defined style +// to the word document and give the addText function the name of the style: +$PHPWord->addFontStyle('myOwnStyle', + array('name'=>'Verdana', 'size'=>14, 'color'=>'1B2232')); +$section->addText('Hello world! I am formatted by a user defined style', + 'myOwnStyle'); -// You can also putthe appended element to local object an call functions like this: +// You can also put the appended element to local object like this: $fontStyle = new PHPWord_Style_Font(); $fontStyle->setBold(true); $fontStyle->setName('Verdana'); @@ -72,7 +76,7 @@ $fontStyle->setSize(22); $myTextElement = $section->addText('Hello World!'); $myTextElement->setFontStyle($fontStyle); -// At least write the document to webspace: +// Finally, write the document: $objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007'); $objWriter->save('helloWorld.docx'); ``` From 26330807f71d303e3138541c18f1479703920384 Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Sun, 9 Mar 2014 17:48:20 +0700 Subject: [PATCH 05/10] Fix parameter input for testWriteParagraphStyle_Pagination --- Tests/PHPWord/Writer/Word2007/BaseTest.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Tests/PHPWord/Writer/Word2007/BaseTest.php b/Tests/PHPWord/Writer/Word2007/BaseTest.php index 0179a6a4..95ca94e1 100644 --- a/Tests/PHPWord/Writer/Word2007/BaseTest.php +++ b/Tests/PHPWord/Writer/Word2007/BaseTest.php @@ -88,10 +88,10 @@ class PHPWord_Writer_Word2007_BaseTest extends \PHPUnit_Framework_TestCase { $PHPWord = new PHPWord(); $section = $PHPWord->createSection(); $attributes = array( - 'widowControl' => 0, - 'keepNext' => 1, - 'keepLines' => 1, - 'pageBreakBefore' => 1, + 'widowControl' => false, + 'keepNext' => true, + 'keepLines' => true, + 'pageBreakBefore' => true, ); foreach ($attributes as $attribute => $value) { $section->addText('Test', null, array($attribute => $value)); @@ -100,11 +100,12 @@ class PHPWord_Writer_Word2007_BaseTest extends \PHPUnit_Framework_TestCase { // Test the attributes $i = 0; - foreach ($attributes as $attribute => $value) { + foreach ($attributes as $key => $value) { $i++; - $path = "/w:document/w:body/w:p[{$i}]/w:pPr/w:{$attribute}"; + $path = "/w:document/w:body/w:p[{$i}]/w:pPr/w:{$key}"; $element = $doc->getElement($path); - $this->assertEquals($value, $element->getAttribute('w:val')); + $expected = $value ? 1 : 0; + $this->assertEquals($expected, $element->getAttribute('w:val')); } } From c3644909550918e120acd335933db7ec92e0290d Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Sun, 9 Mar 2014 21:57:27 +0700 Subject: [PATCH 06/10] Remove PHPWord_Style_Cell::setHeight() since it's irrelevant and never used. Should be in PHPWord_Style_Row --- Classes/PHPWord/Style/Cell.php | 5 ----- 1 file changed, 5 deletions(-) diff --git a/Classes/PHPWord/Style/Cell.php b/Classes/PHPWord/Style/Cell.php index e7d2bf91..1e534e23 100755 --- a/Classes/PHPWord/Style/Cell.php +++ b/Classes/PHPWord/Style/Cell.php @@ -198,11 +198,6 @@ class PHPWord_Style_Cell $this->_bgColor = $pValue; } - public function setHeight($pValue = null) - { - $this->_height = $pValue; - } - public function setBorderSize($pValue = null) { $this->_borderTopSize = $pValue; From fa1663a2b185b5f96a2314581cc9bbbf7b3fa75d Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Sun, 9 Mar 2014 21:59:23 +0700 Subject: [PATCH 07/10] PHP method IS NOT case sensitive :) --- Classes/PHPWord/Style/Font.php | 2 +- Classes/PHPWord/Style/Paragraph.php | 2 +- Tests/PHPWord/Style/FontTest.php | 10 +++++----- Tests/PHPWord/Style/ParagraphTest.php | 10 +++++----- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Classes/PHPWord/Style/Font.php b/Classes/PHPWord/Style/Font.php index 062fe839..43495cdc 100755 --- a/Classes/PHPWord/Style/Font.php +++ b/Classes/PHPWord/Style/Font.php @@ -192,7 +192,7 @@ class PHPWord_Style_Font */ public function setStyleValue($key, $value) { - $method = 'set' . ucwords(substr($key, 1)); + $method = 'set' . substr($key, 1); if (method_exists($this, $method)) { $this->$method($value); } diff --git a/Classes/PHPWord/Style/Paragraph.php b/Classes/PHPWord/Style/Paragraph.php index 5942ec34..c7104e8e 100755 --- a/Classes/PHPWord/Style/Paragraph.php +++ b/Classes/PHPWord/Style/Paragraph.php @@ -156,7 +156,7 @@ class PHPWord_Style_Paragraph if ($key == '_spacing') { $value += 240; // because line height of 1 matches 240 twips } - $method = 'set' . ucwords(substr($key, 1)); + $method = 'set' . substr($key, 1); if (method_exists($this, $method)) { $this->$method($value); } diff --git a/Tests/PHPWord/Style/FontTest.php b/Tests/PHPWord/Style/FontTest.php index 1238f34b..a3fa2086 100644 --- a/Tests/PHPWord/Style/FontTest.php +++ b/Tests/PHPWord/Style/FontTest.php @@ -45,11 +45,11 @@ class PHPWord_Style_FontTest extends \PHPUnit_Framework_TestCase 'fgColor' => null, ); foreach ($attributes as $key => $default) { - $method = 'get' . ucwords($key); + $get = "get{$key}"; $object->setStyleValue("_$key", null); - $this->assertEquals($default, $object->$method()); + $this->assertEquals($default, $object->$get()); $object->setStyleValue("_$key", ''); - $this->assertEquals($default, $object->$method()); + $this->assertEquals($default, $object->$get()); } } @@ -73,9 +73,9 @@ class PHPWord_Style_FontTest extends \PHPUnit_Framework_TestCase 'fgColor' => '999999', ); foreach ($attributes as $key => $value) { - $method = 'get' . ucwords($key); + $get = "get{$key}"; $object->setStyleValue("_$key", $value); - $this->assertEquals($value, $object->$method()); + $this->assertEquals($value, $object->$get()); } } diff --git a/Tests/PHPWord/Style/ParagraphTest.php b/Tests/PHPWord/Style/ParagraphTest.php index c0850cde..23d0b713 100644 --- a/Tests/PHPWord/Style/ParagraphTest.php +++ b/Tests/PHPWord/Style/ParagraphTest.php @@ -29,11 +29,11 @@ class PHPWord_Style_ParagraphTest extends \PHPUnit_Framework_TestCase 'pageBreakBefore' => false, ); foreach ($attributes as $key => $default) { - $method = 'get' . ucwords($key); + $get = "get{$key}"; $object->setStyleValue("_$key", null); - $this->assertEquals($default, $object->$method()); + $this->assertEquals($default, $object->$get()); $object->setStyleValue("_$key", ''); - $this->assertEquals($default, $object->$method()); + $this->assertEquals($default, $object->$get()); } } @@ -59,7 +59,7 @@ class PHPWord_Style_ParagraphTest extends \PHPUnit_Framework_TestCase 'pageBreakBefore' => true, ); foreach ($attributes as $key => $value) { - $method = 'get' . ucwords($key); + $get = "get{$key}"; $object->setStyleValue("_$key", $value); if ($key == 'align') { if ($value == 'justify') { @@ -70,7 +70,7 @@ class PHPWord_Style_ParagraphTest extends \PHPUnit_Framework_TestCase } elseif ($key == 'spacing') { $value += 240; } - $this->assertEquals($value, $object->$method()); + $this->assertEquals($value, $object->$get()); } } From 3d8f09dbc17282ec82d1674d6d57b999a7bf2b17 Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Sun, 9 Mar 2014 22:00:43 +0700 Subject: [PATCH 08/10] PHPWord_Style_CellTest 100% code coverage --- Tests/PHPWord/Style/CellTest.php | 80 ++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 Tests/PHPWord/Style/CellTest.php diff --git a/Tests/PHPWord/Style/CellTest.php b/Tests/PHPWord/Style/CellTest.php new file mode 100644 index 00000000..9cdd7e5e --- /dev/null +++ b/Tests/PHPWord/Style/CellTest.php @@ -0,0 +1,80 @@ + null, + 'textDirection' => null, + 'bgColor' => null, + 'borderTopSize' => null, + 'borderTopColor' => null, + 'borderLeftSize' => null, + 'borderLeftColor' => null, + 'borderRightSize' => null, + 'borderRightColor' => null, + 'borderBottomSize' => null, + 'borderBottomColor' => null, + 'gridSpan' => null, + 'vMerge' => null, + ); + //'defaultBorderColor' => null, + foreach ($attributes as $key => $value) { + $set = "set{$key}"; + $get = "get{$key}"; + $object->$set($value); + $this->assertEquals($value, $object->$get()); + } + } + + /** + * Test border color + */ + public function testBorderColor() + { + $object = new PHPWord_Style_Cell(); + + $default = '000000'; + $value = 'FF0000'; + + $this->assertEquals($default, $object->getDefaultBorderColor()); + + $object->setStyleValue('_defaultBorderColor', $value); + $this->assertEquals($value, $object->getDefaultBorderColor()); + + $object->setStyleValue('_borderColor', $value); + $expected = array($value, $value, $value, $value); + $this->assertEquals($expected, $object->getBorderColor()); + } + + /** + * Test border size + */ + public function testBorderSize() + { + $object = new PHPWord_Style_Cell(); + + $value = 120; + $expected = array($value, $value, $value, $value); + $object->setStyleValue('_borderSize', $value); + $this->assertEquals($expected, $object->getBorderSize()); + } + +} From 34d91214b4ab4bb59605966e68b008868a32a635 Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Sun, 9 Mar 2014 22:17:21 +0700 Subject: [PATCH 09/10] Change normal value for cell style tests --- Tests/PHPWord/Style/CellTest.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/Tests/PHPWord/Style/CellTest.php b/Tests/PHPWord/Style/CellTest.php index 9cdd7e5e..4db86f35 100644 --- a/Tests/PHPWord/Style/CellTest.php +++ b/Tests/PHPWord/Style/CellTest.php @@ -21,19 +21,19 @@ class PHPWord_Style_CellTest extends \PHPUnit_Framework_TestCase $object = new PHPWord_Style_Cell(); $attributes = array( - 'valign' => null, - 'textDirection' => null, - 'bgColor' => null, - 'borderTopSize' => null, - 'borderTopColor' => null, - 'borderLeftSize' => null, - 'borderLeftColor' => null, - 'borderRightSize' => null, - 'borderRightColor' => null, - 'borderBottomSize' => null, - 'borderBottomColor' => null, - 'gridSpan' => null, - 'vMerge' => null, + 'valign' => 'left', + 'textDirection' => PHPWord_Style_Cell::TEXT_DIR_BTLR, + 'bgColor' => 'FFFF00', + 'borderTopSize' => 120, + 'borderTopColor' => 'FFFF00', + 'borderLeftSize' => 120, + 'borderLeftColor' => 'FFFF00', + 'borderRightSize' => 120, + 'borderRightColor' => 'FFFF00', + 'borderBottomSize' => 120, + 'borderBottomColor' => 'FFFF00', + 'gridSpan' => 2, + 'vMerge' => 2, ); //'defaultBorderColor' => null, foreach ($attributes as $key => $value) { From 712e09a2e55e15e9b03d032ee5cb0b6cd8330a84 Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Sun, 9 Mar 2014 22:43:35 +0700 Subject: [PATCH 10/10] Basic README for `addText` and `createTextRun` --- README.md | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 111070fd..2f02013e 100755 --- a/README.md +++ b/README.md @@ -38,9 +38,10 @@ the following lines to your ``composer.json``. 2. [Sections](#sections) * [Section settings](#section-settings) * [Section page numbering](#section-page-numbering) -3. [Tables](#tables) +3. [Texts](#texts) +4. [Tables](#tables) * [Cell Style](#tables-cell-style) -4. [Images](#images) +5. [Images](#images) #### Basic usage @@ -158,6 +159,27 @@ $section = $PHPWord->createSection(); $section->getSettings()->setPageNumberingStart(1); ``` + +#### Texts + +Text can be added by using `addText` and `createTextRun` method. `addText` is used for creating simple paragraphs that only contain texts with the same style. `createTextRun` is used for creating complex paragraphs that contain text with different style (some bold, other italics, etc) or other elements, e.g. images or links. + +`addText` sample: + +```php +$fontStyle = array('name' => 'Times New Roman', 'size' => 9); +$paragraphStyle = array('align' => 'both'); +$section->addText('I am simple paragraph', $fontStyle, $paragraphStyle); +``` + +`createTextRun` sample: + +```php +$textrun = $section->createTextRun(); +$textrun->addText('I am bold', array('bold' => true)); +$textrun->addText('I am italic, array('italic' => true)); +$textrun->addText('I am colored, array('color' => 'AACC00')); +``` #### Tables