From 2c5fed61bd3427546b75d3bf00bd29f46b750bba Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Thu, 16 Jan 2014 04:19:41 -0800 Subject: [PATCH 01/24] https://github.com/PHPOffice/PHPWord/issues/52 Ability to limit number of replacements performed by setValue() method of Template class --- Classes/PHPWord/Template.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Classes/PHPWord/Template.php b/Classes/PHPWord/Template.php index a01a8541..464c51f3 100755 --- a/Classes/PHPWord/Template.php +++ b/Classes/PHPWord/Template.php @@ -81,8 +81,9 @@ class PHPWord_Template * * @param mixed $search * @param mixed $replace + * @param integer $limit */ - public function setValue($search, $replace) + public function setValue($search, $replace, $limit = -1) { $pattern = '|\$\{([^\}]+)\}|U'; preg_match_all($pattern, $this->_documentXML, $matches); @@ -102,7 +103,12 @@ class PHPWord_Template } } - $this->_documentXML = str_replace($search, $replace, $this->_documentXML); + $regExpDelim = '/'; + $escapedSearch = preg_quote($search, $regExpDelim); + $this->_documentXML = preg_replace("{$regExpDelim}{$escapedSearch}{$regExpDelim}u", + $replace, + $this->_documentXML, + $limit); } /** @@ -134,4 +140,4 @@ class PHPWord_Template rename($this->_tempFileName, $strFilename); } -} \ No newline at end of file +} From 3cd60f76de701f05459e9fe2836e92dd78179764 Mon Sep 17 00:00:00 2001 From: Roman Syroeshko Date: Fri, 17 Jan 2014 00:02:09 -0800 Subject: [PATCH 02/24] https://github.com/PHPOffice/PHPWord/issues/56 Postprocessing of documents returned by Template class before moving to final destination --- Classes/PHPWord/Template.php | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/Classes/PHPWord/Template.php b/Classes/PHPWord/Template.php index a01a8541..2cf198ec 100755 --- a/Classes/PHPWord/Template.php +++ b/Classes/PHPWord/Template.php @@ -117,14 +117,9 @@ class PHPWord_Template /** * Save Template * - * @param string $strFilename + * @return string */ - public function save($strFilename) - { - if (file_exists($strFilename)) { - unlink($strFilename); - } - + public function save() { $this->_objZip->addFromString('word/document.xml', $this->_documentXML); // Close zip file @@ -132,6 +127,21 @@ class PHPWord_Template throw new Exception('Could not close zip file.'); } - rename($this->_tempFileName, $strFilename); + return $this->_tempFileName; } -} \ No newline at end of file + + /** + * Save Template As... + * + * @param string $strFilename + */ + public function saveAs($strFilename) { + $tempFilename = $this->save(); + + if (file_exists($strFilename)) { + unlink($strFilename); + } + + rename($tempFilename, $strFilename); + } +} From 3cf069fc46477fae3c29f741bd6e27f819c8f61a Mon Sep 17 00:00:00 2001 From: Gabriel Bull Date: Wed, 12 Feb 2014 11:21:04 -0500 Subject: [PATCH 03/24] Happy new year! --- Classes/PHPWord.php | 4 ++-- Classes/PHPWord/Autoloader.php | 4 ++-- Classes/PHPWord/DocumentProperties.php | 4 ++-- Classes/PHPWord/Exception.php | 4 ++-- Classes/PHPWord/HashTable.php | 6 +++--- Classes/PHPWord/IOFactory.php | 4 ++-- Classes/PHPWord/Media.php | 4 ++-- Classes/PHPWord/Section.php | 4 ++-- Classes/PHPWord/Section/Footer.php | 4 ++-- Classes/PHPWord/Section/Footer/PreserveText.php | 4 ++-- Classes/PHPWord/Section/Header.php | 4 ++-- Classes/PHPWord/Section/Image.php | 4 ++-- Classes/PHPWord/Section/Link.php | 4 ++-- Classes/PHPWord/Section/ListItem.php | 4 ++-- Classes/PHPWord/Section/MemoryImage.php | 4 ++-- Classes/PHPWord/Section/Object.php | 4 ++-- Classes/PHPWord/Section/PageBreak.php | 4 ++-- Classes/PHPWord/Section/Settings.php | 4 ++-- Classes/PHPWord/Section/Table.php | 4 ++-- Classes/PHPWord/Section/Table/Cell.php | 4 ++-- Classes/PHPWord/Section/Text.php | 4 ++-- Classes/PHPWord/Section/TextBreak.php | 4 ++-- Classes/PHPWord/Section/TextRun.php | 4 ++-- Classes/PHPWord/Section/Title.php | 4 ++-- Classes/PHPWord/Shared/Drawing.php | 4 ++-- Classes/PHPWord/Shared/File.php | 4 ++-- Classes/PHPWord/Shared/Font.php | 4 ++-- Classes/PHPWord/Shared/String.php | 4 ++-- Classes/PHPWord/Shared/XMLWriter.php | 4 ++-- Classes/PHPWord/Shared/ZipStreamWrapper.php | 4 ++-- Classes/PHPWord/Style.php | 4 ++-- Classes/PHPWord/Style/Cell.php | 4 ++-- Classes/PHPWord/Style/Font.php | 4 ++-- Classes/PHPWord/Style/Image.php | 4 ++-- Classes/PHPWord/Style/ListItem.php | 4 ++-- Classes/PHPWord/Style/Paragraph.php | 4 ++-- Classes/PHPWord/Style/TOC.php | 4 ++-- Classes/PHPWord/Style/Tab.php | 4 ++-- Classes/PHPWord/Style/Table.php | 4 ++-- Classes/PHPWord/Style/TableFull.php | 4 ++-- Classes/PHPWord/Style/Tabs.php | 4 ++-- Classes/PHPWord/TOC.php | 4 ++-- Classes/PHPWord/Template.php | 4 ++-- Classes/PHPWord/Writer/IWriter.php | 4 ++-- Classes/PHPWord/Writer/ODText.php | 6 +++--- Classes/PHPWord/Writer/ODText/Content.php | 6 +++--- Classes/PHPWord/Writer/ODText/Manifest.php | 6 +++--- Classes/PHPWord/Writer/ODText/Meta.php | 6 +++--- Classes/PHPWord/Writer/ODText/Mimetype.php | 6 +++--- Classes/PHPWord/Writer/ODText/Styles.php | 6 +++--- Classes/PHPWord/Writer/ODText/WriterPart.php | 6 +++--- Classes/PHPWord/Writer/RTF.php | 6 +++--- Classes/PHPWord/Writer/Word2007.php | 4 ++-- Classes/PHPWord/Writer/Word2007/Base.php | 4 ++-- Classes/PHPWord/Writer/Word2007/ContentTypes.php | 4 ++-- Classes/PHPWord/Writer/Word2007/DocProps.php | 4 ++-- Classes/PHPWord/Writer/Word2007/Document.php | 4 ++-- Classes/PHPWord/Writer/Word2007/DocumentRels.php | 4 ++-- Classes/PHPWord/Writer/Word2007/Footer.php | 4 ++-- Classes/PHPWord/Writer/Word2007/Header.php | 4 ++-- Classes/PHPWord/Writer/Word2007/Rels.php | 4 ++-- Classes/PHPWord/Writer/Word2007/Styles.php | 4 ++-- Classes/PHPWord/Writer/Word2007/WriterPart.php | 4 ++-- changelog.txt | 4 ++-- composer.json | 3 +++ 65 files changed, 140 insertions(+), 137 deletions(-) diff --git a/Classes/PHPWord.php b/Classes/PHPWord.php index 3879d7cd..d24b9e44 100755 --- a/Classes/PHPWord.php +++ b/Classes/PHPWord.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Autoloader.php b/Classes/PHPWord/Autoloader.php index 601c2ebf..9bd88596 100755 --- a/Classes/PHPWord/Autoloader.php +++ b/Classes/PHPWord/Autoloader.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/DocumentProperties.php b/Classes/PHPWord/DocumentProperties.php index c96ac0d4..2bf44043 100755 --- a/Classes/PHPWord/DocumentProperties.php +++ b/Classes/PHPWord/DocumentProperties.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Exception.php b/Classes/PHPWord/Exception.php index d1da2099..bd73d52c 100755 --- a/Classes/PHPWord/Exception.php +++ b/Classes/PHPWord/Exception.php @@ -20,8 +20,8 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @copyright Copyright (c) 2014 PHPWord + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/HashTable.php b/Classes/PHPWord/HashTable.php index cb4f8539..5b6fbd04 100755 --- a/Classes/PHPWord/HashTable.php +++ b/Classes/PHPWord/HashTable.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,8 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @copyright Copyright (c) 2014 PHPWord + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/IOFactory.php b/Classes/PHPWord/IOFactory.php index 9dd1c1ad..a9eae570 100755 --- a/Classes/PHPWord/IOFactory.php +++ b/Classes/PHPWord/IOFactory.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Media.php b/Classes/PHPWord/Media.php index b739d365..de913719 100755 --- a/Classes/PHPWord/Media.php +++ b/Classes/PHPWord/Media.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Section.php b/Classes/PHPWord/Section.php index 3bb11c1c..aeea4223 100755 --- a/Classes/PHPWord/Section.php +++ b/Classes/PHPWord/Section.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Section/Footer.php b/Classes/PHPWord/Section/Footer.php index a5de1891..6e5ae8f7 100755 --- a/Classes/PHPWord/Section/Footer.php +++ b/Classes/PHPWord/Section/Footer.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Section/Footer/PreserveText.php b/Classes/PHPWord/Section/Footer/PreserveText.php index a38b1dcc..9ec896c4 100755 --- a/Classes/PHPWord/Section/Footer/PreserveText.php +++ b/Classes/PHPWord/Section/Footer/PreserveText.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Section/Header.php b/Classes/PHPWord/Section/Header.php index 483f887e..cb91e085 100755 --- a/Classes/PHPWord/Section/Header.php +++ b/Classes/PHPWord/Section/Header.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Section/Image.php b/Classes/PHPWord/Section/Image.php index 4dbf8808..f4ad628f 100755 --- a/Classes/PHPWord/Section/Image.php +++ b/Classes/PHPWord/Section/Image.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Section/Link.php b/Classes/PHPWord/Section/Link.php index d3396c7d..42b9d7b3 100755 --- a/Classes/PHPWord/Section/Link.php +++ b/Classes/PHPWord/Section/Link.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Section/ListItem.php b/Classes/PHPWord/Section/ListItem.php index f70f8396..ac5263b3 100755 --- a/Classes/PHPWord/Section/ListItem.php +++ b/Classes/PHPWord/Section/ListItem.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Section/MemoryImage.php b/Classes/PHPWord/Section/MemoryImage.php index d4e8b6ff..9652955c 100755 --- a/Classes/PHPWord/Section/MemoryImage.php +++ b/Classes/PHPWord/Section/MemoryImage.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Section/Object.php b/Classes/PHPWord/Section/Object.php index 30d253dc..acf14e55 100755 --- a/Classes/PHPWord/Section/Object.php +++ b/Classes/PHPWord/Section/Object.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Section/PageBreak.php b/Classes/PHPWord/Section/PageBreak.php index d72c2318..f7be1cc7 100755 --- a/Classes/PHPWord/Section/PageBreak.php +++ b/Classes/PHPWord/Section/PageBreak.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Section/Settings.php b/Classes/PHPWord/Section/Settings.php index e168821c..e638ac6f 100755 --- a/Classes/PHPWord/Section/Settings.php +++ b/Classes/PHPWord/Section/Settings.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Section/Table.php b/Classes/PHPWord/Section/Table.php index 5f3e1ea5..6d68351a 100755 --- a/Classes/PHPWord/Section/Table.php +++ b/Classes/PHPWord/Section/Table.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Section/Table/Cell.php b/Classes/PHPWord/Section/Table/Cell.php index cf6f1dc8..4042ee4e 100755 --- a/Classes/PHPWord/Section/Table/Cell.php +++ b/Classes/PHPWord/Section/Table/Cell.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Section/Text.php b/Classes/PHPWord/Section/Text.php index aa6266e7..2b37e7d4 100755 --- a/Classes/PHPWord/Section/Text.php +++ b/Classes/PHPWord/Section/Text.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Section/TextBreak.php b/Classes/PHPWord/Section/TextBreak.php index cf4ef563..173672ec 100755 --- a/Classes/PHPWord/Section/TextBreak.php +++ b/Classes/PHPWord/Section/TextBreak.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Section/TextRun.php b/Classes/PHPWord/Section/TextRun.php index 2c7a2166..a9104341 100755 --- a/Classes/PHPWord/Section/TextRun.php +++ b/Classes/PHPWord/Section/TextRun.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Section/Title.php b/Classes/PHPWord/Section/Title.php index a1de15cf..8dd5f1c3 100755 --- a/Classes/PHPWord/Section/Title.php +++ b/Classes/PHPWord/Section/Title.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Shared/Drawing.php b/Classes/PHPWord/Shared/Drawing.php index eadf0b19..dba204e3 100755 --- a/Classes/PHPWord/Shared/Drawing.php +++ b/Classes/PHPWord/Shared/Drawing.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Shared/File.php b/Classes/PHPWord/Shared/File.php index f09b3849..7c1470fe 100755 --- a/Classes/PHPWord/Shared/File.php +++ b/Classes/PHPWord/Shared/File.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Shared/Font.php b/Classes/PHPWord/Shared/Font.php index 28b6c2e5..be3cf1a8 100755 --- a/Classes/PHPWord/Shared/Font.php +++ b/Classes/PHPWord/Shared/Font.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Shared/String.php b/Classes/PHPWord/Shared/String.php index ca331642..f570e6b7 100755 --- a/Classes/PHPWord/Shared/String.php +++ b/Classes/PHPWord/Shared/String.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Shared/XMLWriter.php b/Classes/PHPWord/Shared/XMLWriter.php index a8e8377e..2795083e 100755 --- a/Classes/PHPWord/Shared/XMLWriter.php +++ b/Classes/PHPWord/Shared/XMLWriter.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Shared/ZipStreamWrapper.php b/Classes/PHPWord/Shared/ZipStreamWrapper.php index 57f06fca..0dc42875 100755 --- a/Classes/PHPWord/Shared/ZipStreamWrapper.php +++ b/Classes/PHPWord/Shared/ZipStreamWrapper.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Style.php b/Classes/PHPWord/Style.php index 7255e557..7b20f8ab 100755 --- a/Classes/PHPWord/Style.php +++ b/Classes/PHPWord/Style.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Style/Cell.php b/Classes/PHPWord/Style/Cell.php index 8bc224a9..e7d2bf91 100755 --- a/Classes/PHPWord/Style/Cell.php +++ b/Classes/PHPWord/Style/Cell.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Style/Font.php b/Classes/PHPWord/Style/Font.php index eafc10b7..e273dd35 100755 --- a/Classes/PHPWord/Style/Font.php +++ b/Classes/PHPWord/Style/Font.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Style/Image.php b/Classes/PHPWord/Style/Image.php index 422ddfb8..47a71cba 100755 --- a/Classes/PHPWord/Style/Image.php +++ b/Classes/PHPWord/Style/Image.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Style/ListItem.php b/Classes/PHPWord/Style/ListItem.php index 8eb7ffa2..9429b47e 100755 --- a/Classes/PHPWord/Style/ListItem.php +++ b/Classes/PHPWord/Style/ListItem.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Style/Paragraph.php b/Classes/PHPWord/Style/Paragraph.php index ccbbd616..ab285ebe 100755 --- a/Classes/PHPWord/Style/Paragraph.php +++ b/Classes/PHPWord/Style/Paragraph.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Style/TOC.php b/Classes/PHPWord/Style/TOC.php index 41eaefc4..501604b4 100755 --- a/Classes/PHPWord/Style/TOC.php +++ b/Classes/PHPWord/Style/TOC.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Style/Tab.php b/Classes/PHPWord/Style/Tab.php index c35f04cb..a280eebb 100755 --- a/Classes/PHPWord/Style/Tab.php +++ b/Classes/PHPWord/Style/Tab.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Style/Table.php b/Classes/PHPWord/Style/Table.php index c3b49ea3..5f4f60c1 100755 --- a/Classes/PHPWord/Style/Table.php +++ b/Classes/PHPWord/Style/Table.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Style/TableFull.php b/Classes/PHPWord/Style/TableFull.php index b359a592..4e2a7686 100755 --- a/Classes/PHPWord/Style/TableFull.php +++ b/Classes/PHPWord/Style/TableFull.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Style/Tabs.php b/Classes/PHPWord/Style/Tabs.php index c98d472e..ebad8fbb 100755 --- a/Classes/PHPWord/Style/Tabs.php +++ b/Classes/PHPWord/Style/Tabs.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/TOC.php b/Classes/PHPWord/TOC.php index 994ff2c3..1366f0c3 100755 --- a/Classes/PHPWord/TOC.php +++ b/Classes/PHPWord/TOC.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Template.php b/Classes/PHPWord/Template.php index a01a8541..48b2cbb5 100755 --- a/Classes/PHPWord/Template.php +++ b/Classes/PHPWord/Template.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/IWriter.php b/Classes/PHPWord/Writer/IWriter.php index 545c29a8..eb561d1b 100755 --- a/Classes/PHPWord/Writer/IWriter.php +++ b/Classes/PHPWord/Writer/IWriter.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/ODText.php b/Classes/PHPWord/Writer/ODText.php index 19e55f60..3414179d 100755 --- a/Classes/PHPWord/Writer/ODText.php +++ b/Classes/PHPWord/Writer/ODText.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,8 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @copyright Copyright (c) 2014 PHPWord + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/ODText/Content.php b/Classes/PHPWord/Writer/ODText/Content.php index 69ba3bef..d2690aff 100755 --- a/Classes/PHPWord/Writer/ODText/Content.php +++ b/Classes/PHPWord/Writer/ODText/Content.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,8 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @copyright Copyright (c) 2014 PHPWord + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/ODText/Manifest.php b/Classes/PHPWord/Writer/ODText/Manifest.php index 5509073b..f9815941 100755 --- a/Classes/PHPWord/Writer/ODText/Manifest.php +++ b/Classes/PHPWord/Writer/ODText/Manifest.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,8 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @copyright Copyright (c) 2014 PHPWord + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/ODText/Meta.php b/Classes/PHPWord/Writer/ODText/Meta.php index ca6d305c..79624d82 100755 --- a/Classes/PHPWord/Writer/ODText/Meta.php +++ b/Classes/PHPWord/Writer/ODText/Meta.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,8 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @copyright Copyright (c) 2014 PHPWord + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/ODText/Mimetype.php b/Classes/PHPWord/Writer/ODText/Mimetype.php index f6348f48..439ada1a 100755 --- a/Classes/PHPWord/Writer/ODText/Mimetype.php +++ b/Classes/PHPWord/Writer/ODText/Mimetype.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,8 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @copyright Copyright (c) 2014 PHPWord + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/ODText/Styles.php b/Classes/PHPWord/Writer/ODText/Styles.php index 2ec591ae..3c485e55 100755 --- a/Classes/PHPWord/Writer/ODText/Styles.php +++ b/Classes/PHPWord/Writer/ODText/Styles.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,8 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @copyright Copyright (c) 2014 PHPWord + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/ODText/WriterPart.php b/Classes/PHPWord/Writer/ODText/WriterPart.php index 5d95d69c..1e05cd50 100755 --- a/Classes/PHPWord/Writer/ODText/WriterPart.php +++ b/Classes/PHPWord/Writer/ODText/WriterPart.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,8 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @copyright Copyright (c) 2014 PHPWord + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/RTF.php b/Classes/PHPWord/Writer/RTF.php index 24f0157e..ebaa00da 100755 --- a/Classes/PHPWord/Writer/RTF.php +++ b/Classes/PHPWord/Writer/RTF.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,8 +20,8 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord - * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL + * @copyright Copyright (c) 2014 PHPWord + * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/Word2007.php b/Classes/PHPWord/Writer/Word2007.php index 91706ab2..6dfc95d3 100755 --- a/Classes/PHPWord/Writer/Word2007.php +++ b/Classes/PHPWord/Writer/Word2007.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/Word2007/Base.php b/Classes/PHPWord/Writer/Word2007/Base.php index 331625fc..3d464449 100755 --- a/Classes/PHPWord/Writer/Word2007/Base.php +++ b/Classes/PHPWord/Writer/Word2007/Base.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/Word2007/ContentTypes.php b/Classes/PHPWord/Writer/Word2007/ContentTypes.php index 6ec85179..0c8da192 100755 --- a/Classes/PHPWord/Writer/Word2007/ContentTypes.php +++ b/Classes/PHPWord/Writer/Word2007/ContentTypes.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/Word2007/DocProps.php b/Classes/PHPWord/Writer/Word2007/DocProps.php index 2740d8da..be633419 100755 --- a/Classes/PHPWord/Writer/Word2007/DocProps.php +++ b/Classes/PHPWord/Writer/Word2007/DocProps.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/Word2007/Document.php b/Classes/PHPWord/Writer/Word2007/Document.php index 6539dd21..f4308eda 100755 --- a/Classes/PHPWord/Writer/Word2007/Document.php +++ b/Classes/PHPWord/Writer/Word2007/Document.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/Word2007/DocumentRels.php b/Classes/PHPWord/Writer/Word2007/DocumentRels.php index b284f0b9..e5aaffbd 100755 --- a/Classes/PHPWord/Writer/Word2007/DocumentRels.php +++ b/Classes/PHPWord/Writer/Word2007/DocumentRels.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/Word2007/Footer.php b/Classes/PHPWord/Writer/Word2007/Footer.php index 363e0531..1cd49771 100755 --- a/Classes/PHPWord/Writer/Word2007/Footer.php +++ b/Classes/PHPWord/Writer/Word2007/Footer.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/Word2007/Header.php b/Classes/PHPWord/Writer/Word2007/Header.php index 4f4eacd8..4106d197 100755 --- a/Classes/PHPWord/Writer/Word2007/Header.php +++ b/Classes/PHPWord/Writer/Word2007/Header.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/Word2007/Rels.php b/Classes/PHPWord/Writer/Word2007/Rels.php index 6d72839b..97f28d22 100755 --- a/Classes/PHPWord/Writer/Word2007/Rels.php +++ b/Classes/PHPWord/Writer/Word2007/Rels.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/Word2007/Styles.php b/Classes/PHPWord/Writer/Word2007/Styles.php index 71aca637..d2e28539 100755 --- a/Classes/PHPWord/Writer/Word2007/Styles.php +++ b/Classes/PHPWord/Writer/Word2007/Styles.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/Classes/PHPWord/Writer/Word2007/WriterPart.php b/Classes/PHPWord/Writer/Word2007/WriterPart.php index a6168a84..91a863e0 100755 --- a/Classes/PHPWord/Writer/Word2007/WriterPart.php +++ b/Classes/PHPWord/Writer/Word2007/WriterPart.php @@ -2,7 +2,7 @@ /** * PHPWord * - * Copyright (c) 2013 PHPWord + * Copyright (c) 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,7 +20,7 @@ * * @category PHPWord * @package PHPWord - * @copyright Copyright (c) 2013 PHPWord + * @copyright Copyright (c) 2014 PHPWord * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version 0.7.0 */ diff --git a/changelog.txt b/changelog.txt index 4f9c1a98..caeaf601 100755 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,7 @@ ************************************************************************************** * PHPWord * -* Copyright (c) 2011 - 2013 PHPWord +* Copyright (c) 2011 - 2014 PHPWord * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,7 +17,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * -* @copyright Copyright (c) 2011 - 2013 PHPWord (https://github.com/PHPOffice/PHPWord/) +* @copyright Copyright (c) 2011 - 2014 PHPWord (https://github.com/PHPOffice/PHPWord/) * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @version ##VERSION##, ##DATE## ************************************************************************************** diff --git a/composer.json b/composer.json index f080748b..281b8297 100644 --- a/composer.json +++ b/composer.json @@ -22,6 +22,9 @@ "php": ">=5.3.0", "ext-xml": "*" }, + "require-dev": { + "phpunit/phpunit": "3.7.28" + }, "recommend": { "ext-zip": "*", "ext-gd2": "*" From 617feb3240f76f65cacd48d5bb0d8b4bde8f46cc Mon Sep 17 00:00:00 2001 From: Gabriel Bull Date: Wed, 12 Feb 2014 11:48:45 -0500 Subject: [PATCH 04/24] Added section page numbering --- Classes/PHPWord/Section/Settings.php | 26 ++++++++ Classes/PHPWord/Writer/Word2007/Document.php | 26 ++++---- README.md | 59 +++++++++++++------ changelog.txt | 3 + test/PHPWord/Tests/ImageTest.php | 2 +- .../Tests/Section/PageNumberingTest.php | 26 ++++++++ 6 files changed, 113 insertions(+), 29 deletions(-) create mode 100755 test/PHPWord/Tests/Section/PageNumberingTest.php diff --git a/Classes/PHPWord/Section/Settings.php b/Classes/PHPWord/Section/Settings.php index e638ac6f..020a82e3 100755 --- a/Classes/PHPWord/Section/Settings.php +++ b/Classes/PHPWord/Section/Settings.php @@ -150,6 +150,14 @@ class PHPWord_Section_Settings */ private $_borderBottomColor; + + /** + * Page Numbering Start + * + * @var int + */ + private $pageNumberingStart; + /** * Create new Section Settings */ @@ -542,4 +550,22 @@ class PHPWord_Section_Settings { return $this->_borderBottomColor; } + + /** + * @param null|int $pageNumberingStart + * @return $this + */ + public function setPageNumberingStart($pageNumberingStart = null) + { + $this->pageNumberingStart = $pageNumberingStart; + return $this; + } + + /** + * @return null|int + */ + public function getPageNumberingStart() + { + return $this->pageNumberingStart; + } } diff --git a/Classes/PHPWord/Writer/Word2007/Document.php b/Classes/PHPWord/Writer/Word2007/Document.php index f4308eda..20d3d5ca 100755 --- a/Classes/PHPWord/Writer/Word2007/Document.php +++ b/Classes/PHPWord/Writer/Word2007/Document.php @@ -123,19 +123,19 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base private function _writeEndSection(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section $section) { - $_settings = $section->getSettings(); + $settings = $section->getSettings(); $_headers = $section->getHeaders(); $_footer = $section->getFooter(); - $pgSzW = $_settings->getPageSizeW(); - $pgSzH = $_settings->getPageSizeH(); - $orientation = $_settings->getOrientation(); + $pgSzW = $settings->getPageSizeW(); + $pgSzH = $settings->getPageSizeH(); + $orientation = $settings->getOrientation(); - $marginTop = $_settings->getMarginTop(); - $marginLeft = $_settings->getMarginLeft(); - $marginRight = $_settings->getMarginRight(); - $marginBottom = $_settings->getMarginBottom(); + $marginTop = $settings->getMarginTop(); + $marginLeft = $settings->getMarginLeft(); + $marginRight = $settings->getMarginRight(); + $marginBottom = $settings->getMarginBottom(); - $borders = $_settings->getBorderSize(); + $borders = $settings->getBorderSize(); $objWriter->startElement('w:sectPr'); @@ -182,7 +182,7 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base if (!is_null($borders[0]) || !is_null($borders[1]) || !is_null($borders[2]) || !is_null($borders[3])) { - $borderColor = $_settings->getBorderColor(); + $borderColor = $settings->getBorderColor(); $objWriter->startElement('w:pgBorders'); $objWriter->writeAttribute('w:offsetFrom', 'page'); @@ -225,6 +225,12 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base $objWriter->endElement(); } + // Page numbering + if (null !== $settings->getPageNumberingStart()) { + $objWriter->startElement('w:pgNumType'); + $objWriter->writeAttribute('w:start', $section->getSettings()->getPageNumberingStart()); + $objWriter->endElement(); + } $objWriter->startElement('w:cols'); $objWriter->writeAttribute('w:space', '720'); diff --git a/README.md b/README.md index 21c15959..8fc7881d 100755 --- a/README.md +++ b/README.md @@ -1,19 +1,18 @@ -# PHPWord - OpenXML - Read, Write and Create Word documents in PHP +# PHPWord + +__OpenXML - Read, Write and Create Word documents in PHP.__ + +PHPWord is a library written in PHP that create word documents. -PHPWord is a library written in PHP that create word documents. No Windows operating system is needed for usage because the result are docx files (Office Open XML) that can be opened by all major office software. -## Want to contribute? -Fork us! +__Want to contribute?__ Fork us! ## Requirements * PHP version 5.3.0 or higher -## License -PHPWord is licensed under [LGPL (GNU LESSER GENERAL PUBLIC LICENSE)](https://github.com/PHPOffice/PHPWord/blob/master/license.md) - ## Installation It is recommended that you install the PHPWord library [through composer](http://getcomposer.org/). To do so, add @@ -27,7 +26,17 @@ the following lines to your ``composer.json``. } ``` -## Usage +## Documentation + +### Table of contents + +1. [Basic usage](#basic-usage) +2. [Sections](#sections) + * [Change Section Page Numbering](#sections-page-numbering) +3. [Images](#images) + + +#### Basic usage The following is a basic example of the PHPWord library. @@ -59,7 +68,21 @@ $objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007'); $objWriter->save('helloWorld.docx'); ``` -## Images + +#### Sections + + +##### Change Section Page Numbering + +You can change a section page numbering. + +```php +$section = $PHPWord->createSection(); +$section->getSettings()->setPageNumberingStart(1); +``` + + +#### Images You can add images easily using the following example. @@ -69,16 +92,16 @@ $section->addImage('mars.jpg'); ``` Images settings include: - * ``width`` width in pixels - * ``height`` height in pixels - * ``align`` image alignment, __left__, __right__ or __center__ - * ``marginTop`` top margin in inches, can be negative - * ``marginLeft`` left margin in inches, can be negative - * ``wrappingStyle`` can be inline, __square__, __tight__, __behind__, __infront__ +* ``width`` width in pixels +* ``height`` height in pixels +* ``align`` image alignment, _left_, _right_ or _center_ +* ``marginTop`` top margin in inches, can be negative +* ``marginLeft`` left margin in inches, can be negative +* ``wrappingStyle`` can be _inline_, _square_, _tight_, _behind_, _infront_ - To add an image with settings, consider the following example. +To add an image with settings, consider the following example. - ```php +```php $section->addImage( 'mars.jpg', array( @@ -86,7 +109,7 @@ $section->addImage( 'height' => 100, 'marginTop' => -1, 'marginLeft' => -1, - wrappingStyle => 'behind' + 'wrappingStyle' => 'behind' ) ); ``` diff --git a/changelog.txt b/changelog.txt index caeaf601..94eb1657 100755 --- a/changelog.txt +++ b/changelog.txt @@ -22,6 +22,9 @@ * @version ##VERSION##, ##DATE## ************************************************************************************** +Changes in branch for release 0.7.1 : +- Feature: (gabrielbull) - Word2007 : Support sections page numbering + Fixed in branch for release 0.7.0 : - Bugfix: (RomanSyroeshko) GH-32 - "Warning: Invalid error type specified in ...\PHPWord.php on line 226" is thrown when the specified template file is not found - Bugfix: (RomanSyroeshko) GH-34 - PHPWord_Shared_String.IsUTF8 returns FALSE for Cyrillic UTF-8 input diff --git a/test/PHPWord/Tests/ImageTest.php b/test/PHPWord/Tests/ImageTest.php index 81b24677..710af5ad 100755 --- a/test/PHPWord/Tests/ImageTest.php +++ b/test/PHPWord/Tests/ImageTest.php @@ -14,7 +14,7 @@ class ImageTest extends PHPUnit_Framework_TestCase public function testImageWrappingStyleBehind() { $PHPWord = new PHPWord(); - $section = $PHPWord->createSection(12240, 15840, 0, 0, 0, 0); + $section = $PHPWord->createSection(); $section->addImage( __DIR__ . '/_files/images/earth.jpg', diff --git a/test/PHPWord/Tests/Section/PageNumberingTest.php b/test/PHPWord/Tests/Section/PageNumberingTest.php new file mode 100755 index 00000000..2223973e --- /dev/null +++ b/test/PHPWord/Tests/Section/PageNumberingTest.php @@ -0,0 +1,26 @@ +createSection(); + $section->getSettings()->setPageNumberingStart(2); + + $doc = TestHelper::getDocument($PHPWord); + $element = $doc->getElement('/w:document/w:body/w:sectPr/w:pgNumType'); + + $this->assertEquals(2, $element->getAttribute('w:start')); + } +} \ No newline at end of file From 334422d04eeea1950e8d613973e6ebbf77eccc38 Mon Sep 17 00:00:00 2001 From: Gabriel Bull Date: Wed, 12 Feb 2014 12:47:16 -0500 Subject: [PATCH 05/24] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 8fc7881d..b9dfb003 100755 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # PHPWord +[![Build Status](https://travis-ci.org/PHPOffice/PHPWord.png?branch=master)](https://travis-ci.org/PHPOffice/PHPWord) + __OpenXML - Read, Write and Create Word documents in PHP.__ PHPWord is a library written in PHP that create word documents. From f76a9cdbede05141dbe546d484d55742cd338284 Mon Sep 17 00:00:00 2001 From: Gabriel Bull Date: Wed, 12 Feb 2014 13:28:35 -0500 Subject: [PATCH 06/24] Added text align test --- .../Tests/Section/PageNumberingTest.php | 2 +- test/PHPWord/Tests/Text/AlignTest.php | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 test/PHPWord/Tests/Text/AlignTest.php diff --git a/test/PHPWord/Tests/Section/PageNumberingTest.php b/test/PHPWord/Tests/Section/PageNumberingTest.php index 2223973e..1d314b6c 100755 --- a/test/PHPWord/Tests/Section/PageNumberingTest.php +++ b/test/PHPWord/Tests/Section/PageNumberingTest.php @@ -12,7 +12,7 @@ class PageNumberingTest extends PHPUnit_Framework_TestCase TestHelper::clear(); } - public function testImageWrappingStyleBehind() + public function testSectionPageNumbering() { $PHPWord = new PHPWord(); $section = $PHPWord->createSection(); diff --git a/test/PHPWord/Tests/Text/AlignTest.php b/test/PHPWord/Tests/Text/AlignTest.php new file mode 100644 index 00000000..4be62465 --- /dev/null +++ b/test/PHPWord/Tests/Text/AlignTest.php @@ -0,0 +1,27 @@ +createSection(); + + $section->addText('This is my text', null, array('align' => 'right')); + + $doc = TestHelper::getDocument($PHPWord); + $element = $doc->getElement('/w:document/w:body/w:p/w:pPr/w:jc'); + + $this->assertEquals('right', $element->getAttribute('w:val')); + } +} \ No newline at end of file From 7ea686f6983fc3f0c0f6cc06744d9be84a05a353 Mon Sep 17 00:00:00 2001 From: Gabriel Bull Date: Thu, 13 Feb 2014 10:51:13 -0500 Subject: [PATCH 07/24] Fixed bug with table cell styles and added grid span unit tests --- Classes/PHPWord/Section/Table/Cell.php | 3 +- README.md | 27 ++++++++++++- changelog.txt | 1 + test/PHPWord/Tests/Table/CellGridSpanTest.php | 38 +++++++++++++++++++ 4 files changed, 66 insertions(+), 3 deletions(-) create mode 100644 test/PHPWord/Tests/Table/CellGridSpanTest.php diff --git a/Classes/PHPWord/Section/Table/Cell.php b/Classes/PHPWord/Section/Table/Cell.php index 4042ee4e..b4bc8242 100755 --- a/Classes/PHPWord/Section/Table/Cell.php +++ b/Classes/PHPWord/Section/Table/Cell.php @@ -80,11 +80,10 @@ class PHPWord_Section_Table_Cell $this->_insideOf = $insideOf; $this->_pCount = $pCount; $this->_width = $width; + $this->_style = new PHPWord_Style_Cell; if (!is_null($style)) { if (is_array($style)) { - $this->_style = new PHPWord_Style_Cell(); - foreach ($style as $key => $value) { if (substr($key, 0, 1) != '_') { $key = '_' . $key; diff --git a/README.md b/README.md index b9dfb003..d28be355 100755 --- a/README.md +++ b/README.md @@ -35,7 +35,9 @@ the following lines to your ``composer.json``. 1. [Basic usage](#basic-usage) 2. [Sections](#sections) * [Change Section Page Numbering](#sections-page-numbering) -3. [Images](#images) +3. [Tables](#tables) + * [Cell Style](#tables-cell-style) +4. [Images](#images) #### Basic usage @@ -83,6 +85,29 @@ $section = $PHPWord->createSection(); $section->getSettings()->setPageNumberingStart(1); ``` + +#### Tables + +The following illustrates how to create a table. + +```php +$table = $section->addTable(); +$table->addRow(); +$table->addCell(); +``` + + +##### Cell Style + +###### Cell Span + +You can span a cell on multiple columms. + +```php +$cell = $table->addCell(200); +$cell->getStyle()->setGridSpan(5); +``` + #### Images diff --git a/changelog.txt b/changelog.txt index 94eb1657..b32fd11f 100755 --- a/changelog.txt +++ b/changelog.txt @@ -24,6 +24,7 @@ Changes in branch for release 0.7.1 : - Feature: (gabrielbull) - Word2007 : Support sections page numbering +- Bugfix: (gabrielbull) - Fixed bug with cell styling Fixed in branch for release 0.7.0 : - Bugfix: (RomanSyroeshko) GH-32 - "Warning: Invalid error type specified in ...\PHPWord.php on line 226" is thrown when the specified template file is not found diff --git a/test/PHPWord/Tests/Table/CellGridSpanTest.php b/test/PHPWord/Tests/Table/CellGridSpanTest.php new file mode 100644 index 00000000..061f889f --- /dev/null +++ b/test/PHPWord/Tests/Table/CellGridSpanTest.php @@ -0,0 +1,38 @@ +createSection(); + + $table = $section->addTable(); + + $table->addRow(); + $cell = $table->addCell(200); + $cell->getStyle()->setGridSpan(5); + + $table->addRow(); + $table->addCell(40); + $table->addCell(40); + $table->addCell(40); + $table->addCell(40); + $table->addCell(40); + + $doc = TestHelper::getDocument($PHPWord); + $element = $doc->getElement('/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:gridSpan'); + + $this->assertEquals(5, $element->getAttribute('w:val')); + } +} \ No newline at end of file From 6697b721854c77b4a451dde987c7a493c1b35c8f Mon Sep 17 00:00:00 2001 From: Gabriel Bull Date: Thu, 13 Feb 2014 12:24:11 -0500 Subject: [PATCH 08/24] Fixed bug list items inside of cells --- Classes/PHPWord/Writer/Word2007/Document.php | 2 +- changelog.txt | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Classes/PHPWord/Writer/Word2007/Document.php b/Classes/PHPWord/Writer/Word2007/Document.php index 20d3d5ca..41718f6e 100755 --- a/Classes/PHPWord/Writer/Word2007/Document.php +++ b/Classes/PHPWord/Writer/Word2007/Document.php @@ -251,7 +251,7 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base $objWriter->endElement(); } - private function _writeListItem(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_ListItem $listItem) + public function _writeListItem(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_ListItem $listItem) { $textObject = $listItem->getTextObject(); $text = $textObject->getText(); diff --git a/changelog.txt b/changelog.txt index b32fd11f..90599cd2 100755 --- a/changelog.txt +++ b/changelog.txt @@ -25,6 +25,7 @@ Changes in branch for release 0.7.1 : - Feature: (gabrielbull) - Word2007 : Support sections page numbering - Bugfix: (gabrielbull) - Fixed bug with cell styling +- Bugfix: (gabrielbull) - Fixed bug list items inside of cells Fixed in branch for release 0.7.0 : - Bugfix: (RomanSyroeshko) GH-32 - "Warning: Invalid error type specified in ...\PHPWord.php on line 226" is thrown when the specified template file is not found From 075ca157d750430972dd69ce9d10137c11b9e4b9 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 24 Feb 2014 19:17:06 +0100 Subject: [PATCH 09/24] ADDED : Basic unit tests --- .travis.yml | 4 +- .../PHPWord}/AutoloaderTest.php | 6 ++ Tests/PHPWord/IOFactoryTest.php | 59 ++++++++++++++++++ Tests/PHPWord/MediaTest.php | 29 +++++++++ Tests/PHPWord/SectionTest.php | 38 +++++++++++ Tests/PHPWord/Writer/Word2007/BaseTest.php | 45 +++++++++++++ .../Tests => Tests}/_files/images/earth.jpg | Bin .../Tests => Tests}/_files/images/mars.jpg | Bin .../_inc/TestHelperDOCX.php | 29 ++++++--- Tests/bootstrap.php | 14 +++++ phpunit.xml.dist => Tests/phpunit.xml.dist | 11 +++- test/PHPWord/Tests/ImageTest.php | 36 ----------- test/bootstrap.php | 8 --- 13 files changed, 222 insertions(+), 57 deletions(-) rename {test/PHPWord/Tests => Tests/PHPWord}/AutoloaderTest.php (72%) create mode 100644 Tests/PHPWord/IOFactoryTest.php create mode 100644 Tests/PHPWord/MediaTest.php create mode 100644 Tests/PHPWord/SectionTest.php create mode 100644 Tests/PHPWord/Writer/Word2007/BaseTest.php rename {test/PHPWord/Tests => Tests}/_files/images/earth.jpg (100%) rename {test/PHPWord/Tests => Tests}/_files/images/mars.jpg (100%) rename test/PHPWord/TestHelper.php => Tests/_inc/TestHelperDOCX.php (73%) create mode 100755 Tests/bootstrap.php rename phpunit.xml.dist => Tests/phpunit.xml.dist (58%) delete mode 100755 test/PHPWord/Tests/ImageTest.php delete mode 100755 test/bootstrap.php diff --git a/.travis.yml b/.travis.yml index 155a28e6..fcb6d94e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,9 +36,11 @@ script: ## PHP Copy/Paste Detector - php phpcpd.phar --verbose Classes/ ## PHP Mess Detector - - phpmd Classes/ text codesize,unusedcode,naming,design + - phpmd Classes/ text unusedcode,naming,design ## PHPLOC - php phploc.phar Classes/ + ## PHPUnit + - phpunit -c ./Tests/ --coverage-text notifications: email: diff --git a/test/PHPWord/Tests/AutoloaderTest.php b/Tests/PHPWord/AutoloaderTest.php similarity index 72% rename from test/PHPWord/Tests/AutoloaderTest.php rename to Tests/PHPWord/AutoloaderTest.php index cdfcf68e..33872466 100644 --- a/test/PHPWord/Tests/AutoloaderTest.php +++ b/Tests/PHPWord/AutoloaderTest.php @@ -6,6 +6,12 @@ use PHPWord_Autoloader; class AutoloaderTest extends PHPUnit_Framework_TestCase { + public function testRegister() + { + PHPWord_Autoloader::register(); + $this->assertContains(array('PHPWord_Autoloader', 'load'), spl_autoload_functions()); + } + public function testAutoload() { $this->assertNull(PHPWord_Autoloader::load('Foo'), 'PHPWord_Autoloader::load() is trying to load classes outside of the PHPWord namespace'); diff --git a/Tests/PHPWord/IOFactoryTest.php b/Tests/PHPWord/IOFactoryTest.php new file mode 100644 index 00000000..f6f0aba8 --- /dev/null +++ b/Tests/PHPWord/IOFactoryTest.php @@ -0,0 +1,59 @@ +assertAttributeEquals(PHPWord_IOFactory::getSearchLocations(), '_searchLocations','PHPWord_IOFactory'); + } + + public function testSetSearchLocationsWithArray() + { + PHPWord_IOFactory::setSearchLocations(array()); + $this->assertAttributeEquals(array(), '_searchLocations','PHPWord_IOFactory'); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage Invalid parameter passed. + */ + public function testSetSearchLocationsWithNotArray() + { + PHPWord_IOFactory::setSearchLocations('String'); + } + + public function testAddSearchLocation() + { + PHPWord_IOFactory::setSearchLocations(array()); + PHPWord_IOFactory::addSearchLocation('type', 'location', 'classname'); + $this->assertAttributeEquals(array(array('type' => 'type', 'path' => 'location', 'class' => 'classname')), '_searchLocations','PHPWord_IOFactory'); + } + + /** + * @expectedException Exception + * @expectedExceptionMessage No IWriter found for type + */ + public function testCreateWriterException(){ + $oPHPWord = new PHPWord(); + + PHPWord_IOFactory::setSearchLocations(array()); + PHPWord_IOFactory::createWriter($oPHPWord); + } + + public function testCreateWriter(){ + $oPHPWord = new PHPWord(); + + $this->assertEquals(PHPWord_IOFactory::createWriter($oPHPWord, 'Word2007'), new PHPWord_Writer_Word2007($oPHPWord)); + } +} + \ No newline at end of file diff --git a/Tests/PHPWord/MediaTest.php b/Tests/PHPWord/MediaTest.php new file mode 100644 index 00000000..40460dea --- /dev/null +++ b/Tests/PHPWord/MediaTest.php @@ -0,0 +1,29 @@ +assertEquals(PHPWord_Media::getSectionMediaElements(), array()); + } + + public function testCountSectionMediaElementsWithNull() + { + $this->assertEquals(PHPWord_Media::countSectionMediaElements(), 0); + } + + public function testGetHeaderMediaElements() + { + $this->assertAttributeEquals(PHPWord_Media::getHeaderMediaElements(), '_headerMedia','PHPWord_Media'); + } + + public function testGetFooterMediaElements() + { + $this->assertAttributeEquals(PHPWord_Media::getFooterMediaElements(), '_footerMedia','PHPWord_Media'); + } +} + \ No newline at end of file diff --git a/Tests/PHPWord/SectionTest.php b/Tests/PHPWord/SectionTest.php new file mode 100644 index 00000000..0e90961d --- /dev/null +++ b/Tests/PHPWord/SectionTest.php @@ -0,0 +1,38 @@ +assertAttributeEquals($oSection->getSettings(), '_settings', new PHPWord_Section(0)); + } + + public function testGetElementss() + { + $oSection = new PHPWord_Section(0); + $this->assertAttributeEquals($oSection->getElements(), '_elementCollection',new PHPWord_Section(0)); + } + + public function testGetFooter() + { + $oSection = new PHPWord_Section(0); + $this->assertAttributeEquals($oSection->getFooter(), '_footer',new PHPWord_Section(0)); + } + + public function testGetHeaders() + { + $oSection = new PHPWord_Section(0); + $this->assertAttributeEquals($oSection->getHeaders(), '_headers',new PHPWord_Section(0)); + } + + public function testGetElements() + { + $oSection = new PHPWord_Section(0); + $this->assertAttributeEquals($oSection->getElements(), '_elementCollection',new PHPWord_Section(0)); + } +} + \ No newline at end of file diff --git a/Tests/PHPWord/Writer/Word2007/BaseTest.php b/Tests/PHPWord/Writer/Word2007/BaseTest.php new file mode 100644 index 00000000..3627bdd5 --- /dev/null +++ b/Tests/PHPWord/Writer/Word2007/BaseTest.php @@ -0,0 +1,45 @@ +createSection(); + $section->addImage( + PHPWORD_TESTS_DIR_ROOT . '/_files/images/earth.jpg', + array( + 'marginTop' => -1, + 'marginLeft' => -1, + 'wrappingStyle' => 'behind' + ) + ); + + $doc = TestHelperDOCX::getDocument($PHPWord); + $element = $doc->getElement('/w:document/w:body/w:p/w:r/w:pict/v:shape'); + + $style = $element->getAttribute('style'); + + $this->assertRegExp('/z\-index:\-[0-9]*/', $style); + $this->assertRegExp('/position:absolute;/', $style); + } +} + \ No newline at end of file diff --git a/test/PHPWord/Tests/_files/images/earth.jpg b/Tests/_files/images/earth.jpg similarity index 100% rename from test/PHPWord/Tests/_files/images/earth.jpg rename to Tests/_files/images/earth.jpg diff --git a/test/PHPWord/Tests/_files/images/mars.jpg b/Tests/_files/images/mars.jpg similarity index 100% rename from test/PHPWord/Tests/_files/images/mars.jpg rename to Tests/_files/images/mars.jpg diff --git a/test/PHPWord/TestHelper.php b/Tests/_inc/TestHelperDOCX.php similarity index 73% rename from test/PHPWord/TestHelper.php rename to Tests/_inc/TestHelperDOCX.php index db626428..32f1af08 100644 --- a/test/PHPWord/TestHelper.php +++ b/Tests/_inc/TestHelperDOCX.php @@ -4,31 +4,42 @@ namespace PHPWord\Tests; use PHPWord; use DOMDocument; -class TestHelper +class TestHelperDOCX { + static protected $file; + /** * @param \PHPWord $PHPWord - * @return \PHPWord\Tests\Doc + * @return \PHPWord\Tests\Xml_Document */ public static function getDocument(PHPWord $PHPWord) { + self::$file = tempnam(sys_get_temp_dir(), 'PHPWord'); + if(!is_dir(sys_get_temp_dir().'/PHPWord_Unit_Test/')){ + mkdir(sys_get_temp_dir().'/PHPWord_Unit_Test/'); + } + $objWriter = \PHPWord_IOFactory::createWriter($PHPWord, 'Word2007'); - $objWriter->save(__DIR__ . '/Tests/_files/test.docx'); + $objWriter->save(self::$file); $zip = new \ZipArchive; - $res = $zip->open(__DIR__ . '/Tests/_files/test.docx'); + $res = $zip->open(self::$file); if ($res === true) { - $zip->extractTo(__DIR__ . '/Tests/_files/test/'); + $zip->extractTo(sys_get_temp_dir().'/PHPWord_Unit_Test/'); $zip->close(); } - return new Doc(__DIR__ . '/Tests/_files/test/'); + return new Xml_Document(sys_get_temp_dir().'/PHPWord_Unit_Test/'); } public static function clear() { - unlink(__DIR__ . '/Tests/_files/test.docx'); - self::deleteDir(__DIR__ . '/Tests/_files/test/'); + if(file_exists(self::$file)){ + unlink(self::$file); + } + if(is_dir(sys_get_temp_dir().'/PHPWord_Unit_Test/')){ + self::deleteDir(sys_get_temp_dir().'/PHPWord_Unit_Test/'); + } } /** @@ -50,7 +61,7 @@ class TestHelper } } -class Doc +class Xml_Document { /** @var string $path */ private $path; diff --git a/Tests/bootstrap.php b/Tests/bootstrap.php new file mode 100755 index 00000000..554dc38f --- /dev/null +++ b/Tests/bootstrap.php @@ -0,0 +1,14 @@ + - - ./test/PHPWord/ + + ./PHPWord/ + + + ../Classes + + \ No newline at end of file diff --git a/test/PHPWord/Tests/ImageTest.php b/test/PHPWord/Tests/ImageTest.php deleted file mode 100755 index 81b24677..00000000 --- a/test/PHPWord/Tests/ImageTest.php +++ /dev/null @@ -1,36 +0,0 @@ -createSection(12240, 15840, 0, 0, 0, 0); - - $section->addImage( - __DIR__ . '/_files/images/earth.jpg', - array( - 'marginTop' => -1, - 'marginLeft' => -1, - 'wrappingStyle' => 'behind' - ) - ); - - $doc = TestHelper::getDocument($PHPWord); - $element = $doc->getElement('/w:document/w:body/w:p/w:r/w:pict/v:shape'); - - $style = $element->getAttribute('style'); - - $this->assertRegExp('/z\-index:\-[0-9]*/', $style); - $this->assertRegExp('/position:absolute;/', $style); - } -} \ No newline at end of file diff --git a/test/bootstrap.php b/test/bootstrap.php deleted file mode 100755 index b03b68ce..00000000 --- a/test/bootstrap.php +++ /dev/null @@ -1,8 +0,0 @@ - Date: Mon, 24 Feb 2014 19:38:44 +0100 Subject: [PATCH 10/24] ADDED : Basic unit tests --- Tests/PHPWord/Writer/Word2007/BaseTest.php | 37 +++++++++++ .../PHPWord/Writer/Word2007/DocumentTest.php | 61 +++---------------- changelog.txt | 1 + 3 files changed, 45 insertions(+), 54 deletions(-) diff --git a/Tests/PHPWord/Writer/Word2007/BaseTest.php b/Tests/PHPWord/Writer/Word2007/BaseTest.php index 3627bdd5..8788af8b 100644 --- a/Tests/PHPWord/Writer/Word2007/BaseTest.php +++ b/Tests/PHPWord/Writer/Word2007/BaseTest.php @@ -41,5 +41,42 @@ class PHPWord_Writer_Word2007_BaseTest extends \PHPUnit_Framework_TestCase { $this->assertRegExp('/z\-index:\-[0-9]*/', $style); $this->assertRegExp('/position:absolute;/', $style); } + + public function testWriteParagraphStyle_Align() + { + $PHPWord = new PHPWord(); + $section = $PHPWord->createSection(); + + $section->addText('This is my text', null, array('align' => 'right')); + + $doc = TestHelperDOCX::getDocument($PHPWord); + $element = $doc->getElement('/w:document/w:body/w:p/w:pPr/w:jc'); + + $this->assertEquals('right', $element->getAttribute('w:val')); + } + + public function testWriteCellStyle_CellGridSpan() + { + $PHPWord = new PHPWord(); + $section = $PHPWord->createSection(); + + $table = $section->addTable(); + + $table->addRow(); + $cell = $table->addCell(200); + $cell->getStyle()->setGridSpan(5); + + $table->addRow(); + $table->addCell(40); + $table->addCell(40); + $table->addCell(40); + $table->addCell(40); + $table->addCell(40); + + $doc = TestHelperDOCX::getDocument($PHPWord); + $element = $doc->getElement('/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:gridSpan'); + + $this->assertEquals(5, $element->getAttribute('w:val')); + } } \ No newline at end of file diff --git a/Tests/PHPWord/Writer/Word2007/DocumentTest.php b/Tests/PHPWord/Writer/Word2007/DocumentTest.php index 8788af8b..13d233cc 100644 --- a/Tests/PHPWord/Writer/Word2007/DocumentTest.php +++ b/Tests/PHPWord/Writer/Word2007/DocumentTest.php @@ -4,14 +4,14 @@ namespace PHPWord\Tests; use PHPUnit_Framework_TestCase; use PHPWord; use PHPWord_Writer_Word2007; -use PHPWord_Writer_Word2007_Base; +use PHPWord_Writer_Word2007_Document; /** - * Class PHPWord_Writer_Word2007_BaseTest + * Class PHPWord_Writer_Word2007_DocumentTest * @package PHPWord\Tests * @runTestsInSeparateProcesses */ -class PHPWord_Writer_Word2007_BaseTest extends \PHPUnit_Framework_TestCase { +class PHPWord_Writer_Word2007_DocumentTest extends \PHPUnit_Framework_TestCase { /** * Executed before each method of the class */ @@ -20,63 +20,16 @@ class PHPWord_Writer_Word2007_BaseTest extends \PHPUnit_Framework_TestCase { TestHelperDOCX::clear(); } - public function testWriteImage_Position() + public function testWriteEndSection_PageNumbering() { $PHPWord = new PHPWord(); $section = $PHPWord->createSection(); - $section->addImage( - PHPWORD_TESTS_DIR_ROOT . '/_files/images/earth.jpg', - array( - 'marginTop' => -1, - 'marginLeft' => -1, - 'wrappingStyle' => 'behind' - ) - ); + $section->getSettings()->setPageNumberingStart(2); $doc = TestHelperDOCX::getDocument($PHPWord); - $element = $doc->getElement('/w:document/w:body/w:p/w:r/w:pict/v:shape'); + $element = $doc->getElement('/w:document/w:body/w:sectPr/w:pgNumType'); - $style = $element->getAttribute('style'); - - $this->assertRegExp('/z\-index:\-[0-9]*/', $style); - $this->assertRegExp('/position:absolute;/', $style); + $this->assertEquals(2, $element->getAttribute('w:start')); } - - public function testWriteParagraphStyle_Align() - { - $PHPWord = new PHPWord(); - $section = $PHPWord->createSection(); - - $section->addText('This is my text', null, array('align' => 'right')); - - $doc = TestHelperDOCX::getDocument($PHPWord); - $element = $doc->getElement('/w:document/w:body/w:p/w:pPr/w:jc'); - - $this->assertEquals('right', $element->getAttribute('w:val')); - } - - public function testWriteCellStyle_CellGridSpan() - { - $PHPWord = new PHPWord(); - $section = $PHPWord->createSection(); - - $table = $section->addTable(); - - $table->addRow(); - $cell = $table->addCell(200); - $cell->getStyle()->setGridSpan(5); - - $table->addRow(); - $table->addCell(40); - $table->addCell(40); - $table->addCell(40); - $table->addCell(40); - $table->addCell(40); - - $doc = TestHelperDOCX::getDocument($PHPWord); - $element = $doc->getElement('/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:gridSpan'); - - $this->assertEquals(5, $element->getAttribute('w:val')); - } } \ No newline at end of file diff --git a/changelog.txt b/changelog.txt index 90599cd2..baa696ce 100755 --- a/changelog.txt +++ b/changelog.txt @@ -23,6 +23,7 @@ ************************************************************************************** Changes in branch for release 0.7.1 : +- QA: (Progi1984) - UnitTests - Feature: (gabrielbull) - Word2007 : Support sections page numbering - Bugfix: (gabrielbull) - Fixed bug with cell styling - Bugfix: (gabrielbull) - Fixed bug list items inside of cells From 2018262f86685ee1f072668bbc080e77b9058ef6 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 24 Feb 2014 19:43:20 +0100 Subject: [PATCH 11/24] FIXED : Error on Travis-CI with Composer on PHP 5.3.3 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index fcb6d94e..7fdb729d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,7 +13,7 @@ matrix: before_script: ## Composer - curl -s http://getcomposer.org/installer | php - - php composer.phar install + - php composer.phar install --prefer-source ## PHP_CodeSniffer - pyrus install pear/PHP_CodeSniffer - phpenv rehash From ff342cff6ff70f1206607480782f9974b7fb048c Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 24 Feb 2014 20:11:02 +0100 Subject: [PATCH 12/24] FIXED : Error on Travis-CI with Pyrus on PHP 5.3.3 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index 7fdb729d..cc04de75 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ before_script: - curl -s http://getcomposer.org/installer | php - php composer.phar install --prefer-source ## PHP_CodeSniffer + - php pyrus.phar . set bin_dir ./bin - pyrus install pear/PHP_CodeSniffer - phpenv rehash ## PHP Copy/Paste Detector From 49e01cc6018631f3a1cdb71b125164b74b991ac2 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 24 Feb 2014 22:11:45 +0100 Subject: [PATCH 13/24] FIXED : Error on Travis-CI with Pyrus on PHP 5.3.3 --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index cc04de75..c524df3c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,5 @@ language: php php: - - 5.3.3 - 5.3 - 5.4 - 5.5 @@ -15,7 +14,6 @@ before_script: - curl -s http://getcomposer.org/installer | php - php composer.phar install --prefer-source ## PHP_CodeSniffer - - php pyrus.phar . set bin_dir ./bin - pyrus install pear/PHP_CodeSniffer - phpenv rehash ## PHP Copy/Paste Detector From 21739b11b9aecda10ff71d504dd8c97c3354065c Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 25 Feb 2014 13:07:30 +0100 Subject: [PATCH 14/24] IMPROVED : Order in changes --- changelog.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index baa696ce..dd952cae 100755 --- a/changelog.txt +++ b/changelog.txt @@ -23,10 +23,10 @@ ************************************************************************************** Changes in branch for release 0.7.1 : -- QA: (Progi1984) - UnitTests -- Feature: (gabrielbull) - Word2007 : Support sections page numbering - Bugfix: (gabrielbull) - Fixed bug with cell styling - Bugfix: (gabrielbull) - Fixed bug list items inside of cells +- Feature: (gabrielbull) - Word2007 : Support sections page numbering +- QA: (Progi1984) - UnitTests Fixed in branch for release 0.7.0 : - Bugfix: (RomanSyroeshko) GH-32 - "Warning: Invalid error type specified in ...\PHPWord.php on line 226" is thrown when the specified template file is not found From c5acf36b27a3727973f1a3eb1de867148808d980 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Tue, 25 Feb 2014 13:33:18 +0100 Subject: [PATCH 15/24] ADDED : Icons for packagist --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d28be355..dc1a611a 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # PHPWord [![Build Status](https://travis-ci.org/PHPOffice/PHPWord.png?branch=master)](https://travis-ci.org/PHPOffice/PHPWord) +[![Latest Stable Version](https://poser.pugx.org/phpoffice/phpword/v/stable.png)](https://packagist.org/packages/phpoffice/phpword) [![Total Downloads](https://poser.pugx.org/phpoffice/phpword/downloads.png)](https://packagist.org/packages/phpoffice/phpword) [![Latest Unstable Version](https://poser.pugx.org/phpoffice/phpword/v/unstable.png)](https://packagist.org/packages/phpoffice/phpword) [![License](https://poser.pugx.org/phpoffice/phpword/license.png)](https://packagist.org/packages/phpoffice/phpword) __OpenXML - Read, Write and Create Word documents in PHP.__ From d5e55e7c4bdbbdc5e2a11f48ce91ebfb90e56ca2 Mon Sep 17 00:00:00 2001 From: Gabriel Bull Date: Sun, 2 Mar 2014 12:42:58 -0500 Subject: [PATCH 16/24] Moved back phpunit.xml.dist file to root of directory --- changelog.txt | 7 ++++--- composer.json | 3 ++- Tests/phpunit.xml.dist => phpunit.xml.dist | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) rename Tests/phpunit.xml.dist => phpunit.xml.dist (90%) diff --git a/changelog.txt b/changelog.txt index dd952cae..63d8f626 100755 --- a/changelog.txt +++ b/changelog.txt @@ -26,9 +26,10 @@ Changes in branch for release 0.7.1 : - Bugfix: (gabrielbull) - Fixed bug with cell styling - Bugfix: (gabrielbull) - Fixed bug list items inside of cells - Feature: (gabrielbull) - Word2007 : Support sections page numbering +- Feature: (gabrielbull) - Word2007 : Added support for line height - QA: (Progi1984) - UnitTests -Fixed in branch for release 0.7.0 : +Changes in branch for release 0.7.0 : - Bugfix: (RomanSyroeshko) GH-32 - "Warning: Invalid error type specified in ...\PHPWord.php on line 226" is thrown when the specified template file is not found - Bugfix: (RomanSyroeshko) GH-34 - PHPWord_Shared_String.IsUTF8 returns FALSE for Cyrillic UTF-8 input - Bugfix: (RomanSyroeshko) GH-38 - Temporary files naming logic in PHPWord_Template can lead to a collision @@ -37,7 +38,7 @@ Fixed in branch for release 0.7.0 : - Feature: (kaystrobach) - Word2007 : Add rowspan and colspan to cells - Feature: (RLovelett) - Word2007 : Support for tab stops - Feature: (RLovelett) - Word2007 : Support Multiple headers -- Feature: (gavroche) - Word2007 : Wrapping Styles to Images +- Feature: (gabrielbull) - Word2007 : Wrapping Styles to Images - General: (MarkBaker) - Add superscript/subscript styling in Excel2007 Writer - General: (deds) - add indentation support to paragraphs - General: (Progi1984) GH-27 - Support for Composer @@ -45,4 +46,4 @@ Fixed in branch for release 0.7.0 : - General: (Progi1984) - Added PHPWord_Exception and exception when could not copy the template - General: (Progi1984) - IMPROVED : Moved examples out of Classes directory - General: (Esmeraldo) CP-49 - IMPROVED : Advanced string replace in setValue for Template -- Feature: (gavroche) - Added support for image wrapping style +- Feature: (gabrielbull) - Added support for image wrapping style diff --git a/composer.json b/composer.json index 281b8297..8a73f471 100644 --- a/composer.json +++ b/composer.json @@ -11,7 +11,8 @@ }, { "name": "Gabriel Bull", - "email": "gavroche.bull@gmail.com" + "email": "me@gabrielbull.com", + "homepage": "http://gabrielbull.com/" }, { "name": "Franck Lefevre", diff --git a/Tests/phpunit.xml.dist b/phpunit.xml.dist similarity index 90% rename from Tests/phpunit.xml.dist rename to phpunit.xml.dist index 49b6b41f..eaaa9dc2 100644 --- a/Tests/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -10,7 +10,7 @@ syntaxCheck="false"> - ./PHPWord/ + ./Tests/PHPWord/ From 6f2297ea9ad6f608c2f1bd2dbfe82ffe4999d8fc Mon Sep 17 00:00:00 2001 From: Gabriel Bull Date: Sun, 2 Mar 2014 13:11:33 -0500 Subject: [PATCH 17/24] Added PSR-4 Autoloader --- Classes/PHPWord/Autoloader.php | 24 +++++++++++++++++++++++- Tests/PHPWord/AutoloaderTest.php | 14 +++++++++++++- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/Classes/PHPWord/Autoloader.php b/Classes/PHPWord/Autoloader.php index 9bd88596..0e740822 100755 --- a/Classes/PHPWord/Autoloader.php +++ b/Classes/PHPWord/Autoloader.php @@ -31,9 +31,13 @@ if (!defined('PHPWORD_BASE_PATH')) { /** * Class PHPWord_Autoloader + * + * TODO: remove legacy autoloader once everything is moved to namespaces */ class PHPWord_Autoloader { + const PREFIX = 'PHPWord'; + /** * Register the autoloader * @@ -41,7 +45,8 @@ class PHPWord_Autoloader */ public static function register() { - spl_autoload_register(array('PHPWord_Autoloader', 'load')); + spl_autoload_register(array('PHPWord_Autoloader', 'load')); // Legacy + spl_autoload_register(array(new self, 'autoload')); // PSR-4 } /** @@ -60,4 +65,21 @@ class PHPWord_Autoloader return null; } + + /** + * Autoloader + * + * @param string + */ + public static function autoload($class) + { + $prefixLength = strlen(self::PREFIX); + if (0 === strncmp(self::PREFIX, $class, $prefixLength)) { + $file = str_replace('\\', DIRECTORY_SEPARATOR, substr($class, $prefixLength)); + $file = realpath(__DIR__ . (empty($file) ? '' : DIRECTORY_SEPARATOR) . $file . '.php'); + if (file_exists($file)) { + require_once $file; + } + } + } } \ No newline at end of file diff --git a/Tests/PHPWord/AutoloaderTest.php b/Tests/PHPWord/AutoloaderTest.php index 33872466..f24c04e8 100644 --- a/Tests/PHPWord/AutoloaderTest.php +++ b/Tests/PHPWord/AutoloaderTest.php @@ -3,6 +3,7 @@ namespace PHPWord\Tests; use PHPUnit_Framework_TestCase; use PHPWord_Autoloader; +use PHPWord_Autoloader as Autoloader; class AutoloaderTest extends PHPUnit_Framework_TestCase { @@ -10,11 +11,22 @@ class AutoloaderTest extends PHPUnit_Framework_TestCase { PHPWord_Autoloader::register(); $this->assertContains(array('PHPWord_Autoloader', 'load'), spl_autoload_functions()); + $this->assertContains(array('PHPWord_Autoloader', 'autoload'), spl_autoload_functions()); } - public function testAutoload() + public function testAutoloadLegacy() { $this->assertNull(PHPWord_Autoloader::load('Foo'), 'PHPWord_Autoloader::load() is trying to load classes outside of the PHPWord namespace'); $this->assertTrue(PHPWord_Autoloader::load('PHPWord'), 'PHPWord_Autoloader::load() failed to autoload the PHPWord class'); } + + public function testAutoload() + { + $declared = get_declared_classes(); + $declaredCount = count($declared); + Autoloader::autoload('Foo'); + $this->assertEquals($declaredCount, count(get_declared_classes()), 'PHPWord\\Autoloader::autoload() is trying to load classes outside of the PHPWord namespace'); + Autoloader::autoload('PHPWord\\Exceptions\\InvalidStyleException'); // TODO change this class to the main PHPWord class when it is namespaced + $this->assertTrue(in_array('PHPWord\\Exceptions\\InvalidStyleException', get_declared_classes()), 'PHPWord\\Autoloader::autoload() failed to autoload the PHPWord\\Exceptions\\InvalidStyleException class'); + } } \ No newline at end of file From 45cab00eff7d77ef04291b629c06a9da824beff7 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Sun, 2 Mar 2014 20:03:39 +0100 Subject: [PATCH 18/24] FIXED : Unit Tests on Travis CI after have moved phpunit.xml.dist --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index c524df3c..99f33a20 100644 --- a/.travis.yml +++ b/.travis.yml @@ -39,7 +39,7 @@ script: ## PHPLOC - php phploc.phar Classes/ ## PHPUnit - - phpunit -c ./Tests/ --coverage-text + - phpunit -c ./ --coverage-text notifications: email: From 156775655b5042f92b75f4cd7fd58fcec014418e Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Sun, 2 Mar 2014 20:07:05 +0100 Subject: [PATCH 19/24] FIXED : Unit Tests on Travis CI after have moved phpunit.xml.dist --- phpunit.xml.dist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index eaaa9dc2..e57799ce 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,6 +1,6 @@ ../Classes - \ No newline at end of file + From 5a6cb0891f23f7886cda1a793e30caa75a7897a2 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 3 Mar 2014 19:29:17 +0100 Subject: [PATCH 20/24] IMPROVED : Changelog --- changelog.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/changelog.txt b/changelog.txt index 63d8f626..7b5375b4 100755 --- a/changelog.txt +++ b/changelog.txt @@ -25,6 +25,7 @@ Changes in branch for release 0.7.1 : - Bugfix: (gabrielbull) - Fixed bug with cell styling - Bugfix: (gabrielbull) - Fixed bug list items inside of cells +- Feature: (RomanSyroeshko) GH-56 GH-57 - Template : Permit to save a template generated as a file (PHPWord_Template::saveAs()) - Feature: (gabrielbull) - Word2007 : Support sections page numbering - Feature: (gabrielbull) - Word2007 : Added support for line height - QA: (Progi1984) - UnitTests @@ -38,7 +39,7 @@ Changes in branch for release 0.7.0 : - Feature: (kaystrobach) - Word2007 : Add rowspan and colspan to cells - Feature: (RLovelett) - Word2007 : Support for tab stops - Feature: (RLovelett) - Word2007 : Support Multiple headers -- Feature: (gabrielbull) - Word2007 : Wrapping Styles to Images +- Feature: (gabrielbull) - Word2007 : Wrapping Styles to Images - General: (MarkBaker) - Add superscript/subscript styling in Excel2007 Writer - General: (deds) - add indentation support to paragraphs - General: (Progi1984) GH-27 - Support for Composer @@ -46,4 +47,4 @@ Changes in branch for release 0.7.0 : - General: (Progi1984) - Added PHPWord_Exception and exception when could not copy the template - General: (Progi1984) - IMPROVED : Moved examples out of Classes directory - General: (Esmeraldo) CP-49 - IMPROVED : Advanced string replace in setValue for Template -- Feature: (gabrielbull) - Added support for image wrapping style +- Feature: (gabrielbull) - Added support for image wrapping style From d1e16a66d658dec061b0805ce09092e4d930ef68 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Mon, 3 Mar 2014 20:15:29 +0100 Subject: [PATCH 21/24] GH-5 : Word2007 : Added support for page header & page footer height --- Classes/PHPWord/Section/Settings.php | 50 ++++++++++++++++++ Classes/PHPWord/Writer/Word2007/Document.php | 7 ++- changelog.txt | 1 + samples/Sample_03_Sections.php | 55 ++++++++++++++++++++ 4 files changed, 111 insertions(+), 2 deletions(-) create mode 100755 samples/Sample_03_Sections.php diff --git a/Classes/PHPWord/Section/Settings.php b/Classes/PHPWord/Section/Settings.php index 020a82e3..fce8d7b1 100755 --- a/Classes/PHPWord/Section/Settings.php +++ b/Classes/PHPWord/Section/Settings.php @@ -158,6 +158,16 @@ class PHPWord_Section_Settings */ private $pageNumberingStart; + /** + * @var int + */ + private $headerHeight; + + /** + * @var int + */ + private $footerHeight; + /** * Create new Section Settings */ @@ -178,6 +188,8 @@ class PHPWord_Section_Settings $this->_borderRightColor = null; $this->_borderBottomSize = null; $this->_borderBottomColor = null; + $this->headerHeight = 720; // set default header and footer to 720 twips (.5 inches) + $this->footerHeight = 720; } /** @@ -568,4 +580,42 @@ class PHPWord_Section_Settings { return $this->pageNumberingStart; } + + /** + * Get Header Height + * + * @return int + */ + public function getHeaderHeight() { + return $this->headerHeight; + } + + /** + * Set Header Height + * + * @param int $pValue + */ + public function setHeaderHeight($pValue = '') { + $this->headerHeight = $pValue; + return $this; + } + + /** + * Get Footer Height + * + * @return int + */ + public function getFooterHeight() { + return $this->footerHeight; + } + + /** + * Set Footer Height + * + * @param int $pValue + */ + public function setFooterHeight($pValue = '') { + $this->footerHeight = $pValue; + return $this; + } } diff --git a/Classes/PHPWord/Writer/Word2007/Document.php b/Classes/PHPWord/Writer/Word2007/Document.php index 41718f6e..8722e53b 100755 --- a/Classes/PHPWord/Writer/Word2007/Document.php +++ b/Classes/PHPWord/Writer/Word2007/Document.php @@ -135,6 +135,9 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base $marginRight = $settings->getMarginRight(); $marginBottom = $settings->getMarginBottom(); + $headerHeight = $settings->getHeaderHeight(); + $footerHeight = $settings->getFooterHeight(); + $borders = $settings->getBorderSize(); $objWriter->startElement('w:sectPr'); @@ -175,8 +178,8 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base $objWriter->writeAttribute('w:right', $marginRight); $objWriter->writeAttribute('w:bottom', $marginBottom); $objWriter->writeAttribute('w:left', $marginLeft); - $objWriter->writeAttribute('w:header', '720'); - $objWriter->writeAttribute('w:footer', '720'); + $objWriter->writeAttribute('w:header', $headerHeight); + $objWriter->writeAttribute('w:footer', $footerHeight); $objWriter->writeAttribute('w:gutter', '0'); $objWriter->endElement(); diff --git a/changelog.txt b/changelog.txt index 7b5375b4..bf07c48a 100755 --- a/changelog.txt +++ b/changelog.txt @@ -28,6 +28,7 @@ Changes in branch for release 0.7.1 : - Feature: (RomanSyroeshko) GH-56 GH-57 - Template : Permit to save a template generated as a file (PHPWord_Template::saveAs()) - Feature: (gabrielbull) - Word2007 : Support sections page numbering - Feature: (gabrielbull) - Word2007 : Added support for line height +- Feature: (JillElaine) GH-5 - Word2007 : Added support for page header & page footer height - QA: (Progi1984) - UnitTests Changes in branch for release 0.7.0 : diff --git a/samples/Sample_03_Sections.php b/samples/Sample_03_Sections.php new file mode 100755 index 00000000..d2231dfa --- /dev/null +++ b/samples/Sample_03_Sections.php @@ -0,0 +1,55 @@ +'); +} + +require_once '../Classes/PHPWord.php'; + +// New Word Document +echo date('H:i:s') , ' Create new PHPWord object' , EOL; +$PHPWord = new PHPWord(); + +// New portrait section +$section = $PHPWord->createSection(array('borderColor' => '00FF00', 'borderSize' => 12)); +$section->addText('I am placed on a default section.'); + +// New landscape section +$section = $PHPWord->createSection(array('orientation' => 'landscape')); +$section->addText('I am placed on a landscape section. Every page starting from this section will be landscape style.'); +$section->addPageBreak(); +$section->addPageBreak(); + +// New portrait section +$section = $PHPWord->createSection(array('marginLeft' => 600, 'marginRight' => 600, 'marginTop' => 600, 'marginBottom' => 600)); +$section->addText('This section uses other margins.'); + +// New portrait section with Header & Footer +$section = $PHPWord->createSection(array('marginLeft' => 200, 'marginRight' => 200, 'marginTop' => 200, 'marginBottom' => 200, 'headerHeight' => 50, 'footerHeight' => 50,)); +$section->addText('This section and we play with header/footer height.'); +$section->createHeader()->addText('Header'); +$section->createFooter()->addText('Footer'); + +// Save File +echo date('H:i:s') , ' Write to Word2007 format' , EOL; +$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007'); +$objWriter->save(str_replace('.php', '.docx', __FILE__)); + +/*echo date('H:i:s') , ' Write to OpenDocumentText format' , EOL; +$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'ODText'); +$objWriter->save(str_replace('.php', '.odt', __FILE__)); + +echo date('H:i:s') , ' Write to RTF format' , EOL; +$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'RTF'); +$objWriter->save(str_replace('.php', '.rtf', __FILE__));*/ + + +// Echo memory peak usage +echo date('H:i:s') , ' Peak memory usage: ' , (memory_get_peak_usage(true) / 1024 / 1024) , ' MB' , EOL; + +// Echo done +echo date('H:i:s') , ' Done writing file' , EOL; From d0b4ed6d415aab3e8730934a04407fbff90e40a2 Mon Sep 17 00:00:00 2001 From: Brandon Skrtich Date: Tue, 4 Mar 2014 10:54:14 -0700 Subject: [PATCH 22/24] Ability to use images in a text run --- Classes/PHPWord/Section/TextRun.php | 21 ++++++++ Classes/PHPWord/Writer/Word2007/Base.php | 24 ++++++---- samples/Sample_04_Textrun.php | 61 ++++++++++++++++++++++++ 3 files changed, 97 insertions(+), 9 deletions(-) create mode 100644 samples/Sample_04_Textrun.php diff --git a/Classes/PHPWord/Section/TextRun.php b/Classes/PHPWord/Section/TextRun.php index a9104341..44473e63 100755 --- a/Classes/PHPWord/Section/TextRun.php +++ b/Classes/PHPWord/Section/TextRun.php @@ -109,6 +109,27 @@ class PHPWord_Section_TextRun return $link; } + /** + * Add a Image Element + * + * @param string $imageSrc + * @param mixed $styleFont + * @return PHPWord_Section_Image + */ + public function addImage($imageSrc, $style = null) { + $image = new PHPWord_Section_Image($imageSrc, $style); + + if (!is_null($image->getSource())) { + $rID = PHPWord_Media::addSectionMediaElement($imageSrc, 'image'); + $image->setRelationId($rID); + + $this->_elementCollection[] = $image; + return $image; + } else { + trigger_error('Source does not exist or unsupported image type.'); + } + } + /** * Get TextRun content * diff --git a/Classes/PHPWord/Writer/Word2007/Base.php b/Classes/PHPWord/Writer/Word2007/Base.php index 3d464449..a90126d9 100755 --- a/Classes/PHPWord/Writer/Word2007/Base.php +++ b/Classes/PHPWord/Writer/Word2007/Base.php @@ -106,6 +106,8 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart $this->_writeText($objWriter, $element, true); } elseif ($element instanceof PHPWord_Section_Link) { $this->_writeLink($objWriter, $element, true); + } elseif ($element instanceof PHPWord_Section_Image) { + $this->_writeImage($objWriter, $element, true); } } } @@ -627,7 +629,7 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart * @param \PHPWord_Shared_XMLWriter $objWriter * @param \PHPWord_Section_Image $image */ - protected function _writeImage(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_Image $image) + protected function _writeImage(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_Image $image, $withoutP = false) { $rId = $image->getRelationId(); @@ -639,14 +641,16 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart $marginLeft = $style->getMarginLeft(); $wrappingStyle = $style->getWrappingStyle(); - $objWriter->startElement('w:p'); + if (!$withoutP) { + $objWriter->startElement('w:p'); - if (!is_null($align)) { - $objWriter->startElement('w:pPr'); - $objWriter->startElement('w:jc'); - $objWriter->writeAttribute('w:val', $align); - $objWriter->endElement(); - $objWriter->endElement(); + if (!is_null($align)) { + $objWriter->startElement('w:pPr'); + $objWriter->startElement('w:jc'); + $objWriter->writeAttribute('w:val', $align); + $objWriter->endElement(); + $objWriter->endElement(); + } } $objWriter->startElement('w:r'); @@ -697,7 +701,9 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart $objWriter->endElement(); - $objWriter->endElement(); + if (!$withoutP) { + $objWriter->endElement(); // w:p + } } protected function _writeWatermark(PHPWord_Shared_XMLWriter $objWriter = null, $image) diff --git a/samples/Sample_04_Textrun.php b/samples/Sample_04_Textrun.php new file mode 100644 index 00000000..80ad2d3c --- /dev/null +++ b/samples/Sample_04_Textrun.php @@ -0,0 +1,61 @@ +'); +} + +require_once '../Classes/PHPWord.php'; + +// New Word Document +echo date('H:i:s') , ' Create new PHPWord object' , EOL; +$PHPWord = new PHPWord(); + + +// Ads styles +$PHPWord->addParagraphStyle('pStyle', array('spacing'=>100)); +$PHPWord->addFontStyle('BoldText', array('bold'=>true)); +$PHPWord->addFontStyle('ColoredText', array('color'=>'FF8080')); +$PHPWord->addLinkStyle('NLink', array('color'=>'0000FF', 'underline'=>PHPWord_Style_Font::UNDERLINE_SINGLE)); + +// New portrait section +$section = $PHPWord->createSection(); + +// Add text run +$textrun = $section->createTextRun('pStyle'); + +$textrun->addText('Each textrun can contain native text, link elements or an image.'); +$textrun->addText(' No break is placed after adding an element.', 'BoldText'); +$textrun->addText(' All elements are placed inside a paragraph with the optionally given p-Style.', 'ColoredText'); +$textrun->addText(' Sample Link: '); +$textrun->addLink('http://www.google.com', null, 'NLink'); +$textrun->addText(' Sample Image: '); +$textrun->addImage('old/_earth.jpg', array('width'=>18, 'height'=>18)); +$textrun->addText(' Here is some more text. '); + +// Save File +echo date('H:i:s') , ' Write to Word2007 format' , EOL; +$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007'); +$objWriter->save(str_replace('.php', '.docx', __FILE__)); + +/* Text Run is not currently supported for ODText +echo date('H:i:s') , ' Write to OpenDocumentText format' , EOL; +$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'ODText'); +$objWriter->save(str_replace('.php', '.odt', __FILE__)); +*/ + +/* Text Run is not currently supported for RTF +echo date('H:i:s') , ' Write to RTF format' , EOL; +$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'RTF'); +$objWriter->save(str_replace('.php', '.rtf', __FILE__)); +*/ + +// Echo memory peak usage +echo date('H:i:s') , ' Peak memory usage: ' , (memory_get_peak_usage(true) / 1024 / 1024) , ' MB' , EOL; + +// Echo done +echo date('H:i:s') , ' Done writing file' , EOL; \ No newline at end of file From c173a71df0c105dc596177d75c83c17ab08cab05 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 5 Mar 2014 09:42:16 +0100 Subject: [PATCH 23/24] Changelog (GH-6 GH-66 GH-84) --- changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.txt b/changelog.txt index bf07c48a..72c1ee43 100755 --- a/changelog.txt +++ b/changelog.txt @@ -25,6 +25,7 @@ Changes in branch for release 0.7.1 : - Bugfix: (gabrielbull) - Fixed bug with cell styling - Bugfix: (gabrielbull) - Fixed bug list items inside of cells +- Bugfix: (bskrtich) GH-6 GH-66 GH-84 - Add ability to manage line breaks after image insertion - Feature: (RomanSyroeshko) GH-56 GH-57 - Template : Permit to save a template generated as a file (PHPWord_Template::saveAs()) - Feature: (gabrielbull) - Word2007 : Support sections page numbering - Feature: (gabrielbull) - Word2007 : Added support for line height From 1f4a18dac3ea56fdf6f94b0081723172a4b67bf6 Mon Sep 17 00:00:00 2001 From: Progi1984 Date: Wed, 5 Mar 2014 13:10:37 +0100 Subject: [PATCH 24/24] Changelog (GH-52 GH-53 GH-85) --- changelog.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index 72c1ee43..27ee52bd 100755 --- a/changelog.txt +++ b/changelog.txt @@ -25,11 +25,12 @@ Changes in branch for release 0.7.1 : - Bugfix: (gabrielbull) - Fixed bug with cell styling - Bugfix: (gabrielbull) - Fixed bug list items inside of cells -- Bugfix: (bskrtich) GH-6 GH-66 GH-84 - Add ability to manage line breaks after image insertion - Feature: (RomanSyroeshko) GH-56 GH-57 - Template : Permit to save a template generated as a file (PHPWord_Template::saveAs()) - Feature: (gabrielbull) - Word2007 : Support sections page numbering - Feature: (gabrielbull) - Word2007 : Added support for line height - Feature: (JillElaine) GH-5 - Word2007 : Added support for page header & page footer height +- Feature: (bskrtich) GH-6 GH-66 GH-84 - General : Add ability to manage line breaks after image insertion +- Feature: (RomanSyroeshko) GH-52 GH-53 GH-85 - Template : Ability to limit number of replacements performed by setValue() method of Template class - QA: (Progi1984) - UnitTests Changes in branch for release 0.7.0 :