This commit is contained in:
Roman Syroeshko 2014-03-20 16:54:12 +04:00
parent 32ed6a3b19
commit 8267a9e12f
161 changed files with 1034 additions and 1098 deletions

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
@ -28,6 +28,7 @@
namespace PhpOffice; namespace PhpOffice;
use PhpOffice\PhpWord\DocumentProperties; use PhpOffice\PhpWord\DocumentProperties;
use PhpOffice\PhpWord\Exceptions\Exception;
use PhpOffice\PhpWord\Section; use PhpOffice\PhpWord\Section;
use PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\Style;
use PhpOffice\PhpWord\Template; use PhpOffice\PhpWord\Template;
@ -36,114 +37,83 @@ use PhpOffice\PhpWord\Template;
// @codeCoverageIgnoreStart // @codeCoverageIgnoreStart
if (!defined('PHPWORD_BASE_PATH')) { if (!defined('PHPWORD_BASE_PATH')) {
define('PHPWORD_BASE_PATH', dirname(__FILE__) . '/'); define('PHPWORD_BASE_PATH', dirname(__FILE__) . '/');
require PHPWORD_BASE_PATH . 'PHPWord/Autoloader.php'; require PHPWORD_BASE_PATH . 'PhpWord/Autoloader.php';
PHPWord_Autoloader::Register(); PHPWord_Autoloader::Register();
} }
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
use PhpOffice\PhpWord\Exceptions\Exception;
class PhpWord class PhpWord
{ {
/** const DEFAULT_FONT_COLOR = '000000'; // HEX
* Default font name (Arial) const DEFAULT_FONT_CONTENT_TYPE = 'default'; // default|eastAsia|cs
*/
const DEFAULT_FONT_NAME = 'Arial'; const DEFAULT_FONT_NAME = 'Arial';
/** /**
* Default Font Content Type(default) * Default font size, in points.
* default|eastAsia|cs
*/
const DEFAULT_FONT_CONTENT_TYPE='default';
/**
* Default font size in points (10pt)
* *
* OOXML defined font size values in halfpoints, i.e. twice of what PHPWord * OOXML defined font size values in halfpoints, i.e. twice of what PhpWord
* use, and the conversion will be conducted during XML writing. * use, and the conversion will be conducted during XML writing.
*/ */
const DEFAULT_FONT_SIZE = 10; const DEFAULT_FONT_SIZE = 10;
/** /**
* Default font color (black)
*/
const DEFAULT_FONT_COLOR = '000000';
/**
* Document properties
*
* @var PhpOffice\PhpWord\DocumentProperties * @var PhpOffice\PhpWord\DocumentProperties
*/ */
private $_properties; private $_documentProperties;
/** /**
* Default Font Name
*
* @var string * @var string
*/ */
private $_defaultFontName; private $_defaultFontName;
/** /**
* Default Font Size
*
* @var int * @var int
*/ */
private $_defaultFontSize; private $_defaultFontSize;
/** /**
* Collection of section elements * @var PhpOffice\PhpWord\Section[]
*
* @var array
*/ */
private $_sectionCollection = array(); private $_sections = array();
/**
* Create a new PHPWord Document
*/
public function __construct() public function __construct()
{ {
$this->_properties = new DocumentProperties(); $this->_documentProperties = new DocumentProperties();
$this->_defaultFontName = PHPWord::DEFAULT_FONT_NAME; $this->_defaultFontName = self::DEFAULT_FONT_NAME;
$this->_defaultFontSize = PHPWord::DEFAULT_FONT_SIZE; $this->_defaultFontSize = self::DEFAULT_FONT_SIZE;
} }
/** /**
* Get properties
* @return PhpOffice\PhpWord\DocumentProperties * @return PhpOffice\PhpWord\DocumentProperties
*/ */
public function getProperties() public function getDocumentProperties()
{ {
return $this->_properties; return $this->_documentProperties;
} }
/** /**
* Set properties * @param PhpOffice\PhpWord\DocumentProperties $documentProperties
* * @return PhpOffice\PhpWord
* @param PhpOffice\PhpWord\DocumentProperties $value
* @return PhpOffice\PHPWord
*/ */
public function setProperties(DocumentProperties $value) public function setDocumentProperties(DocumentProperties $documentProperties)
{ {
$this->_properties = $value; $this->_documentProperties = $documentProperties;
return $this; return $this;
} }
/** /**
* Create a new Section
*
* @param PhpOffice\PhpWord\Section\Settings $settings * @param PhpOffice\PhpWord\Section\Settings $settings
* @return PhpOffice\PhpWord\Section * @return PhpOffice\PhpWord\Section
*/ */
public function createSection($settings = null) public function createSection($settings = null)
{ {
$sectionCount = $this->_countSections() + 1; $section = new Section(\count($this->_sections) + 1, $settings);
$this->_sections[] = $section;
$section = new Section($sectionCount, $settings);
$this->_sectionCollection[] = $section;
return $section; return $section;
} }
/** /**
* Get default Font name
* @return string * @return string
*/ */
public function getDefaultFontName() public function getDefaultFontName()
@ -152,16 +122,14 @@ class PhpWord
} }
/** /**
* Set default Font name * @param string $fontName
* @param string $pValue
*/ */
public function setDefaultFontName($pValue) public function setDefaultFontName($fontName)
{ {
$this->_defaultFontName = $pValue; $this->_defaultFontName = $fontName;
} }
/** /**
* Get default Font size (in points)
* @return string * @return string
*/ */
public function getDefaultFontSize() public function getDefaultFontSize()
@ -170,12 +138,11 @@ class PhpWord
} }
/** /**
* Set default Font size (in points) * @param int $fontSize
* @param int $pValue
*/ */
public function setDefaultFontSize($pValue) public function setDefaultFontSize($fontSize)
{ {
$this->_defaultFontSize = $pValue; $this->_defaultFontSize = $fontSize;
} }
/** /**
@ -244,35 +211,24 @@ class PhpWord
} }
/** /**
* Get sections
* @return PhpOffice\PhpWord\Section[] * @return PhpOffice\PhpWord\Section[]
*/ */
public function getSections() public function getSections()
{ {
return $this->_sectionCollection; return $this->_sections;
} }
/** /**
* Load a Template File * @param string $filename Fully qualified filename.
*
* @param string $strFilename
* @return PhpOffice\PhpWord\Template * @return PhpOffice\PhpWord\Template
* @throws Exception * @throws PhpOffice\PhpWord\Exceptions\Exception
*/ */
public function loadTemplate($strFilename) public function loadTemplate($filename)
{ {
if (file_exists($strFilename)) { if (\file_exists($filename)) {
return new Template($strFilename); return new Template($filename);
} else {
throw new Exception("Template file {$filename} not found.");
} }
throw new Exception("Template file {$strFilename} not found.");
}
/**
* Get section count
* @return int
*/
private function _countSections()
{
return count($this->_sectionCollection);
} }
} }

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -6,7 +6,7 @@ namespace PhpOffice\PhpWord\Exceptions;
* *
* Exception used for when an image is not found * Exception used for when an image is not found
* *
* @package PHPWord * @package PhpWord
*/ */
class InvalidImageException extends Exception class InvalidImageException extends Exception
{ {

View File

@ -8,7 +8,7 @@ use InvalidArgumentException;
* *
* Exception used for when a style value is invalid * Exception used for when a style value is invalid
* *
* @package PHPWord * @package PhpWord
*/ */
class InvalidStyleException extends InvalidArgumentException class InvalidStyleException extends InvalidArgumentException
{ {

View File

@ -6,7 +6,7 @@ namespace PhpOffice\PhpWord\Exceptions;
* *
* Exception used for when an image type is unsupported * Exception used for when an image type is unsupported
* *
* @package PHPWord * @package PhpWord
*/ */
class UnsupportedImageTypeException extends Exception class UnsupportedImageTypeException extends Exception
{ {

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,26 +18,27 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
namespace PhpOffice\PhpWord; namespace PhpOffice\PhpWord;
use PhpOffice\PhpWord;
use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\Exceptions\Exception;
abstract class IOFactory abstract class IOFactory
{ {
/** /**
* @param PHPWord $phpWord * @param PhpOffice\PhpWord $phpWord
* @param string $name * @param string $name
* @return PhpOffice\PhpWord\Writer\IWriter * @return PhpOffice\PhpWord\Writer\IWriter
* @throws PhpOffice\PhpWord\Exceptions\Exception * @throws PhpOffice\PhpWord\Exceptions\Exception
*/ */
public static function createWriter(PHPWord $phpWord, $name) public static function createWriter(PhpWord $phpWord, $name)
{ {
try { try {
$fqName = "PhpOffice\\PhpWord\\Writer\\{$name}"; $fqName = "PhpOffice\\PhpWord\\Writer\\{$name}";
@ -69,7 +70,7 @@ abstract class IOFactory
* *
* @param string $filename The name of the file * @param string $filename The name of the file
* @param string $readerName * @param string $readerName
* @return PhpOffice\PHPWord * @return PhpOffice\PhpWord
*/ */
public static function load($filename, $readerName = 'Word2007') public static function load($filename, $readerName = 'Word2007')
{ {

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
@ -38,7 +38,7 @@ interface IReader
public function canRead($pFilename); public function canRead($pFilename);
/** /**
* Loads PHPWord from file * Loads PhpWord from file
* *
* @param string $pFilename * @param string $pFilename
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,23 +18,24 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
namespace PhpOffice\PhpWord\Reader; namespace PhpOffice\PhpWord\Reader;
use PhpOffice\PhpWord;
use PhpOffice\PhpWord\DocumentProperties; use PhpOffice\PhpWord\DocumentProperties;
use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\Exceptions\Exception;
use PhpOffice\PhpWord\Shared\File; use PhpOffice\PhpWord\Shared\File;
/** PHPWord root directory */ /** PhpWord root directory */
if (!defined('PHPWORD_BASE_PATH')) { if (!defined('PHPWORD_BASE_PATH')) {
define('PHPWORD_BASE_PATH', dirname(__FILE__) . '/../../'); define('PHPWORD_BASE_PATH', dirname(__FILE__) . '/../../');
require(PHPWORD_BASE_PATH . 'PHPWord/Autoloader.php'); require(PHPWORD_BASE_PATH . 'PhpWord/Autoloader.php');
} }
class Word2007 extends AbstractReader implements IReader class Word2007 extends AbstractReader implements IReader
@ -44,7 +45,7 @@ class Word2007 extends AbstractReader implements IReader
* *
* @param string $pFilename * @param string $pFilename
* @return bool * @return bool
* @throws Exception * @throws PhpOffice\PhpWord\Exceptions\Exception
*/ */
public function canRead($pFilename) public function canRead($pFilename)
{ {
@ -55,7 +56,7 @@ class Word2007 extends AbstractReader implements IReader
$return = false; $return = false;
// Load file // Load file
$zip = new ZipArchive; $zip = new ZipArchive();
if ($zip->open($pFilename) === true) { if ($zip->open($pFilename) === true) {
// check if it is an OOXML archive // check if it is an OOXML archive
$rels = simplexml_load_string($this->getFromZipArchive($zip, "_rels/.rels")); $rels = simplexml_load_string($this->getFromZipArchive($zip, "_rels/.rels"));
@ -78,8 +79,6 @@ class Word2007 extends AbstractReader implements IReader
} }
/** /**
* Get from zip archive
*
* @param ZipArchive $archive * @param ZipArchive $archive
* @param string $fileName * @param string $fileName
* @param bool $removeNamespace * @param bool $removeNamespace
@ -108,10 +107,10 @@ class Word2007 extends AbstractReader implements IReader
} }
/** /**
* Loads PHPWord from file * Loads PhpWord from file
* *
* @param string $pFilename * @param string $pFilename
* @return PHPWord|null * @return PhpOffice\PhpWord|null
*/ */
public function load($pFilename) public function load($pFilename)
{ {
@ -121,8 +120,8 @@ class Word2007 extends AbstractReader implements IReader
} }
// Initialisations // Initialisations
$word = new PHPWord; $word = new PhpWord();
$zip = new ZipArchive; $zip = new ZipArchive();
$zip->open($pFilename); $zip->open($pFilename);
// Read properties and documents // Read properties and documents
@ -136,7 +135,7 @@ class Word2007 extends AbstractReader implements IReader
$xmlCore->registerXPathNamespace("dc", "http://purl.org/dc/elements/1.1/"); $xmlCore->registerXPathNamespace("dc", "http://purl.org/dc/elements/1.1/");
$xmlCore->registerXPathNamespace("dcterms", "http://purl.org/dc/terms/"); $xmlCore->registerXPathNamespace("dcterms", "http://purl.org/dc/terms/");
$xmlCore->registerXPathNamespace("cp", "http://schemas.openxmlformats.org/package/2006/metadata/core-properties"); $xmlCore->registerXPathNamespace("cp", "http://schemas.openxmlformats.org/package/2006/metadata/core-properties");
$docProps = $word->getProperties(); $docProps = $word->getDocumentProperties();
$docProps->setCreator((string)self::arrayItem($xmlCore->xpath("dc:creator"))); $docProps->setCreator((string)self::arrayItem($xmlCore->xpath("dc:creator")));
$docProps->setLastModifiedBy((string)self::arrayItem($xmlCore->xpath("cp:lastModifiedBy"))); $docProps->setLastModifiedBy((string)self::arrayItem($xmlCore->xpath("cp:lastModifiedBy")));
$docProps->setCreated(strtotime(self::arrayItem($xmlCore->xpath("dcterms:created")))); $docProps->setCreated(strtotime(self::arrayItem($xmlCore->xpath("dcterms:created"))));
@ -152,7 +151,7 @@ class Word2007 extends AbstractReader implements IReader
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties": case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties":
$xmlCore = simplexml_load_string($this->getFromZipArchive($zip, "{$rel['Target']}")); $xmlCore = simplexml_load_string($this->getFromZipArchive($zip, "{$rel['Target']}"));
if (is_object($xmlCore)) { if (is_object($xmlCore)) {
$docProps = $word->getProperties(); $docProps = $word->getDocumentProperties();
if (isset($xmlCore->Company)) { if (isset($xmlCore->Company)) {
$docProps->setCompany((string)$xmlCore->Company); $docProps->setCompany((string)$xmlCore->Company);
} }
@ -165,7 +164,7 @@ class Word2007 extends AbstractReader implements IReader
case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties": case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties":
$xmlCore = simplexml_load_string($this->getFromZipArchive($zip, "{$rel['Target']}")); $xmlCore = simplexml_load_string($this->getFromZipArchive($zip, "{$rel['Target']}"));
if (is_object($xmlCore)) { if (is_object($xmlCore)) {
$docProps = $word->getProperties(); $docProps = $word->getDocumentProperties();
foreach ($xmlCore as $xmlProperty) { foreach ($xmlCore as $xmlProperty) {
$cellDataOfficeAttributes = $xmlProperty->attributes(); $cellDataOfficeAttributes = $xmlProperty->attributes();
if (isset($cellDataOfficeAttributes['name'])) { if (isset($cellDataOfficeAttributes['name'])) {
@ -443,8 +442,6 @@ class Word2007 extends AbstractReader implements IReader
} }
/** /**
* Get array item
*
* @param array $array * @param array $array
* @param mixed $key * @param mixed $key
* @return mixed|null * @return mixed|null

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
@ -242,7 +242,7 @@ class Section
$ext = substr($ext, 0, -1); $ext = substr($ext, 0, -1);
} }
$iconSrc = PHPWORD_BASE_PATH . 'PHPWord/_staticDocParts/'; $iconSrc = PHPWORD_BASE_PATH . 'PhpWord/_staticDocParts/';
if (!file_exists($iconSrc . '_' . $ext . '.png')) { if (!file_exists($iconSrc . '_' . $ext . '.png')) {
$iconSrc = $iconSrc . '_default.png'; $iconSrc = $iconSrc . '_default.png';
} else { } else {

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
@ -261,7 +261,7 @@ class Cell
$ext = substr($ext, 0, -1); $ext = substr($ext, 0, -1);
} }
$iconSrc = PHPWORD_BASE_PATH . 'PHPWord/_staticDocParts/'; $iconSrc = PHPWORD_BASE_PATH . 'PhpWord/_staticDocParts/';
if (!file_exists($iconSrc . '_' . $ext . '.png')) { if (!file_exists($iconSrc . '_' . $ext . '.png')) {
$iconSrc = $iconSrc . '_default.png'; $iconSrc = $iconSrc . '_default.png';
} else { } else {

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2013 PHPWord * @copyright Copyright (c) 2013 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,15 +18,16 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
namespace PhpOffice\PhpWord\Style; namespace PhpOffice\PhpWord\Style;
use PhpOffice\PhpWord;
use PhpOffice\PhpWord\Exceptions\InvalidStyleException; use PhpOffice\PhpWord\Exceptions\InvalidStyleException;
class Font class Font
@ -84,14 +85,14 @@ class Font
* *
* @var int|float * @var int|float
*/ */
private $_name = PHPWord::DEFAULT_FONT_NAME; private $_name = PhpWord::DEFAULT_FONT_NAME;
/** /**
* Font size * Font size
* *
* @var int|float * @var int|float
*/ */
private $_size = PHPWord::DEFAULT_FONT_SIZE; private $_size = PhpWord::DEFAULT_FONT_SIZE;
/** /**
* Bold * Bold
@ -140,7 +141,7 @@ class Font
* *
* @var string * @var string
*/ */
private $_color = PHPWord::DEFAULT_FONT_COLOR; private $_color = PhpWord::DEFAULT_FONT_COLOR;
/** /**
* Foreground/highlight * Foreground/highlight
@ -161,7 +162,7 @@ class Font
* *
* @var string * @var string
*/ */
private $_hint = PHPWord::DEFAULT_FONT_CONTENT_TYPE; private $_hint = PhpWord::DEFAULT_FONT_CONTENT_TYPE;
/** /**
* New font style * New font style
@ -232,10 +233,10 @@ class Font
* @param string $pValue * @param string $pValue
* @return PhpOffice\PhpWord\Style\Font * @return PhpOffice\PhpWord\Style\Font
*/ */
public function setName($pValue = PHPWord::DEFAULT_FONT_NAME) public function setName($pValue = PhpWord::DEFAULT_FONT_NAME)
{ {
if (is_null($pValue) || $pValue == '') { if (is_null($pValue) || $pValue == '') {
$pValue = PHPWord::DEFAULT_FONT_NAME; $pValue = PhpWord::DEFAULT_FONT_NAME;
} }
$this->_name = $pValue; $this->_name = $pValue;
return $this; return $this;
@ -258,10 +259,10 @@ class Font
* @param int|float $pValue * @param int|float $pValue
* @return PhpOffice\PhpWord\Style\Font * @return PhpOffice\PhpWord\Style\Font
*/ */
public function setSize($pValue = PHPWord::DEFAULT_FONT_SIZE) public function setSize($pValue = PhpWord::DEFAULT_FONT_SIZE)
{ {
if (!is_numeric($pValue)) { if (!is_numeric($pValue)) {
$pValue = PHPWord::DEFAULT_FONT_SIZE; $pValue = PhpWord::DEFAULT_FONT_SIZE;
} }
$this->_size = $pValue; $this->_size = $pValue;
return $this; return $this;
@ -435,10 +436,10 @@ class Font
* @param string $pValue * @param string $pValue
* @return PhpOffice\PhpWord\Style\Font * @return PhpOffice\PhpWord\Style\Font
*/ */
public function setColor($pValue = PHPWord::DEFAULT_FONT_COLOR) public function setColor($pValue = PhpWord::DEFAULT_FONT_COLOR)
{ {
if (is_null($pValue) || $pValue == '') { if (is_null($pValue) || $pValue == '') {
$pValue = PHPWord::DEFAULT_FONT_COLOR; $pValue = PhpWord::DEFAULT_FONT_COLOR;
} }
$this->_color = $pValue; $this->_color = $pValue;
return $this; return $this;
@ -532,10 +533,10 @@ class Font
* @param string $pValue * @param string $pValue
* @return PhpOffice\PhpWord\Style\Font * @return PhpOffice\PhpWord\Style\Font
*/ */
public function setHint($pValue = PHPWord::DEFAULT_FONT_CONTENT_TYPE) public function setHint($pValue = PhpWord::DEFAULT_FONT_CONTENT_TYPE)
{ {
if (is_null($pValue) || $pValue == '') { if (is_null($pValue) || $pValue == '') {
$pValue = PHPWord::DEFAULT_FONT_CONTENT_TYPE; $pValue = PhpWord::DEFAULT_FONT_CONTENT_TYPE;
} }
$this->_hint = $pValue; $this->_hint = $pValue;
return $this; return $this;

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2013 PHPWord * @copyright Copyright (c) 2013 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
@ -30,10 +30,10 @@ namespace PhpOffice\PhpWord\Writer;
interface IWriter interface IWriter
{ {
/** /**
* Save PHPWord to file * Save PhpWord to file
* *
* @param string $pFileName * @param string $pFileName
* @throws Exception * @throws \Exception
*/ */
public function save($pFilename = null); public function save($pFilename = null);
} }

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,15 +18,16 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
namespace PhpOffice\PhpWord\Writer; namespace PhpOffice\PhpWord\Writer;
use PhpOffice\PhpWord;
use PhpOffice\PhpWord\HashTable; use PhpOffice\PhpWord\HashTable;
use PhpOffice\PhpWord\Writer\ODText\Content; use PhpOffice\PhpWord\Writer\ODText\Content;
use PhpOffice\PhpWord\Writer\ODText\Manifest; use PhpOffice\PhpWord\Writer\ODText\Manifest;
@ -37,15 +38,11 @@ use PhpOffice\PhpWord\Writer\ODText\Styles;
class ODText implements IWriter class ODText implements IWriter
{ {
/** /**
* Private PHPWord * @var PhpOffice\PhpWord
*
* @var PHPWord
*/ */
private $_document; private $_document;
/** /**
* Private writer parts
*
* @var PhpOffice\PhpWord\Writer\ODText\WriterPart[] * @var PhpOffice\PhpWord\Writer\ODText\WriterPart[]
*/ */
private $_writerParts; private $_writerParts;
@ -65,19 +62,17 @@ class ODText implements IWriter
private $_useDiskCaching = false; private $_useDiskCaching = false;
/** /**
* Disk caching directory
*
* @var string * @var string
*/ */
private $_diskCachingDirectory; private $_diskCachingDirectory;
/** /**
* @param PHPWord $phpWord * @param PhpOffice\PhpWord $phpWord
*/ */
public function __construct(PHPWord $phpWord = null) public function __construct(PhpWord $phpWord = null)
{ {
// Assign PHPWord // Assign PhpWord
$this->setPHPWord($phpWord); $this->setPhpWord($phpWord);
// Set up disk caching location // Set up disk caching location
$this->_diskCachingDirectory = './'; $this->_diskCachingDirectory = './';
@ -100,10 +95,10 @@ class ODText implements IWriter
} }
/** /**
* Save PHPWord to file * Save PhpWord to file
* *
* @param string $pFileName * @param string $pFileName
* @throws Exception * @throws \Exception
*/ */
public function save($pFilename = null) public function save($pFilename = null)
{ {
@ -125,7 +120,7 @@ class ODText implements IWriter
// Try opening the ZIP file // Try opening the ZIP file
if ($objZip->open($pFilename, ZIPARCHIVE::OVERWRITE) !== true) { if ($objZip->open($pFilename, ZIPARCHIVE::OVERWRITE) !== true) {
if ($objZip->open($pFilename, ZIPARCHIVE::CREATE) !== true) { if ($objZip->open($pFilename, ZIPARCHIVE::CREATE) !== true) {
throw new Exception("Could not open " . $pFilename . " for writing."); throw new \Exception("Could not open " . $pFilename . " for writing.");
} }
} }
@ -182,45 +177,40 @@ class ODText implements IWriter
// Close file // Close file
if ($objZip->close() === false) { if ($objZip->close() === false) {
throw new Exception("Could not close zip file $pFilename."); throw new \Exception("Could not close zip file $pFilename.");
} }
// If a temporary file was used, copy it to the correct file stream // If a temporary file was used, copy it to the correct file stream
if ($originalFilename != $pFilename) { if ($originalFilename != $pFilename) {
if (copy($pFilename, $originalFilename) === false) { if (copy($pFilename, $originalFilename) === false) {
throw new Exception("Could not copy temporary zip file $pFilename to $originalFilename."); throw new \Exception("Could not copy temporary zip file $pFilename to $originalFilename.");
} }
@unlink($pFilename); @unlink($pFilename);
} }
} else { } else {
throw new Exception("PHPWord object unassigned."); throw new \Exception("PhpWord object unassigned.");
} }
} }
/** /**
* Get PHPWord object * @return PhpOffice\PhpWord
* * @throws \Exception
* @return PHPWord
* @throws Exception
*/ */
public function getPHPWord() public function getPhpWord()
{ {
if (!is_null($this->_document)) { if (!is_null($this->_document)) {
return $this->_document; return $this->_document;
} else { } else {
throw new Exception("No PHPWord assigned."); throw new \Exception("No PhpWord assigned.");
} }
} }
/** /**
* Get PHPWord object * @param PhpOffice\PhpWord $phpWord
*
* @param PHPWord $phpWord PHPWord object
* @throws Exception
* @return PhpOffice\PhpWord\Writer\ODText * @return PhpOffice\PhpWord\Writer\ODText
*/ */
public function setPHPWord(PHPWord $phpWord = null) public function setPhpWord(PhpWord $phpWord = null)
{ {
$this->_document = $phpWord; $this->_document = $phpWord;
return $this; return $this;
@ -237,8 +227,6 @@ class ODText implements IWriter
} }
/** /**
* Get writer part
*
* @param string $pPartName Writer part name * @param string $pPartName Writer part name
* @return PhpOffice\PhpWord\Writer\ODText\WriterPart * @return PhpOffice\PhpWord\Writer\ODText\WriterPart
*/ */
@ -266,7 +254,7 @@ class ODText implements IWriter
* *
* @param boolean $pValue * @param boolean $pValue
* @param string $pDirectory Disk caching directory * @param string $pDirectory Disk caching directory
* @throws Exception Exception when directory does not exist * @throws \Exception Exception when directory does not exist
* @return PhpOffice\PhpWord\Writer\ODText * @return PhpOffice\PhpWord\Writer\ODText
*/ */
public function setUseDiskCaching($pValue = false, $pDirectory = null) public function setUseDiskCaching($pValue = false, $pDirectory = null)
@ -277,7 +265,7 @@ class ODText implements IWriter
if (is_dir($pDirectory)) { if (is_dir($pDirectory)) {
$this->_diskCachingDirectory = $pDirectory; $this->_diskCachingDirectory = $pDirectory;
} else { } else {
throw new Exception("Directory does not exist: $pDirectory"); throw new \Exception("Directory does not exist: $pDirectory");
} }
} }
@ -285,8 +273,6 @@ class ODText implements IWriter
} }
/** /**
* Get disk caching directory
*
* @return string * @return string
*/ */
public function getDiskCachingDirectory() public function getDiskCachingDirectory()

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,15 +18,16 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
namespace PhpOffice\PhpWord\Writer\ODText; namespace PhpOffice\PhpWord\Writer\ODText;
use PhpOffice\PhpWord;
use PhpOffice\PhpWord\Section; use PhpOffice\PhpWord\Section;
use PhpOffice\PhpWord\Section\Image; use PhpOffice\PhpWord\Section\Image;
use PhpOffice\PhpWord\Section\Link; use PhpOffice\PhpWord\Section\Link;
@ -50,11 +51,11 @@ class Content extends WriterPart
/** /**
* Write content file to XML format * Write content file to XML format
* *
* @param PHPWord $phpWord * @param PhpOffice\PhpWord $phpWord
* @return string XML Output * @return string XML Output
* @throws Exception * @throws Exception
*/ */
public function writeContent(PHPWord $phpWord = null) public function writeContent(PhpWord $phpWord = null)
{ {
// Create XML writer // Create XML writer
$xmlWriter = null; $xmlWriter = null;
@ -162,10 +163,10 @@ class Content extends WriterPart
} }
} }
} }
if (!in_array(PHPWord::DEFAULT_FONT_NAME, $arrFonts)) { if (!in_array(PhpWord::DEFAULT_FONT_NAME, $arrFonts)) {
$xmlWriter->startElement('style:font-face'); $xmlWriter->startElement('style:font-face');
$xmlWriter->writeAttribute('style:name', PHPWord::DEFAULT_FONT_NAME); $xmlWriter->writeAttribute('style:name', PhpWord::DEFAULT_FONT_NAME);
$xmlWriter->writeAttribute('svg:font-family', PHPWord::DEFAULT_FONT_NAME); $xmlWriter->writeAttribute('svg:font-family', PhpWord::DEFAULT_FONT_NAME);
$xmlWriter->endElement(); $xmlWriter->endElement();
} }
} }
@ -325,7 +326,7 @@ class Content extends WriterPart
if ($SfIsObject) { if ($SfIsObject) {
// Don't never be the case, because I browse all sections for cleaning all styles not declared // Don't never be the case, because I browse all sections for cleaning all styles not declared
die('PHPWord : $SfIsObject wouldn\'t be an object'); die('PhpWord : $SfIsObject wouldn\'t be an object');
} else { } else {
if (!$withoutP) { if (!$withoutP) {
$xmlWriter->startElement('text:p'); // text:p $xmlWriter->startElement('text:p'); // text:p

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,15 +18,16 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
namespace PhpOffice\PhpWord\Writer\ODText; namespace PhpOffice\PhpWord\Writer\ODText;
use PhpOffice\PhpWord;
use PhpOffice\PhpWord\Shared\File; use PhpOffice\PhpWord\Shared\File;
use PhpOffice\PhpWord\Shared\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
@ -35,11 +36,11 @@ class Manifest extends WriterPart
/** /**
* Write Manifest file to XML format * Write Manifest file to XML format
* *
* @param PHPWord $phpWord * @param PhpOffice\PhpWord $phpWord
* @return string XML Output * @return string XML Output
* @throws Exception * @throws Exception
*/ */
public function writeManifest(PHPWord $phpWord = null) public function writeManifest(PhpWord $phpWord = null)
{ {
// Create XML writer // Create XML writer
$xmlWriter = null; $xmlWriter = null;

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,15 +18,16 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
namespace PhpOffice\PhpWord\Writer\ODText; namespace PhpOffice\PhpWord\Writer\ODText;
use PhpOffice\PhpWord;
use PhpOffice\PhpWord\Shared\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
class Meta extends WriterPart class Meta extends WriterPart
@ -34,11 +35,11 @@ class Meta extends WriterPart
/** /**
* Write Meta file to XML format * Write Meta file to XML format
* *
* @param PHPWord $phpWord * @param PhpOffice\PhpWord $phpWord
* @return string XML Output * @return string XML Output
* @throws Exception * @throws Exception
*/ */
public function writeMeta(PHPWord $phpWord = null) public function writeMeta(PhpWord $phpWord = null)
{ {
// Create XML writer // Create XML writer
$xmlWriter = null; $xmlWriter = null;
@ -65,25 +66,25 @@ class Meta extends WriterPart
$xmlWriter->startElement('office:meta'); $xmlWriter->startElement('office:meta');
// dc:creator // dc:creator
$xmlWriter->writeElement('dc:creator', $phpWord->getProperties()->getLastModifiedBy()); $xmlWriter->writeElement('dc:creator', $phpWord->getDocumentProperties()->getLastModifiedBy());
// dc:date // dc:date
$xmlWriter->writeElement('dc:date', gmdate('Y-m-d\TH:i:s.000', $phpWord->getProperties()->getModified())); $xmlWriter->writeElement('dc:date', gmdate('Y-m-d\TH:i:s.000', $phpWord->getDocumentProperties()->getModified()));
// dc:description // dc:description
$xmlWriter->writeElement('dc:description', $phpWord->getProperties()->getDescription()); $xmlWriter->writeElement('dc:description', $phpWord->getDocumentProperties()->getDescription());
// dc:subject // dc:subject
$xmlWriter->writeElement('dc:subject', $phpWord->getProperties()->getSubject()); $xmlWriter->writeElement('dc:subject', $phpWord->getDocumentProperties()->getSubject());
// dc:title // dc:title
$xmlWriter->writeElement('dc:title', $phpWord->getProperties()->getTitle()); $xmlWriter->writeElement('dc:title', $phpWord->getDocumentProperties()->getTitle());
// meta:creation-date // meta:creation-date
$xmlWriter->writeElement('meta:creation-date', gmdate('Y-m-d\TH:i:s.000', $phpWord->getProperties()->getCreated())); $xmlWriter->writeElement('meta:creation-date', gmdate('Y-m-d\TH:i:s.000', $phpWord->getDocumentProperties()->getCreated()));
// meta:initial-creator // meta:initial-creator
$xmlWriter->writeElement('meta:initial-creator', $phpWord->getProperties()->getCreator()); $xmlWriter->writeElement('meta:initial-creator', $phpWord->getDocumentProperties()->getCreator());
// meta:keyword // meta:keyword
$xmlWriter->writeElement('meta:keyword', $phpWord->getProperties()->getKeywords()); $xmlWriter->writeElement('meta:keyword', $phpWord->getDocumentProperties()->getKeywords());
// @todo : Where these properties are written ? // @todo : Where these properties are written ?
// $phpWord->getProperties()->getCategory() // $phpWord->getDocumentProperties()->getCategory()
// $phpWord->getProperties()->getCompany() // $phpWord->getDocumentProperties()->getCompany()
$xmlWriter->endElement(); $xmlWriter->endElement();

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,25 +18,27 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
namespace PhpOffice\PhpWord\Writer\ODText; namespace PhpOffice\PhpWord\Writer\ODText;
use PhpOffice\PhpWord;
class Mimetype extends WriterPart class Mimetype extends WriterPart
{ {
/** /**
* Write Mimetype to Text format * Write Mimetype to Text format
* *
* @param PHPWord $phpWord * @param PhpOffice\PhpWord $phpWord
* @return string Text Output * @return string Text Output
* @throws Exception * @throws Exception
*/ */
public function writeMimetype(PHPWord $phpWord = null) public function writeMimetype(PhpWord $phpWord = null)
{ {
return 'application/vnd.oasis.opendocument.text'; return 'application/vnd.oasis.opendocument.text';

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,15 +18,16 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
namespace PhpOffice\PhpWord\Writer\ODText; namespace PhpOffice\PhpWord\Writer\ODText;
use PhpOffice\PhpWord;
use PhpOffice\PhpWord\Shared\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\Style;
use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\Style\Font;
@ -38,11 +39,11 @@ class Styles extends WriterPart
/** /**
* Write Styles file to XML format * Write Styles file to XML format
* *
* @param PHPWord $phpWord * @param PhpOffice\PhpWord $phpWord
* @return string XML Output * @return string XML Output
* @throws Exception * @throws Exception
*/ */
public function writeStyles(PHPWord $phpWord = null) public function writeStyles(PhpWord $phpWord = null)
{ {
// Create XML writer // Create XML writer
$xmlWriter = null; $xmlWriter = null;
@ -109,10 +110,10 @@ class Styles extends WriterPart
} }
} }
} }
if (!in_array(PHPWord::DEFAULT_FONT_NAME, $arrFonts)) { if (!in_array(PhpWord::DEFAULT_FONT_NAME, $arrFonts)) {
$xmlWriter->startElement('style:font-face'); $xmlWriter->startElement('style:font-face');
$xmlWriter->writeAttribute('style:name', PHPWord::DEFAULT_FONT_NAME); $xmlWriter->writeAttribute('style:name', PhpWord::DEFAULT_FONT_NAME);
$xmlWriter->writeAttribute('svg:font-family', PHPWord::DEFAULT_FONT_NAME); $xmlWriter->writeAttribute('svg:font-family', PhpWord::DEFAULT_FONT_NAME);
$xmlWriter->endElement(); $xmlWriter->endElement();
} }
$xmlWriter->endElement(); $xmlWriter->endElement();
@ -137,17 +138,17 @@ class Styles extends WriterPart
// style:text-properties // style:text-properties
$xmlWriter->startElement('style:text-properties'); $xmlWriter->startElement('style:text-properties');
$xmlWriter->writeAttribute('style:use-window-font-color', 'true'); $xmlWriter->writeAttribute('style:use-window-font-color', 'true');
$xmlWriter->writeAttribute('style:font-name', PHPWord::DEFAULT_FONT_NAME); $xmlWriter->writeAttribute('style:font-name', PhpWord::DEFAULT_FONT_NAME);
$xmlWriter->writeAttribute('fo:font-size', PHPWord::DEFAULT_FONT_SIZE . 'pt'); $xmlWriter->writeAttribute('fo:font-size', PhpWord::DEFAULT_FONT_SIZE . 'pt');
$xmlWriter->writeAttribute('fo:language', 'fr'); $xmlWriter->writeAttribute('fo:language', 'fr');
$xmlWriter->writeAttribute('fo:country', 'FR'); $xmlWriter->writeAttribute('fo:country', 'FR');
$xmlWriter->writeAttribute('style:letter-kerning', 'true'); $xmlWriter->writeAttribute('style:letter-kerning', 'true');
$xmlWriter->writeAttribute('style:font-name-asian', PHPWord::DEFAULT_FONT_NAME . '2'); $xmlWriter->writeAttribute('style:font-name-asian', PhpWord::DEFAULT_FONT_NAME . '2');
$xmlWriter->writeAttribute('style:font-size-asian', PHPWord::DEFAULT_FONT_SIZE . 'pt'); $xmlWriter->writeAttribute('style:font-size-asian', PhpWord::DEFAULT_FONT_SIZE . 'pt');
$xmlWriter->writeAttribute('style:language-asian', 'zh'); $xmlWriter->writeAttribute('style:language-asian', 'zh');
$xmlWriter->writeAttribute('style:country-asian', 'CN'); $xmlWriter->writeAttribute('style:country-asian', 'CN');
$xmlWriter->writeAttribute('style:font-name-complex', PHPWord::DEFAULT_FONT_NAME . '2'); $xmlWriter->writeAttribute('style:font-name-complex', PhpWord::DEFAULT_FONT_NAME . '2');
$xmlWriter->writeAttribute('style:font-size-complex', PHPWord::DEFAULT_FONT_SIZE . 'pt'); $xmlWriter->writeAttribute('style:font-size-complex', PhpWord::DEFAULT_FONT_SIZE . 'pt');
$xmlWriter->writeAttribute('style:language-complex', 'hi'); $xmlWriter->writeAttribute('style:language-complex', 'hi');
$xmlWriter->writeAttribute('style:country-complex', 'IN'); $xmlWriter->writeAttribute('style:country-complex', 'IN');
$xmlWriter->writeAttribute('fo:hyphenate', 'false'); $xmlWriter->writeAttribute('fo:hyphenate', 'false');

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,15 +18,16 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
namespace PhpOffice\PhpWord\Writer; namespace PhpOffice\PhpWord\Writer;
use PhpOffice\PhpWord;
use PhpOffice\PhpWord\HashTable; use PhpOffice\PhpWord\HashTable;
use PhpOffice\PhpWord\Section\Image; use PhpOffice\PhpWord\Section\Image;
use PhpOffice\PhpWord\Section\Link; use PhpOffice\PhpWord\Section\Link;
@ -48,9 +49,9 @@ use PhpOffice\PhpWord\TOC;
class RTF implements IWriter class RTF implements IWriter
{ {
/** /**
* Private PHPWord * Private PhpWord
* *
* @var PHPWord * @var PhpOffice\PhpWord
*/ */
private $_document; private $_document;
@ -66,22 +67,22 @@ class RTF implements IWriter
private $_lastParagraphStyle; private $_lastParagraphStyle;
/** /**
* @param PHPWord $phpWord * @param PhpOffice\PhpWord $phpWord
*/ */
public function __construct(PHPWord $phpWord = null) public function __construct(PhpWord $phpWord = null)
{ {
// Assign PHPWord // Assign PhpWord
$this->setPHPWord($phpWord); $this->setPhpWord($phpWord);
// Set HashTable variables // Set HashTable variables
$this->_drawingHashTable = new HashTable(); $this->_drawingHashTable = new HashTable();
} }
/** /**
* Save PHPWord to file * Save PhpWord to file
* *
* @param string $pFileName * @param string $pFileName
* @throws Exception * @throws \Exception
*/ */
public function save($pFilename = null) public function save($pFilename = null)
{ {
@ -102,37 +103,35 @@ class RTF implements IWriter
// If a temporary file was used, copy it to the correct file stream // If a temporary file was used, copy it to the correct file stream
if ($originalFilename != $pFilename) { if ($originalFilename != $pFilename) {
if (copy($pFilename, $originalFilename) === false) { if (copy($pFilename, $originalFilename) === false) {
throw new Exception("Could not copy temporary zip file $pFilename to $originalFilename."); throw new \Exception("Could not copy temporary zip file $pFilename to $originalFilename.");
} }
@unlink($pFilename); @unlink($pFilename);
} }
} else { } else {
throw new Exception("PHPWord object unassigned."); throw new \Exception("PhpWord object unassigned.");
} }
} }
/** /**
* Get PHPWord object * @return PhpOffice\PhpWord
* * @throws \Exception
* @return PHPWord
* @throws Exception
*/ */
public function getPHPWord() public function getPhpWord()
{ {
if (!is_null($this->_document)) { if (!is_null($this->_document)) {
return $this->_document; return $this->_document;
} else { } else {
throw new Exception("No PHPWord assigned."); throw new \Exception("No PhpWord assigned.");
} }
} }
/** /**
* @param PHPWord $phpWord PHPWord object * @param PhpOffice\PhpWord $phpWord
* @throws Exception * @throws \Exception
* @return PhpOffice\PhpWord\Writer\RTF * @return PhpOffice\PhpWord\Writer\RTF
*/ */
public function setPHPWord(PHPWord $phpWord = null) public function setPhpWord(PhpWord $phpWord = null)
{ {
$this->_document = $phpWord; $this->_document = $phpWord;
return $this; return $this;
@ -150,7 +149,7 @@ class RTF implements IWriter
private function getData() private function getData()
{ {
// PHPWord object : $this->_document // PhpWord object : $this->_document
$this->_fontTable = $this->getDataFont(); $this->_fontTable = $this->getDataFont();
$this->_colorTable = $this->getDataColor(); $this->_colorTable = $this->getDataColor();
@ -176,7 +175,7 @@ class RTF implements IWriter
} }
$sRTFContent .= ';}' . PHP_EOL; $sRTFContent .= ';}' . PHP_EOL;
// Set the generator // Set the generator
$sRTFContent .= '{\*\generator PHPWord;}' . PHP_EOL; $sRTFContent .= '{\*\generator PhpWord;}' . PHP_EOL;
// Set the view mode of the document // Set the view mode of the document
$sRTFContent .= '\viewkind4'; $sRTFContent .= '\viewkind4';
// Set the numberof bytes that follows a unicode character // Set the numberof bytes that follows a unicode character
@ -190,7 +189,7 @@ class RTF implements IWriter
// Point size (in half-points) above which to kern character pairs // Point size (in half-points) above which to kern character pairs
$sRTFContent .= '\kerning1'; $sRTFContent .= '\kerning1';
// Set the font size in half-points // Set the font size in half-points
$sRTFContent .= '\fs' . (PHPWord::DEFAULT_FONT_SIZE * 2); $sRTFContent .= '\fs' . (PhpWord::DEFAULT_FONT_SIZE * 2);
$sRTFContent .= PHP_EOL; $sRTFContent .= PHP_EOL;
// Body // Body
$sRTFContent .= $this->getDataContent(); $sRTFContent .= $this->getDataContent();
@ -206,9 +205,9 @@ class RTF implements IWriter
$phpWord = $this->_document; $phpWord = $this->_document;
$arrFonts = array(); $arrFonts = array();
// Default font : PHPWord::DEFAULT_FONT_NAME // Default font : PhpWord::DEFAULT_FONT_NAME
$arrFonts[] = PHPWord::DEFAULT_FONT_NAME; $arrFonts[] = PhpWord::DEFAULT_FONT_NAME;
// PHPWord object : $this->_document // PhpWord object : $this->_document
// Browse styles // Browse styles
$styles = Style::getStyles(); $styles = Style::getStyles();
@ -256,7 +255,7 @@ class RTF implements IWriter
$phpWord = $this->_document; $phpWord = $this->_document;
$arrColors = array(); $arrColors = array();
// PHPWord object : $this->_document // PhpWord object : $this->_document
// Browse styles // Browse styles
$styles = Style::getStyles(); $styles = Style::getStyles();
@ -267,10 +266,10 @@ class RTF implements IWriter
if ($style instanceof Font) { if ($style instanceof Font) {
$color = $style->getColor(); $color = $style->getColor();
$fgcolor = $style->getFgColor(); $fgcolor = $style->getFgColor();
if (in_array($color, $arrColors) == false && $color != PHPWord::DEFAULT_FONT_COLOR && !empty($color)) { if (in_array($color, $arrColors) == false && $color != PhpWord::DEFAULT_FONT_COLOR && !empty($color)) {
$arrColors[] = $color; $arrColors[] = $color;
} }
if (in_array($fgcolor, $arrColors) == false && $fgcolor != PHPWord::DEFAULT_FONT_COLOR && !empty($fgcolor)) { if (in_array($fgcolor, $arrColors) == false && $fgcolor != PhpWord::DEFAULT_FONT_COLOR && !empty($fgcolor)) {
$arrColors[] = $fgcolor; $arrColors[] = $fgcolor;
} }
} }
@ -353,9 +352,6 @@ class RTF implements IWriter
return $sRTFBody; return $sRTFBody;
} }
/**
* Get text
*/
private function getDataContentText(Text $text, $withoutP = false) private function getDataContentText(Text $text, $withoutP = false)
{ {
$sRTFText = ''; $sRTFText = '';
@ -434,7 +430,7 @@ class RTF implements IWriter
$sRTFText .= '\i0'; $sRTFText .= '\i0';
} }
if ($styleFont->getSize()) { if ($styleFont->getSize()) {
$sRTFText .= '\fs' . (PHPWord::DEFAULT_FONT_SIZE * 2); $sRTFText .= '\fs' . (PhpWord::DEFAULT_FONT_SIZE * 2);
} }
} }
@ -444,9 +440,6 @@ class RTF implements IWriter
return $sRTFText; return $sRTFText;
} }
/**
* Get text run content
*/
private function getDataContentTextRun(TextRun $textrun) private function getDataContentTextRun(TextRun $textrun)
{ {
$sRTFText = ''; $sRTFText = '';

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,15 +18,16 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
namespace PhpOffice\PhpWord\Writer; namespace PhpOffice\PhpWord\Writer;
use PhpOffice\PhpWord;
use PhpOffice\PhpWord\Footnote; use PhpOffice\PhpWord\Footnote;
use PhpOffice\PhpWord\Media; use PhpOffice\PhpWord\Media;
use PhpOffice\PhpWord\Writer\Word2007\ContentTypes; use PhpOffice\PhpWord\Writer\Word2007\ContentTypes;
@ -49,9 +50,9 @@ class Word2007 implements IWriter
private $_imageTypes = array(); private $_imageTypes = array();
private $_objectTypes = array(); private $_objectTypes = array();
public function __construct(PHPWord $PHPWord = null) public function __construct(PhpWord $phpWord = null)
{ {
$this->_document = $PHPWord; $this->_document = $phpWord;
$this->_diskCachingDirectory = './'; $this->_diskCachingDirectory = './';
@ -187,11 +188,11 @@ class Word2007 implements IWriter
$objZip->addFromString('word/styles.xml', $this->getWriterPart('styles')->writeStyles($this->_document)); $objZip->addFromString('word/styles.xml', $this->getWriterPart('styles')->writeStyles($this->_document));
// Write static files // Write static files
$objZip->addFile(PHPWORD_BASE_PATH . 'PHPWord/_staticDocParts/numbering.xml', 'word/numbering.xml'); $objZip->addFile(PHPWORD_BASE_PATH . 'PhpWord/_staticDocParts/numbering.xml', 'word/numbering.xml');
$objZip->addFile(PHPWORD_BASE_PATH . 'PHPWord/_staticDocParts/settings.xml', 'word/settings.xml'); $objZip->addFile(PHPWORD_BASE_PATH . 'PhpWord/_staticDocParts/settings.xml', 'word/settings.xml');
$objZip->addFile(PHPWORD_BASE_PATH . 'PHPWord/_staticDocParts/theme1.xml', 'word/theme/theme1.xml'); $objZip->addFile(PHPWORD_BASE_PATH . 'PhpWord/_staticDocParts/theme1.xml', 'word/theme/theme1.xml');
$objZip->addFile(PHPWORD_BASE_PATH . 'PHPWord/_staticDocParts/webSettings.xml', 'word/webSettings.xml'); $objZip->addFile(PHPWORD_BASE_PATH . 'PhpWord/_staticDocParts/webSettings.xml', 'word/webSettings.xml');
$objZip->addFile(PHPWORD_BASE_PATH . 'PHPWord/_staticDocParts/fontTable.xml', 'word/fontTable.xml'); $objZip->addFile(PHPWORD_BASE_PATH . 'PhpWord/_staticDocParts/fontTable.xml', 'word/fontTable.xml');
// Close file // Close file
@ -207,7 +208,7 @@ class Word2007 implements IWriter
@unlink($pFilename); @unlink($pFilename);
} }
} else { } else {
throw new Exception("PHPWord object unassigned."); throw new Exception("PhpWord object unassigned.");
} }
} }

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,15 +18,16 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
namespace PhpOffice\PhpWord\Writer\Word2007; namespace PhpOffice\PhpWord\Writer\Word2007;
use PhpOffice\PhpWord;
use PhpOffice\PhpWord\Section\Footer\PreserveText; use PhpOffice\PhpWord\Section\Footer\PreserveText;
use PhpOffice\PhpWord\Section\Footnote; use PhpOffice\PhpWord\Section\Footnote;
use PhpOffice\PhpWord\Section\Image; use PhpOffice\PhpWord\Section\Image;
@ -402,14 +403,14 @@ class Base extends WriterPart
$xmlWriter->startElement('w:rPr'); $xmlWriter->startElement('w:rPr');
// Font // Font
if ($font != PHPWord::DEFAULT_FONT_NAME) { if ($font != PhpWord::DEFAULT_FONT_NAME) {
$xmlWriter->startElement('w:rFonts'); $xmlWriter->startElement('w:rFonts');
$xmlWriter->writeAttribute('w:ascii', $font); $xmlWriter->writeAttribute('w:ascii', $font);
$xmlWriter->writeAttribute('w:hAnsi', $font); $xmlWriter->writeAttribute('w:hAnsi', $font);
$xmlWriter->writeAttribute('w:eastAsia', $font); $xmlWriter->writeAttribute('w:eastAsia', $font);
$xmlWriter->writeAttribute('w:cs', $font); $xmlWriter->writeAttribute('w:cs', $font);
//Font Content Type //Font Content Type
if ($hint != PHPWord::DEFAULT_FONT_CONTENT_TYPE) { if ($hint != PhpWord::DEFAULT_FONT_CONTENT_TYPE) {
$xmlWriter->writeAttribute('w:hint', $hint); $xmlWriter->writeAttribute('w:hint', $hint);
} }
$xmlWriter->endElement(); $xmlWriter->endElement();
@ -417,14 +418,14 @@ class Base extends WriterPart
// Color // Color
if ($color != PHPWord::DEFAULT_FONT_COLOR) { if ($color != PhpWord::DEFAULT_FONT_COLOR) {
$xmlWriter->startElement('w:color'); $xmlWriter->startElement('w:color');
$xmlWriter->writeAttribute('w:val', $color); $xmlWriter->writeAttribute('w:val', $color);
$xmlWriter->endElement(); $xmlWriter->endElement();
} }
// Size // Size
if ($size != PHPWord::DEFAULT_FONT_SIZE) { if ($size != PhpWord::DEFAULT_FONT_SIZE) {
$xmlWriter->startElement('w:sz'); $xmlWriter->startElement('w:sz');
$xmlWriter->writeAttribute('w:val', $size * 2); $xmlWriter->writeAttribute('w:val', $size * 2);
$xmlWriter->endElement(); $xmlWriter->endElement();

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,20 +18,21 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
namespace PhpOffice\PhpWord\Writer\Word2007; namespace PhpOffice\PhpWord\Writer\Word2007;
use PhpOffice\PhpWord;
use PhpOffice\PhpWord\Shared\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
class DocProps extends WriterPart class DocProps extends WriterPart
{ {
public function writeDocPropsApp(PHPWord $phpWord = null) public function writeDocPropsApp(PhpWord $phpWord = null)
{ {
// Create XML writer // Create XML writer
$xmlWriter = null; $xmlWriter = null;
@ -102,7 +103,7 @@ class DocProps extends WriterPart
$xmlWriter->endElement(); $xmlWriter->endElement();
// Company // Company
$xmlWriter->writeElement('Company', $phpWord->getProperties()->getCompany()); $xmlWriter->writeElement('Company', $phpWord->getDocumentProperties()->getCompany());
// LinksUpToDate // LinksUpToDate
$xmlWriter->writeElement('LinksUpToDate', 'false'); $xmlWriter->writeElement('LinksUpToDate', 'false');
@ -123,7 +124,7 @@ class DocProps extends WriterPart
} }
public function writeDocPropsCore(PHPWord $phpWord = null) public function writeDocPropsCore(PhpWord $phpWord = null)
{ {
// Create XML writer // Create XML writer
$xmlWriter = null; $xmlWriter = null;
@ -145,37 +146,37 @@ class DocProps extends WriterPart
$xmlWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance'); $xmlWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
// dc:creator // dc:creator
$xmlWriter->writeElement('dc:creator', $phpWord->getProperties()->getCreator()); $xmlWriter->writeElement('dc:creator', $phpWord->getDocumentProperties()->getCreator());
// cp:lastModifiedBy // cp:lastModifiedBy
$xmlWriter->writeElement('cp:lastModifiedBy', $phpWord->getProperties()->getLastModifiedBy()); $xmlWriter->writeElement('cp:lastModifiedBy', $phpWord->getDocumentProperties()->getLastModifiedBy());
// dcterms:created // dcterms:created
$xmlWriter->startElement('dcterms:created'); $xmlWriter->startElement('dcterms:created');
$xmlWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF'); $xmlWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
$xmlWriter->writeRaw(date(DATE_W3C, $phpWord->getProperties()->getCreated())); $xmlWriter->writeRaw(date(DATE_W3C, $phpWord->getDocumentProperties()->getCreated()));
$xmlWriter->endElement(); $xmlWriter->endElement();
// dcterms:modified // dcterms:modified
$xmlWriter->startElement('dcterms:modified'); $xmlWriter->startElement('dcterms:modified');
$xmlWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF'); $xmlWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
$xmlWriter->writeRaw(date(DATE_W3C, $phpWord->getProperties()->getModified())); $xmlWriter->writeRaw(date(DATE_W3C, $phpWord->getDocumentProperties()->getModified()));
$xmlWriter->endElement(); $xmlWriter->endElement();
// dc:title // dc:title
$xmlWriter->writeElement('dc:title', $phpWord->getProperties()->getTitle()); $xmlWriter->writeElement('dc:title', $phpWord->getDocumentProperties()->getTitle());
// dc:description // dc:description
$xmlWriter->writeElement('dc:description', $phpWord->getProperties()->getDescription()); $xmlWriter->writeElement('dc:description', $phpWord->getDocumentProperties()->getDescription());
// dc:subject // dc:subject
$xmlWriter->writeElement('dc:subject', $phpWord->getProperties()->getSubject()); $xmlWriter->writeElement('dc:subject', $phpWord->getDocumentProperties()->getSubject());
// cp:keywords // cp:keywords
$xmlWriter->writeElement('cp:keywords', $phpWord->getProperties()->getKeywords()); $xmlWriter->writeElement('cp:keywords', $phpWord->getDocumentProperties()->getKeywords());
// cp:category // cp:category
$xmlWriter->writeElement('cp:category', $phpWord->getProperties()->getCategory()); $xmlWriter->writeElement('cp:category', $phpWord->getDocumentProperties()->getCategory());
$xmlWriter->endElement(); $xmlWriter->endElement();

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,15 +18,16 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
namespace PhpOffice\PhpWord\Writer\Word2007; namespace PhpOffice\PhpWord\Writer\Word2007;
use PhpOffice\PhpWord;
use PhpOffice\PhpWord\Section\Footnote; use PhpOffice\PhpWord\Section\Footnote;
use PhpOffice\PhpWord\Section\Image; use PhpOffice\PhpWord\Section\Image;
use PhpOffice\PhpWord\Section\Link; use PhpOffice\PhpWord\Section\Link;
@ -46,7 +47,7 @@ use PhpOffice\PhpWord\TOC;
class Document extends Base class Document extends Base
{ {
public function writeDocument(PHPWord $phpWord = null) public function writeDocument(PhpWord $phpWord = null)
{ {
// Create XML writer // Create XML writer
if ($this->getParentWriter()->getUseDiskCaching()) { if ($this->getParentWriter()->getUseDiskCaching()) {

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,20 +18,21 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
namespace PhpOffice\PhpWord\Writer\Word2007; namespace PhpOffice\PhpWord\Writer\Word2007;
use PhpOffice\PhpWord;
use PhpOffice\PhpWord\Shared\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
class Rels extends WriterPart class Rels extends WriterPart
{ {
public function writeRelationships(PHPWord $phpWord = null) public function writeRelationships(PhpWord $phpWord = null)
{ {
// Create XML writer // Create XML writer
$xmlWriter = null; $xmlWriter = null;

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,15 +18,16 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */
namespace PhpOffice\PhpWord\Writer\Word2007; namespace PhpOffice\PhpWord\Writer\Word2007;
use PhpOffice\PhpWord;
use PhpOffice\PhpWord\Shared\XMLWriter; use PhpOffice\PhpWord\Shared\XMLWriter;
use PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\Style;
use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\Style\Font;
@ -37,7 +38,7 @@ class Styles extends Base
{ {
private $_document; private $_document;
public function writeStyles(PHPWord $phpWord = null) public function writeStyles(PhpWord $phpWord = null)
{ {
// Create XML writer // Create XML writer
$xmlWriter = null; $xmlWriter = null;

View File

@ -1,8 +1,8 @@
<?php <?php
/** /**
* PHPWord * PhpWord
* *
* Copyright (c) 2014 PHPWord * Copyright (c) 2014 PhpWord
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public
@ -18,9 +18,9 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* *
* @category PHPWord * @category PhpWord
* @package PHPWord * @package PhpWord
* @copyright Copyright (c) 2014 PHPWord * @copyright Copyright (c) 2014 PhpWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 0.8.0 * @version 0.8.0
*/ */

View File

@ -1,15 +1,15 @@
# PHPWord # PhpWord
[![Build Status](https://travis-ci.org/PHPOffice/PHPWord.png?branch=master)](https://travis-ci.org/PHPOffice/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) [![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.__ __OpenXML - Read, Write and Create Word documents in PHP.__
PHPWord is a library written in pure PHP and providing a set of classes that allow you to write to and read from different document file formats, like Word (.docx), WordPad (.rtf), Libre/OpenOffice Writer (.odt). PhpWord is a library written in pure PHP and providing a set of classes that allow you to write to and read from different document file formats, like Word (.docx), WordPad (.rtf), Libre/OpenOffice Writer (.odt).
No Windows operating system is needed for usage because the resulting DOCX, ODT, or RTF files can be opened by all major [word processing softwares](http://en.wikipedia.org/wiki/List_of_word_processors). No Windows operating system is needed for usage because the resulting DOCX, ODT, or RTF files can be opened by all major [word processing softwares](http://en.wikipedia.org/wiki/List_of_word_processors).
PHPWord is an open source project licensed under [LGPL](license.md). PHPWord is unit tested to make sure that the released versions are stable. PhpWord is an open source project licensed under [LGPL](license.md). PhpWord is unit tested to make sure that the released versions are stable.
__Want to contribute?__ Fork us! __Want to contribute?__ Fork us!
@ -45,7 +45,7 @@ __Want to contribute?__ Fork us!
## Installation ## Installation
It is recommended that you install the PHPWord library [through composer](http://getcomposer.org/). To do so, add It is recommended that you install the PhpWord library [through composer](http://getcomposer.org/). To do so, add
the following lines to your ``composer.json``. the following lines to your ``composer.json``.
```json ```json
@ -58,7 +58,7 @@ the following lines to your ``composer.json``.
## Documentation ## Documentation
We're reorganizing our documentation. Below are some of the most important things that you needed to get PHPWord creates document for you in no time. We're reorganizing our documentation. Below are some of the most important things that you needed to get PhpWord creates document for you in no time.
### Table of contents ### Table of contents
@ -79,14 +79,14 @@ We're reorganizing our documentation. Below are some of the most important thing
<a name="basic-usage"></a> <a name="basic-usage"></a>
#### Basic usage #### Basic usage
The following is a basic example of the PHPWord library. More examples are provided in the [samples folder](samples/). The following is a basic example of the PhpWord library. More examples are provided in the [samples folder](samples/).
```php ```php
$PHPWord = new PHPWord(); $phpWord = new PhpOffice\PhpWord();
// Every element you want to append to the word document is placed in a section. // Every element you want to append to the word document is placed in a section.
// To create a basic section: // To create a basic section:
$section = $PHPWord->createSection(); $section = $phpWord->createSection();
// After creating a section, you can append elements: // After creating a section, you can append elements:
$section->addText('Hello world!'); $section->addText('Hello world!');
@ -97,7 +97,7 @@ $section->addText('Hello world! I am formatted.',
// If you often need the same style again you can create a user defined style // If you often need the same style again you can create a user defined style
// to the word document and give the addText function the name of the style: // to the word document and give the addText function the name of the style:
$PHPWord->addFontStyle('myOwnStyle', $phpWord->addFontStyle('myOwnStyle',
array('name'=>'Verdana', 'size'=>14, 'color'=>'1B2232')); array('name'=>'Verdana', 'size'=>14, 'color'=>'1B2232'));
$section->addText('Hello world! I am formatted by a user defined style', $section->addText('Hello world! I am formatted by a user defined style',
'myOwnStyle'); 'myOwnStyle');
@ -111,7 +111,7 @@ $myTextElement = $section->addText('Hello World!');
$myTextElement->setFontStyle($fontStyle); $myTextElement->setFontStyle($fontStyle);
// Finally, write the document: // Finally, write the document:
$xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($PHPWord, 'Word2007'); $xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$xmlWriter->save('helloWorld.docx'); $xmlWriter->save('helloWorld.docx');
``` ```
@ -120,15 +120,15 @@ $xmlWriter->save('helloWorld.docx');
The base length unit in Open Office XML is twip. Twip means "TWentieth of an Inch Point", i.e. 1 twip = 1/1440 inch. The base length unit in Open Office XML is twip. Twip means "TWentieth of an Inch Point", i.e. 1 twip = 1/1440 inch.
You can use PHPWord helper functions to convert inches, centimeters, or points to twips. You can use PhpWord helper functions to convert inches, centimeters, or points to twips.
```php ```php
// Paragraph with 6 points space after // Paragraph with 6 points space after
$PHPWord->addParagraphStyle('My Style', array( $phpWord->addParagraphStyle('My Style', array(
'spaceAfter' => PhpOffice\PhpWord\Shared\Font::pointSizeToTwips(6)) 'spaceAfter' => PhpOffice\PhpWord\Shared\Font::pointSizeToTwips(6))
); );
$section = $PHPWord->createSection(); $section = $phpWord->createSection();
$sectionStyle = $section->getSettings(); $sectionStyle = $section->getSettings();
// half inch left margin // half inch left margin
$sectionStyle->setMarginLeft(PhpOffice\PhpWord\Shared\Font::inchSizeToTwips(.5)); $sectionStyle->setMarginLeft(PhpOffice\PhpWord\Shared\Font::inchSizeToTwips(.5));
@ -142,7 +142,7 @@ $sectionStyle->setMarginRight(PhpOffice\PhpWord\Shared\Font::centimeterSizeToTwi
Every visible element in word is placed inside of a section. To create a section, use the following code: Every visible element in word is placed inside of a section. To create a section, use the following code:
```php ```php
$section = $PHPWord->createSection($sectionSettings); $section = $phpWord->createSection($sectionSettings);
``` ```
The `$sectionSettings` is an optional associative array that sets the section. Example: The `$sectionSettings` is an optional associative array that sets the section. Example:
@ -188,7 +188,7 @@ The following two settings are automatically set by the use of the `orientation`
You can change a section page numbering. You can change a section page numbering.
```php ```php
$section = $PHPWord->createSection(); $section = $phpWord->createSection();
$section->getSettings()->setPageNumberingStart(1); $section->getSettings()->setPageNumberingStart(1);
``` ```
@ -271,7 +271,7 @@ $cell->getStyle()->setGridSpan(5);
You can add images easily using the following example. You can add images easily using the following example.
```php ```php
$section = $PHPWord->createSection(); $section = $phpWord->createSection();
$section->addImage('mars.jpg'); $section->addImage('mars.jpg');
``` ```

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests; namespace PhpWord\Tests;
use PHPWord_Autoloader; use PHPWord_Autoloader;
use PHPWord_Autoloader as Autoloader; use PHPWord_Autoloader as Autoloader;
@ -17,11 +17,11 @@ class AutoloaderTest extends \PHPUnit_Framework_TestCase
{ {
$this->assertNull( $this->assertNull(
PHPWord_Autoloader::load('Foo'), PHPWord_Autoloader::load('Foo'),
'PHPWord_Autoloader::load() is trying to load classes outside of the PHPWord namespace' 'PHPWord_Autoloader::load() is trying to load classes outside of the PhpWord namespace'
); );
$this->assertTrue( $this->assertTrue(
PHPWord_Autoloader::load('PHPWord'), PHPWord_Autoloader::load('PhpWord'),
'PHPWord_Autoloader::load() failed to autoload the PHPWord class' 'PHPWord_Autoloader::load() failed to autoload the PhpWord class'
); );
} }
@ -36,7 +36,7 @@ class AutoloaderTest extends \PHPUnit_Framework_TestCase
'PhpOffice\\PhpWord\\Autoloader::autoload() is trying to load classes ' . 'PhpOffice\\PhpWord\\Autoloader::autoload() is trying to load classes ' .
'outside of the PhpOffice\\PhpWord namespace' 'outside of the PhpOffice\\PhpWord namespace'
); );
// TODO change this class to the main PHPWord class when it is namespaced // TODO change this class to the main PhpWord class when it is namespaced
Autoloader::autoload( Autoloader::autoload(
'PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException' 'PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException'
); );

View File

@ -1,10 +1,10 @@
<?php <?php
namespace PHPWord\Tests; namespace PhpWord\Tests;
use PhpOffice\PhpWord\DocumentProperties; use PhpOffice\PhpWord\DocumentProperties;
/** /**
* @package PHPWord\Tests * @package PhpWord\Tests
* @coversDefaultClass PhpOffice\PhpWord\DocumentProperties * @coversDefaultClass PhpOffice\PhpWord\DocumentProperties
* @runTestsInSeparateProcesses * @runTestsInSeparateProcesses
*/ */

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Exceptions; namespace PhpWord\Tests\Exceptions;
use PhpOffice\PhpWord\Exceptions\Exception; use PhpOffice\PhpWord\Exceptions\Exception;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Exceptions; namespace PhpWord\Tests\Exceptions;
use PhpOffice\PhpWord\Exceptions\InvalidImageException; use PhpOffice\PhpWord\Exceptions\InvalidImageException;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Exceptions; namespace PhpWord\Tests\Exceptions;
use PhpOffice\PhpWord\Exceptions\InvalidStyleException; use PhpOffice\PhpWord\Exceptions\InvalidStyleException;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Exceptions; namespace PhpWord\Tests\Exceptions;
use PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException; use PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException;

View File

@ -1,12 +1,12 @@
<?php <?php
namespace PHPWord\Tests; namespace PhpWord\Tests;
use PhpOffice\PHPWord; use PhpOffice\PhpWord;
use PhpOffice\PhpWord\IOFactory; use PhpOffice\PhpWord\IOFactory;
/** /**
* @@coversDefaultClass PhpOffice\PhpWord\IOFactory * @@coversDefaultClass PhpOffice\PhpWord\IOFactory
* @package PHPWord\Tests * @package PhpWord\Tests
* @runTestsInSeparateProcesses * @runTestsInSeparateProcesses
*/ */
final class IOFactoryTest extends \PHPUnit_Framework_TestCase final class IOFactoryTest extends \PHPUnit_Framework_TestCase
@ -18,7 +18,7 @@ final class IOFactoryTest extends \PHPUnit_Framework_TestCase
{ {
$this->assertInstanceOf( $this->assertInstanceOf(
'PhpOffice\\PhpWord\\Writer\\Word2007', 'PhpOffice\\PhpWord\\Writer\\Word2007',
IOFactory::createWriter(new PHPWord(), 'Word2007') IOFactory::createWriter(new PhpWord(), 'Word2007')
); );
} }
@ -29,7 +29,7 @@ final class IOFactoryTest extends \PHPUnit_Framework_TestCase
*/ */
final public function testNonexistentWriterCanNotBeCreated() final public function testNonexistentWriterCanNotBeCreated()
{ {
IOFactory::createWriter(new PHPWord(), 'Word2006'); IOFactory::createWriter(new PhpWord(), 'Word2006');
} }
/** /**

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests; namespace PhpWord\Tests;
use PhpOffice\PhpWord\Media; use PhpOffice\PhpWord\Media;
use PhpOffice\PhpWord\Section; use PhpOffice\PhpWord\Section;

View File

@ -1,11 +1,11 @@
<?php <?php
namespace PHPWord\Tests\Reader; namespace PhpWord\Tests\Reader;
use PhpOffice\PhpWord\Reader\Word2007; use PhpOffice\PhpWord\Reader\Word2007;
use PhpOffice\PhpWord\IOFactory; use PhpOffice\PhpWord\IOFactory;
/** /**
* @package PHPWord\Tests * @package PhpWord\Tests
*/ */
class Word2007Test extends \PHPUnit_Framework_TestCase class Word2007Test extends \PHPUnit_Framework_TestCase
{ {
@ -61,6 +61,6 @@ class Word2007Test extends \PHPUnit_Framework_TestCase
); );
$file = $dir . DIRECTORY_SEPARATOR . 'reader.docx'; $file = $dir . DIRECTORY_SEPARATOR . 'reader.docx';
$object = IOFactory::load($file); $object = IOFactory::load($file);
$this->assertInstanceOf('PhpOffice\\PHPWord', $object); $this->assertInstanceOf('PhpOffice\\PhpWord', $object);
} }
} }

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Section\Footer; namespace PhpWord\Tests\Section\Footer;
use PhpOffice\PhpWord\Section\Footer\PreserveText; use PhpOffice\PhpWord\Section\Footer\PreserveText;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Section; namespace PhpWord\Tests\Section;
use PhpOffice\PhpWord\Section\Footer; use PhpOffice\PhpWord\Section\Footer;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Section; namespace PhpWord\Tests\Section;
use PhpOffice\PhpWord\Section\Footnote; use PhpOffice\PhpWord\Section\Footnote;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Section; namespace PhpWord\Tests\Section;
use PhpOffice\PhpWord\Section\Header; use PhpOffice\PhpWord\Section\Header;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Section; namespace PhpWord\Tests\Section;
use PhpOffice\PhpWord\Section\Image; use PhpOffice\PhpWord\Section\Image;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Section; namespace PhpWord\Tests\Section;
use PhpOffice\PhpWord\Section\Link; use PhpOffice\PhpWord\Section\Link;
use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\Style\Font;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Section; namespace PhpWord\Tests\Section;
use PhpOffice\PhpWord\Section\ListItem; use PhpOffice\PhpWord\Section\ListItem;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Section; namespace PhpWord\Tests\Section;
use PhpOffice\PhpWord\Section\MemoryImage; use PhpOffice\PhpWord\Section\MemoryImage;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Section; namespace PhpWord\Tests\Section;
use PhpOffice\PhpWord\Section\Object; use PhpOffice\PhpWord\Section\Object;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Section; namespace PhpWord\Tests\Section;
use PhpOffice\PhpWord\Section\PageBreak; use PhpOffice\PhpWord\Section\PageBreak;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Section; namespace PhpWord\Tests\Section;
use PhpOffice\PhpWord\Section\Settings; use PhpOffice\PhpWord\Section\Settings;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Section\Table; namespace PhpWord\Tests\Section\Table;
use PhpOffice\PhpWord\Section\Table\Cell; use PhpOffice\PhpWord\Section\Table\Cell;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Section\Table; namespace PhpWord\Tests\Section\Table;
use PhpOffice\PhpWord\Section\Table\Row; use PhpOffice\PhpWord\Section\Table\Row;

View File

@ -1,5 +1,5 @@
<?php <?php
namespace PHPWord\Tests\Section; namespace PhpWord\Tests\Section;
use PhpOffice\PhpWord\Section\Table; use PhpOffice\PhpWord\Section\Table;

View File

@ -1,12 +1,12 @@
<?php <?php
namespace PHPWord\Tests\Section; namespace PhpWord\Tests\Section;
use PhpOffice\PhpWord\Section\TextBreak; use PhpOffice\PhpWord\Section\TextBreak;
use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\Style\Font;
use PhpOffice\PhpWord\Style\Paragraph; use PhpOffice\PhpWord\Style\Paragraph;
/** /**
* @package PHPWord\Tests * @package PhpWord\Tests
* @coversDefaultClass PhpOffice\PhpWord\Section\TextBreak * @coversDefaultClass PhpOffice\PhpWord\Section\TextBreak
* @runTestsInSeparateProcesses * @runTestsInSeparateProcesses
*/ */

Some files were not shown because too many files have changed in this diff Show More