https://github.com/PHPOffice/PHPWord/issues/58 - Part VI (PhpWord).
This commit is contained in:
parent
32ed6a3b19
commit
8267a9e12f
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
@ -28,6 +28,7 @@
|
|||
namespace PhpOffice;
|
||||
|
||||
use PhpOffice\PhpWord\DocumentProperties;
|
||||
use PhpOffice\PhpWord\Exceptions\Exception;
|
||||
use PhpOffice\PhpWord\Section;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
use PhpOffice\PhpWord\Template;
|
||||
|
|
@ -36,114 +37,83 @@ use PhpOffice\PhpWord\Template;
|
|||
// @codeCoverageIgnoreStart
|
||||
if (!defined('PHPWORD_BASE_PATH')) {
|
||||
define('PHPWORD_BASE_PATH', dirname(__FILE__) . '/');
|
||||
require PHPWORD_BASE_PATH . 'PHPWord/Autoloader.php';
|
||||
require PHPWORD_BASE_PATH . 'PhpWord/Autoloader.php';
|
||||
PHPWord_Autoloader::Register();
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
|
||||
use PhpOffice\PhpWord\Exceptions\Exception;
|
||||
|
||||
class PhpWord
|
||||
{
|
||||
const DEFAULT_FONT_COLOR = '000000'; // HEX
|
||||
const DEFAULT_FONT_CONTENT_TYPE = 'default'; // default|eastAsia|cs
|
||||
const DEFAULT_FONT_NAME = 'Arial';
|
||||
/**
|
||||
* Default font name (Arial)
|
||||
*/
|
||||
const DEFAULT_FONT_NAME = 'Arial';
|
||||
/**
|
||||
* Default Font Content Type(default)
|
||||
* default|eastAsia|cs
|
||||
*/
|
||||
const DEFAULT_FONT_CONTENT_TYPE='default';
|
||||
/**
|
||||
* Default font size in points (10pt)
|
||||
* Default font size, in points.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
const DEFAULT_FONT_SIZE = 10;
|
||||
|
||||
/**
|
||||
* Default font color (black)
|
||||
*/
|
||||
const DEFAULT_FONT_COLOR = '000000';
|
||||
|
||||
/**
|
||||
* Document properties
|
||||
*
|
||||
* @var PhpOffice\PhpWord\DocumentProperties
|
||||
*/
|
||||
private $_properties;
|
||||
private $_documentProperties;
|
||||
|
||||
/**
|
||||
* Default Font Name
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_defaultFontName;
|
||||
|
||||
/**
|
||||
* Default Font Size
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
private $_defaultFontSize;
|
||||
|
||||
/**
|
||||
* Collection of section elements
|
||||
*
|
||||
* @var array
|
||||
* @var PhpOffice\PhpWord\Section[]
|
||||
*/
|
||||
private $_sectionCollection = array();
|
||||
private $_sections = array();
|
||||
|
||||
|
||||
/**
|
||||
* Create a new PHPWord Document
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_properties = new DocumentProperties();
|
||||
$this->_defaultFontName = PHPWord::DEFAULT_FONT_NAME;
|
||||
$this->_defaultFontSize = PHPWord::DEFAULT_FONT_SIZE;
|
||||
$this->_documentProperties = new DocumentProperties();
|
||||
$this->_defaultFontName = self::DEFAULT_FONT_NAME;
|
||||
$this->_defaultFontSize = self::DEFAULT_FONT_SIZE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties
|
||||
* @return PhpOffice\PhpWord\DocumentProperties
|
||||
*/
|
||||
public function getProperties()
|
||||
public function getDocumentProperties()
|
||||
{
|
||||
return $this->_properties;
|
||||
return $this->_documentProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set properties
|
||||
*
|
||||
* @param PhpOffice\PhpWord\DocumentProperties $value
|
||||
* @return PhpOffice\PHPWord
|
||||
* @param PhpOffice\PhpWord\DocumentProperties $documentProperties
|
||||
* @return PhpOffice\PhpWord
|
||||
*/
|
||||
public function setProperties(DocumentProperties $value)
|
||||
public function setDocumentProperties(DocumentProperties $documentProperties)
|
||||
{
|
||||
$this->_properties = $value;
|
||||
$this->_documentProperties = $documentProperties;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new Section
|
||||
*
|
||||
* @param PhpOffice\PhpWord\Section\Settings $settings
|
||||
* @param PhpOffice\PhpWord\Section\Settings $settings
|
||||
* @return PhpOffice\PhpWord\Section
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default Font name
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultFontName()
|
||||
|
|
@ -152,16 +122,14 @@ class PhpWord
|
|||
}
|
||||
|
||||
/**
|
||||
* Set default Font name
|
||||
* @param string $pValue
|
||||
* @param string $fontName
|
||||
*/
|
||||
public function setDefaultFontName($pValue)
|
||||
public function setDefaultFontName($fontName)
|
||||
{
|
||||
$this->_defaultFontName = $pValue;
|
||||
$this->_defaultFontName = $fontName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default Font size (in points)
|
||||
* @return string
|
||||
*/
|
||||
public function getDefaultFontSize()
|
||||
|
|
@ -170,18 +138,17 @@ class PhpWord
|
|||
}
|
||||
|
||||
/**
|
||||
* Set default Font size (in points)
|
||||
* @param int $pValue
|
||||
* @param int $fontSize
|
||||
*/
|
||||
public function setDefaultFontSize($pValue)
|
||||
public function setDefaultFontSize($fontSize)
|
||||
{
|
||||
$this->_defaultFontSize = $pValue;
|
||||
$this->_defaultFontSize = $fontSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default paragraph style definition to styles.xml
|
||||
*
|
||||
* @param array $styles Paragraph style definition
|
||||
* @param array $styles Paragraph style definition
|
||||
*/
|
||||
public function setDefaultParagraphStyle($styles)
|
||||
{
|
||||
|
|
@ -244,35 +211,24 @@ class PhpWord
|
|||
}
|
||||
|
||||
/**
|
||||
* Get sections
|
||||
* @return PhpOffice\PhpWord\Section[]
|
||||
*/
|
||||
public function getSections()
|
||||
{
|
||||
return $this->_sectionCollection;
|
||||
return $this->_sections;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load a Template File
|
||||
*
|
||||
* @param string $strFilename
|
||||
* @param string $filename Fully qualified filename.
|
||||
* @return PhpOffice\PhpWord\Template
|
||||
* @throws Exception
|
||||
* @throws PhpOffice\PhpWord\Exceptions\Exception
|
||||
*/
|
||||
public function loadTemplate($strFilename)
|
||||
public function loadTemplate($filename)
|
||||
{
|
||||
if (file_exists($strFilename)) {
|
||||
return new Template($strFilename);
|
||||
if (\file_exists($filename)) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace PhpOffice\PhpWord\Exceptions;
|
|||
*
|
||||
* Exception used for when an image is not found
|
||||
*
|
||||
* @package PHPWord
|
||||
* @package PhpWord
|
||||
*/
|
||||
class InvalidImageException extends Exception
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use InvalidArgumentException;
|
|||
*
|
||||
* Exception used for when a style value is invalid
|
||||
*
|
||||
* @package PHPWord
|
||||
* @package PhpWord
|
||||
*/
|
||||
class InvalidStyleException extends InvalidArgumentException
|
||||
{
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ namespace PhpOffice\PhpWord\Exceptions;
|
|||
*
|
||||
* Exception used for when an image type is unsupported
|
||||
*
|
||||
* @package PHPWord
|
||||
* @package PhpWord
|
||||
*/
|
||||
class UnsupportedImageTypeException extends Exception
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,26 +18,27 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord;
|
||||
|
||||
use PhpOffice\PhpWord;
|
||||
use PhpOffice\PhpWord\Exceptions\Exception;
|
||||
|
||||
abstract class IOFactory
|
||||
{
|
||||
/**
|
||||
* @param PHPWord $phpWord
|
||||
* @param PhpOffice\PhpWord $phpWord
|
||||
* @param string $name
|
||||
* @return PhpOffice\PhpWord\Writer\IWriter
|
||||
* @throws PhpOffice\PhpWord\Exceptions\Exception
|
||||
*/
|
||||
public static function createWriter(PHPWord $phpWord, $name)
|
||||
public static function createWriter(PhpWord $phpWord, $name)
|
||||
{
|
||||
try {
|
||||
$fqName = "PhpOffice\\PhpWord\\Writer\\{$name}";
|
||||
|
|
@ -69,7 +70,7 @@ abstract class IOFactory
|
|||
*
|
||||
* @param string $filename The name of the file
|
||||
* @param string $readerName
|
||||
* @return PhpOffice\PHPWord
|
||||
* @return PhpOffice\PhpWord
|
||||
*/
|
||||
public static function load($filename, $readerName = 'Word2007')
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
@ -38,9 +38,9 @@ interface IReader
|
|||
public function canRead($pFilename);
|
||||
|
||||
/**
|
||||
* Loads PHPWord from file
|
||||
* Loads PhpWord from file
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @param string $pFilename
|
||||
*/
|
||||
public function load($pFilename);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,23 +18,24 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Reader;
|
||||
|
||||
use PhpOffice\PhpWord;
|
||||
use PhpOffice\PhpWord\DocumentProperties;
|
||||
use PhpOffice\PhpWord\Exceptions\Exception;
|
||||
use PhpOffice\PhpWord\Shared\File;
|
||||
|
||||
/** PHPWord root directory */
|
||||
/** PhpWord root directory */
|
||||
if (!defined('PHPWORD_BASE_PATH')) {
|
||||
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
|
||||
|
|
@ -44,7 +45,7 @@ class Word2007 extends AbstractReader implements IReader
|
|||
*
|
||||
* @param string $pFilename
|
||||
* @return bool
|
||||
* @throws Exception
|
||||
* @throws PhpOffice\PhpWord\Exceptions\Exception
|
||||
*/
|
||||
public function canRead($pFilename)
|
||||
{
|
||||
|
|
@ -55,7 +56,7 @@ class Word2007 extends AbstractReader implements IReader
|
|||
|
||||
$return = false;
|
||||
// Load file
|
||||
$zip = new ZipArchive;
|
||||
$zip = new ZipArchive();
|
||||
if ($zip->open($pFilename) === true) {
|
||||
// check if it is an OOXML archive
|
||||
$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 string $fileName
|
||||
* @param bool $removeNamespace
|
||||
|
|
@ -108,10 +107,10 @@ class Word2007 extends AbstractReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads PHPWord from file
|
||||
* Loads PhpWord from file
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @return PHPWord|null
|
||||
* @return PhpOffice\PhpWord|null
|
||||
*/
|
||||
public function load($pFilename)
|
||||
{
|
||||
|
|
@ -121,8 +120,8 @@ class Word2007 extends AbstractReader implements IReader
|
|||
}
|
||||
|
||||
// Initialisations
|
||||
$word = new PHPWord;
|
||||
$zip = new ZipArchive;
|
||||
$word = new PhpWord();
|
||||
$zip = new ZipArchive();
|
||||
$zip->open($pFilename);
|
||||
|
||||
// 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("dcterms", "http://purl.org/dc/terms/");
|
||||
$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->setLastModifiedBy((string)self::arrayItem($xmlCore->xpath("cp:lastModifiedBy")));
|
||||
$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":
|
||||
$xmlCore = simplexml_load_string($this->getFromZipArchive($zip, "{$rel['Target']}"));
|
||||
if (is_object($xmlCore)) {
|
||||
$docProps = $word->getProperties();
|
||||
$docProps = $word->getDocumentProperties();
|
||||
if (isset($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":
|
||||
$xmlCore = simplexml_load_string($this->getFromZipArchive($zip, "{$rel['Target']}"));
|
||||
if (is_object($xmlCore)) {
|
||||
$docProps = $word->getProperties();
|
||||
$docProps = $word->getDocumentProperties();
|
||||
foreach ($xmlCore as $xmlProperty) {
|
||||
$cellDataOfficeAttributes = $xmlProperty->attributes();
|
||||
if (isset($cellDataOfficeAttributes['name'])) {
|
||||
|
|
@ -276,7 +275,7 @@ class Word2007 extends AbstractReader implements IReader
|
|||
* @param SimpleXMLElement $elm
|
||||
* @return array|string|null
|
||||
*
|
||||
* @todo Implement gutter
|
||||
* @todo Implement gutter
|
||||
*/
|
||||
private function loadSectionSettings($elm)
|
||||
{
|
||||
|
|
@ -443,8 +442,6 @@ class Word2007 extends AbstractReader implements IReader
|
|||
}
|
||||
|
||||
/**
|
||||
* Get array item
|
||||
*
|
||||
* @param array $array
|
||||
* @param mixed $key
|
||||
* @return mixed|null
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
@ -242,7 +242,7 @@ class Section
|
|||
$ext = substr($ext, 0, -1);
|
||||
}
|
||||
|
||||
$iconSrc = PHPWORD_BASE_PATH . 'PHPWord/_staticDocParts/';
|
||||
$iconSrc = PHPWORD_BASE_PATH . 'PhpWord/_staticDocParts/';
|
||||
if (!file_exists($iconSrc . '_' . $ext . '.png')) {
|
||||
$iconSrc = $iconSrc . '_default.png';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
@ -261,7 +261,7 @@ class Cell
|
|||
$ext = substr($ext, 0, -1);
|
||||
}
|
||||
|
||||
$iconSrc = PHPWORD_BASE_PATH . 'PHPWord/_staticDocParts/';
|
||||
$iconSrc = PHPWORD_BASE_PATH . 'PhpWord/_staticDocParts/';
|
||||
if (!file_exists($iconSrc . '_' . $ext . '.png')) {
|
||||
$iconSrc = $iconSrc . '_default.png';
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2013 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2013 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,15 +18,16 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Style;
|
||||
|
||||
use PhpOffice\PhpWord;
|
||||
use PhpOffice\PhpWord\Exceptions\InvalidStyleException;
|
||||
|
||||
class Font
|
||||
|
|
@ -84,14 +85,14 @@ class Font
|
|||
*
|
||||
* @var int|float
|
||||
*/
|
||||
private $_name = PHPWord::DEFAULT_FONT_NAME;
|
||||
private $_name = PhpWord::DEFAULT_FONT_NAME;
|
||||
|
||||
/**
|
||||
* Font size
|
||||
*
|
||||
* @var int|float
|
||||
*/
|
||||
private $_size = PHPWord::DEFAULT_FONT_SIZE;
|
||||
private $_size = PhpWord::DEFAULT_FONT_SIZE;
|
||||
|
||||
/**
|
||||
* Bold
|
||||
|
|
@ -140,7 +141,7 @@ class Font
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_color = PHPWord::DEFAULT_FONT_COLOR;
|
||||
private $_color = PhpWord::DEFAULT_FONT_COLOR;
|
||||
|
||||
/**
|
||||
* Foreground/highlight
|
||||
|
|
@ -161,7 +162,7 @@ class Font
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_hint = PHPWord::DEFAULT_FONT_CONTENT_TYPE;
|
||||
private $_hint = PhpWord::DEFAULT_FONT_CONTENT_TYPE;
|
||||
|
||||
/**
|
||||
* New font style
|
||||
|
|
@ -232,10 +233,10 @@ class Font
|
|||
* @param string $pValue
|
||||
* @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 == '') {
|
||||
$pValue = PHPWord::DEFAULT_FONT_NAME;
|
||||
$pValue = PhpWord::DEFAULT_FONT_NAME;
|
||||
}
|
||||
$this->_name = $pValue;
|
||||
return $this;
|
||||
|
|
@ -258,10 +259,10 @@ class Font
|
|||
* @param int|float $pValue
|
||||
* @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)) {
|
||||
$pValue = PHPWord::DEFAULT_FONT_SIZE;
|
||||
$pValue = PhpWord::DEFAULT_FONT_SIZE;
|
||||
}
|
||||
$this->_size = $pValue;
|
||||
return $this;
|
||||
|
|
@ -435,10 +436,10 @@ class Font
|
|||
* @param string $pValue
|
||||
* @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 == '') {
|
||||
$pValue = PHPWord::DEFAULT_FONT_COLOR;
|
||||
$pValue = PhpWord::DEFAULT_FONT_COLOR;
|
||||
}
|
||||
$this->_color = $pValue;
|
||||
return $this;
|
||||
|
|
@ -532,10 +533,10 @@ class Font
|
|||
* @param string $pValue
|
||||
* @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 == '') {
|
||||
$pValue = PHPWord::DEFAULT_FONT_CONTENT_TYPE;
|
||||
$pValue = PhpWord::DEFAULT_FONT_CONTENT_TYPE;
|
||||
}
|
||||
$this->_hint = $pValue;
|
||||
return $this;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2013 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2013 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
@ -30,10 +30,10 @@ namespace PhpOffice\PhpWord\Writer;
|
|||
interface IWriter
|
||||
{
|
||||
/**
|
||||
* Save PHPWord to file
|
||||
* Save PhpWord to file
|
||||
*
|
||||
* @param string $pFileName
|
||||
* @throws Exception
|
||||
* @param string $pFileName
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function save($pFilename = null);
|
||||
}
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,15 +18,16 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Writer;
|
||||
|
||||
use PhpOffice\PhpWord;
|
||||
use PhpOffice\PhpWord\HashTable;
|
||||
use PhpOffice\PhpWord\Writer\ODText\Content;
|
||||
use PhpOffice\PhpWord\Writer\ODText\Manifest;
|
||||
|
|
@ -37,15 +38,11 @@ use PhpOffice\PhpWord\Writer\ODText\Styles;
|
|||
class ODText implements IWriter
|
||||
{
|
||||
/**
|
||||
* Private PHPWord
|
||||
*
|
||||
* @var PHPWord
|
||||
* @var PhpOffice\PhpWord
|
||||
*/
|
||||
private $_document;
|
||||
|
||||
/**
|
||||
* Private writer parts
|
||||
*
|
||||
* @var PhpOffice\PhpWord\Writer\ODText\WriterPart[]
|
||||
*/
|
||||
private $_writerParts;
|
||||
|
|
@ -65,19 +62,17 @@ class ODText implements IWriter
|
|||
private $_useDiskCaching = false;
|
||||
|
||||
/**
|
||||
* Disk caching directory
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_diskCachingDirectory;
|
||||
|
||||
/**
|
||||
* @param PHPWord $phpWord
|
||||
* @param PhpOffice\PhpWord $phpWord
|
||||
*/
|
||||
public function __construct(PHPWord $phpWord = null)
|
||||
public function __construct(PhpWord $phpWord = null)
|
||||
{
|
||||
// Assign PHPWord
|
||||
$this->setPHPWord($phpWord);
|
||||
// Assign PhpWord
|
||||
$this->setPhpWord($phpWord);
|
||||
|
||||
// Set up disk caching location
|
||||
$this->_diskCachingDirectory = './';
|
||||
|
|
@ -100,10 +95,10 @@ class ODText implements IWriter
|
|||
}
|
||||
|
||||
/**
|
||||
* Save PHPWord to file
|
||||
* Save PhpWord to file
|
||||
*
|
||||
* @param string $pFileName
|
||||
* @throws Exception
|
||||
* @param string $pFileName
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function save($pFilename = null)
|
||||
{
|
||||
|
|
@ -125,7 +120,7 @@ class ODText implements IWriter
|
|||
// Try opening the ZIP file
|
||||
if ($objZip->open($pFilename, ZIPARCHIVE::OVERWRITE) !== 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
|
||||
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 ($originalFilename != $pFilename) {
|
||||
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);
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new Exception("PHPWord object unassigned.");
|
||||
throw new \Exception("PhpWord object unassigned.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get PHPWord object
|
||||
*
|
||||
* @return PHPWord
|
||||
* @throws Exception
|
||||
* @return PhpOffice\PhpWord
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getPHPWord()
|
||||
public function getPhpWord()
|
||||
{
|
||||
if (!is_null($this->_document)) {
|
||||
return $this->_document;
|
||||
} else {
|
||||
throw new Exception("No PHPWord assigned.");
|
||||
throw new \Exception("No PhpWord assigned.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get PHPWord object
|
||||
*
|
||||
* @param PHPWord $phpWord PHPWord object
|
||||
* @throws Exception
|
||||
* @param PhpOffice\PhpWord $phpWord
|
||||
* @return PhpOffice\PhpWord\Writer\ODText
|
||||
*/
|
||||
public function setPHPWord(PHPWord $phpWord = null)
|
||||
public function setPhpWord(PhpWord $phpWord = null)
|
||||
{
|
||||
$this->_document = $phpWord;
|
||||
return $this;
|
||||
|
|
@ -237,8 +227,6 @@ class ODText implements IWriter
|
|||
}
|
||||
|
||||
/**
|
||||
* Get writer part
|
||||
*
|
||||
* @param string $pPartName Writer part name
|
||||
* @return PhpOffice\PhpWord\Writer\ODText\WriterPart
|
||||
*/
|
||||
|
|
@ -266,7 +254,7 @@ class ODText implements IWriter
|
|||
*
|
||||
* @param boolean $pValue
|
||||
* @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
|
||||
*/
|
||||
public function setUseDiskCaching($pValue = false, $pDirectory = null)
|
||||
|
|
@ -277,7 +265,7 @@ class ODText implements IWriter
|
|||
if (is_dir($pDirectory)) {
|
||||
$this->_diskCachingDirectory = $pDirectory;
|
||||
} 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
|
||||
*/
|
||||
public function getDiskCachingDirectory()
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,15 +18,16 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Writer\ODText;
|
||||
|
||||
use PhpOffice\PhpWord;
|
||||
use PhpOffice\PhpWord\Section;
|
||||
use PhpOffice\PhpWord\Section\Image;
|
||||
use PhpOffice\PhpWord\Section\Link;
|
||||
|
|
@ -50,11 +51,11 @@ class Content extends WriterPart
|
|||
/**
|
||||
* Write content file to XML format
|
||||
*
|
||||
* @param PHPWord $phpWord
|
||||
* @param PhpOffice\PhpWord $phpWord
|
||||
* @return string XML Output
|
||||
* @throws Exception
|
||||
*/
|
||||
public function writeContent(PHPWord $phpWord = null)
|
||||
public function writeContent(PhpWord $phpWord = null)
|
||||
{
|
||||
// Create XML writer
|
||||
$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->writeAttribute('style:name', PHPWord::DEFAULT_FONT_NAME);
|
||||
$xmlWriter->writeAttribute('svg:font-family', PHPWord::DEFAULT_FONT_NAME);
|
||||
$xmlWriter->writeAttribute('style:name', PhpWord::DEFAULT_FONT_NAME);
|
||||
$xmlWriter->writeAttribute('svg:font-family', PhpWord::DEFAULT_FONT_NAME);
|
||||
$xmlWriter->endElement();
|
||||
}
|
||||
}
|
||||
|
|
@ -325,7 +326,7 @@ class Content extends WriterPart
|
|||
|
||||
if ($SfIsObject) {
|
||||
// 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 {
|
||||
if (!$withoutP) {
|
||||
$xmlWriter->startElement('text:p'); // text:p
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,15 +18,16 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Writer\ODText;
|
||||
|
||||
use PhpOffice\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\File;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
|
|
@ -35,11 +36,11 @@ class Manifest extends WriterPart
|
|||
/**
|
||||
* Write Manifest file to XML format
|
||||
*
|
||||
* @param PHPWord $phpWord
|
||||
* @param PhpOffice\PhpWord $phpWord
|
||||
* @return string XML Output
|
||||
* @throws Exception
|
||||
*/
|
||||
public function writeManifest(PHPWord $phpWord = null)
|
||||
public function writeManifest(PhpWord $phpWord = null)
|
||||
{
|
||||
// Create XML writer
|
||||
$xmlWriter = null;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,15 +18,16 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Writer\ODText;
|
||||
|
||||
use PhpOffice\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
class Meta extends WriterPart
|
||||
|
|
@ -34,11 +35,11 @@ class Meta extends WriterPart
|
|||
/**
|
||||
* Write Meta file to XML format
|
||||
*
|
||||
* @param PHPWord $phpWord
|
||||
* @param PhpOffice\PhpWord $phpWord
|
||||
* @return string XML Output
|
||||
* @throws Exception
|
||||
*/
|
||||
public function writeMeta(PHPWord $phpWord = null)
|
||||
public function writeMeta(PhpWord $phpWord = null)
|
||||
{
|
||||
// Create XML writer
|
||||
$xmlWriter = null;
|
||||
|
|
@ -65,25 +66,25 @@ class Meta extends WriterPart
|
|||
$xmlWriter->startElement('office:meta');
|
||||
|
||||
// dc:creator
|
||||
$xmlWriter->writeElement('dc:creator', $phpWord->getProperties()->getLastModifiedBy());
|
||||
$xmlWriter->writeElement('dc:creator', $phpWord->getDocumentProperties()->getLastModifiedBy());
|
||||
// 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
|
||||
$xmlWriter->writeElement('dc:description', $phpWord->getProperties()->getDescription());
|
||||
$xmlWriter->writeElement('dc:description', $phpWord->getDocumentProperties()->getDescription());
|
||||
// dc:subject
|
||||
$xmlWriter->writeElement('dc:subject', $phpWord->getProperties()->getSubject());
|
||||
$xmlWriter->writeElement('dc:subject', $phpWord->getDocumentProperties()->getSubject());
|
||||
// dc:title
|
||||
$xmlWriter->writeElement('dc:title', $phpWord->getProperties()->getTitle());
|
||||
$xmlWriter->writeElement('dc:title', $phpWord->getDocumentProperties()->getTitle());
|
||||
// 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
|
||||
$xmlWriter->writeElement('meta:initial-creator', $phpWord->getProperties()->getCreator());
|
||||
$xmlWriter->writeElement('meta:initial-creator', $phpWord->getDocumentProperties()->getCreator());
|
||||
// meta:keyword
|
||||
$xmlWriter->writeElement('meta:keyword', $phpWord->getProperties()->getKeywords());
|
||||
$xmlWriter->writeElement('meta:keyword', $phpWord->getDocumentProperties()->getKeywords());
|
||||
|
||||
// @todo : Where these properties are written ?
|
||||
// $phpWord->getProperties()->getCategory()
|
||||
// $phpWord->getProperties()->getCompany()
|
||||
// $phpWord->getDocumentProperties()->getCategory()
|
||||
// $phpWord->getDocumentProperties()->getCompany()
|
||||
|
||||
$xmlWriter->endElement();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,25 +18,27 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Writer\ODText;
|
||||
|
||||
use PhpOffice\PhpWord;
|
||||
|
||||
class Mimetype extends WriterPart
|
||||
{
|
||||
/**
|
||||
* Write Mimetype to Text format
|
||||
*
|
||||
* @param PHPWord $phpWord
|
||||
* @param PhpOffice\PhpWord $phpWord
|
||||
* @return string Text Output
|
||||
* @throws Exception
|
||||
*/
|
||||
public function writeMimetype(PHPWord $phpWord = null)
|
||||
public function writeMimetype(PhpWord $phpWord = null)
|
||||
{
|
||||
|
||||
return 'application/vnd.oasis.opendocument.text';
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,15 +18,16 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Writer\ODText;
|
||||
|
||||
use PhpOffice\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
|
|
@ -38,11 +39,11 @@ class Styles extends WriterPart
|
|||
/**
|
||||
* Write Styles file to XML format
|
||||
*
|
||||
* @param PHPWord $phpWord
|
||||
* @param PhpOffice\PhpWord $phpWord
|
||||
* @return string XML Output
|
||||
* @throws Exception
|
||||
*/
|
||||
public function writeStyles(PHPWord $phpWord = null)
|
||||
public function writeStyles(PhpWord $phpWord = null)
|
||||
{
|
||||
// Create XML writer
|
||||
$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->writeAttribute('style:name', PHPWord::DEFAULT_FONT_NAME);
|
||||
$xmlWriter->writeAttribute('svg:font-family', PHPWord::DEFAULT_FONT_NAME);
|
||||
$xmlWriter->writeAttribute('style:name', PhpWord::DEFAULT_FONT_NAME);
|
||||
$xmlWriter->writeAttribute('svg:font-family', PhpWord::DEFAULT_FONT_NAME);
|
||||
$xmlWriter->endElement();
|
||||
}
|
||||
$xmlWriter->endElement();
|
||||
|
|
@ -137,17 +138,17 @@ class Styles extends WriterPart
|
|||
// style:text-properties
|
||||
$xmlWriter->startElement('style:text-properties');
|
||||
$xmlWriter->writeAttribute('style:use-window-font-color', 'true');
|
||||
$xmlWriter->writeAttribute('style:font-name', PHPWord::DEFAULT_FONT_NAME);
|
||||
$xmlWriter->writeAttribute('fo:font-size', PHPWord::DEFAULT_FONT_SIZE . 'pt');
|
||||
$xmlWriter->writeAttribute('style:font-name', PhpWord::DEFAULT_FONT_NAME);
|
||||
$xmlWriter->writeAttribute('fo:font-size', PhpWord::DEFAULT_FONT_SIZE . 'pt');
|
||||
$xmlWriter->writeAttribute('fo:language', 'fr');
|
||||
$xmlWriter->writeAttribute('fo:country', 'FR');
|
||||
$xmlWriter->writeAttribute('style:letter-kerning', 'true');
|
||||
$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-name-asian', PhpWord::DEFAULT_FONT_NAME . '2');
|
||||
$xmlWriter->writeAttribute('style:font-size-asian', PhpWord::DEFAULT_FONT_SIZE . 'pt');
|
||||
$xmlWriter->writeAttribute('style:language-asian', 'zh');
|
||||
$xmlWriter->writeAttribute('style:country-asian', 'CN');
|
||||
$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-name-complex', PhpWord::DEFAULT_FONT_NAME . '2');
|
||||
$xmlWriter->writeAttribute('style:font-size-complex', PhpWord::DEFAULT_FONT_SIZE . 'pt');
|
||||
$xmlWriter->writeAttribute('style:language-complex', 'hi');
|
||||
$xmlWriter->writeAttribute('style:country-complex', 'IN');
|
||||
$xmlWriter->writeAttribute('fo:hyphenate', 'false');
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,15 +18,16 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Writer;
|
||||
|
||||
use PhpOffice\PhpWord;
|
||||
use PhpOffice\PhpWord\HashTable;
|
||||
use PhpOffice\PhpWord\Section\Image;
|
||||
use PhpOffice\PhpWord\Section\Link;
|
||||
|
|
@ -48,9 +49,9 @@ use PhpOffice\PhpWord\TOC;
|
|||
class RTF implements IWriter
|
||||
{
|
||||
/**
|
||||
* Private PHPWord
|
||||
* Private PhpWord
|
||||
*
|
||||
* @var PHPWord
|
||||
* @var PhpOffice\PhpWord
|
||||
*/
|
||||
private $_document;
|
||||
|
||||
|
|
@ -66,22 +67,22 @@ class RTF implements IWriter
|
|||
private $_lastParagraphStyle;
|
||||
|
||||
/**
|
||||
* @param PHPWord $phpWord
|
||||
* @param PhpOffice\PhpWord $phpWord
|
||||
*/
|
||||
public function __construct(PHPWord $phpWord = null)
|
||||
public function __construct(PhpWord $phpWord = null)
|
||||
{
|
||||
// Assign PHPWord
|
||||
$this->setPHPWord($phpWord);
|
||||
// Assign PhpWord
|
||||
$this->setPhpWord($phpWord);
|
||||
|
||||
// Set HashTable variables
|
||||
$this->_drawingHashTable = new HashTable();
|
||||
}
|
||||
|
||||
/**
|
||||
* Save PHPWord to file
|
||||
* Save PhpWord to file
|
||||
*
|
||||
* @param string $pFileName
|
||||
* @throws Exception
|
||||
* @param string $pFileName
|
||||
* @throws \Exception
|
||||
*/
|
||||
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 ($originalFilename != $pFilename) {
|
||||
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);
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new Exception("PHPWord object unassigned.");
|
||||
throw new \Exception("PhpWord object unassigned.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get PHPWord object
|
||||
*
|
||||
* @return PHPWord
|
||||
* @throws Exception
|
||||
* @return PhpOffice\PhpWord
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function getPHPWord()
|
||||
public function getPhpWord()
|
||||
{
|
||||
if (!is_null($this->_document)) {
|
||||
return $this->_document;
|
||||
} else {
|
||||
throw new Exception("No PHPWord assigned.");
|
||||
throw new \Exception("No PhpWord assigned.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PHPWord $phpWord PHPWord object
|
||||
* @throws Exception
|
||||
* @param PhpOffice\PhpWord $phpWord
|
||||
* @throws \Exception
|
||||
* @return PhpOffice\PhpWord\Writer\RTF
|
||||
*/
|
||||
public function setPHPWord(PHPWord $phpWord = null)
|
||||
public function setPhpWord(PhpWord $phpWord = null)
|
||||
{
|
||||
$this->_document = $phpWord;
|
||||
return $this;
|
||||
|
|
@ -150,7 +149,7 @@ class RTF implements IWriter
|
|||
|
||||
private function getData()
|
||||
{
|
||||
// PHPWord object : $this->_document
|
||||
// PhpWord object : $this->_document
|
||||
$this->_fontTable = $this->getDataFont();
|
||||
$this->_colorTable = $this->getDataColor();
|
||||
|
||||
|
|
@ -176,7 +175,7 @@ class RTF implements IWriter
|
|||
}
|
||||
$sRTFContent .= ';}' . PHP_EOL;
|
||||
// Set the generator
|
||||
$sRTFContent .= '{\*\generator PHPWord;}' . PHP_EOL;
|
||||
$sRTFContent .= '{\*\generator PhpWord;}' . PHP_EOL;
|
||||
// Set the view mode of the document
|
||||
$sRTFContent .= '\viewkind4';
|
||||
// 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
|
||||
$sRTFContent .= '\kerning1';
|
||||
// Set the font size in half-points
|
||||
$sRTFContent .= '\fs' . (PHPWord::DEFAULT_FONT_SIZE * 2);
|
||||
$sRTFContent .= '\fs' . (PhpWord::DEFAULT_FONT_SIZE * 2);
|
||||
$sRTFContent .= PHP_EOL;
|
||||
// Body
|
||||
$sRTFContent .= $this->getDataContent();
|
||||
|
|
@ -206,9 +205,9 @@ class RTF implements IWriter
|
|||
$phpWord = $this->_document;
|
||||
|
||||
$arrFonts = array();
|
||||
// Default font : PHPWord::DEFAULT_FONT_NAME
|
||||
$arrFonts[] = PHPWord::DEFAULT_FONT_NAME;
|
||||
// PHPWord object : $this->_document
|
||||
// Default font : PhpWord::DEFAULT_FONT_NAME
|
||||
$arrFonts[] = PhpWord::DEFAULT_FONT_NAME;
|
||||
// PhpWord object : $this->_document
|
||||
|
||||
// Browse styles
|
||||
$styles = Style::getStyles();
|
||||
|
|
@ -256,7 +255,7 @@ class RTF implements IWriter
|
|||
$phpWord = $this->_document;
|
||||
|
||||
$arrColors = array();
|
||||
// PHPWord object : $this->_document
|
||||
// PhpWord object : $this->_document
|
||||
|
||||
// Browse styles
|
||||
$styles = Style::getStyles();
|
||||
|
|
@ -267,10 +266,10 @@ class RTF implements IWriter
|
|||
if ($style instanceof Font) {
|
||||
$color = $style->getColor();
|
||||
$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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -353,9 +352,6 @@ class RTF implements IWriter
|
|||
return $sRTFBody;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text
|
||||
*/
|
||||
private function getDataContentText(Text $text, $withoutP = false)
|
||||
{
|
||||
$sRTFText = '';
|
||||
|
|
@ -434,7 +430,7 @@ class RTF implements IWriter
|
|||
$sRTFText .= '\i0';
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get text run content
|
||||
*/
|
||||
private function getDataContentTextRun(TextRun $textrun)
|
||||
{
|
||||
$sRTFText = '';
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,15 +18,16 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Writer;
|
||||
|
||||
use PhpOffice\PhpWord;
|
||||
use PhpOffice\PhpWord\Footnote;
|
||||
use PhpOffice\PhpWord\Media;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\ContentTypes;
|
||||
|
|
@ -49,9 +50,9 @@ class Word2007 implements IWriter
|
|||
private $_imageTypes = array();
|
||||
private $_objectTypes = array();
|
||||
|
||||
public function __construct(PHPWord $PHPWord = null)
|
||||
public function __construct(PhpWord $phpWord = null)
|
||||
{
|
||||
$this->_document = $PHPWord;
|
||||
$this->_document = $phpWord;
|
||||
|
||||
$this->_diskCachingDirectory = './';
|
||||
|
||||
|
|
@ -187,11 +188,11 @@ class Word2007 implements IWriter
|
|||
$objZip->addFromString('word/styles.xml', $this->getWriterPart('styles')->writeStyles($this->_document));
|
||||
|
||||
// Write static files
|
||||
$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/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/fontTable.xml', 'word/fontTable.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/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/fontTable.xml', 'word/fontTable.xml');
|
||||
|
||||
|
||||
// Close file
|
||||
|
|
@ -207,7 +208,7 @@ class Word2007 implements IWriter
|
|||
@unlink($pFilename);
|
||||
}
|
||||
} else {
|
||||
throw new Exception("PHPWord object unassigned.");
|
||||
throw new Exception("PhpWord object unassigned.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,15 +18,16 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007;
|
||||
|
||||
use PhpOffice\PhpWord;
|
||||
use PhpOffice\PhpWord\Section\Footer\PreserveText;
|
||||
use PhpOffice\PhpWord\Section\Footnote;
|
||||
use PhpOffice\PhpWord\Section\Image;
|
||||
|
|
@ -402,14 +403,14 @@ class Base extends WriterPart
|
|||
$xmlWriter->startElement('w:rPr');
|
||||
|
||||
// Font
|
||||
if ($font != PHPWord::DEFAULT_FONT_NAME) {
|
||||
if ($font != PhpWord::DEFAULT_FONT_NAME) {
|
||||
$xmlWriter->startElement('w:rFonts');
|
||||
$xmlWriter->writeAttribute('w:ascii', $font);
|
||||
$xmlWriter->writeAttribute('w:hAnsi', $font);
|
||||
$xmlWriter->writeAttribute('w:eastAsia', $font);
|
||||
$xmlWriter->writeAttribute('w:cs', $font);
|
||||
//Font Content Type
|
||||
if ($hint != PHPWord::DEFAULT_FONT_CONTENT_TYPE) {
|
||||
if ($hint != PhpWord::DEFAULT_FONT_CONTENT_TYPE) {
|
||||
$xmlWriter->writeAttribute('w:hint', $hint);
|
||||
}
|
||||
$xmlWriter->endElement();
|
||||
|
|
@ -417,14 +418,14 @@ class Base extends WriterPart
|
|||
|
||||
|
||||
// Color
|
||||
if ($color != PHPWord::DEFAULT_FONT_COLOR) {
|
||||
if ($color != PhpWord::DEFAULT_FONT_COLOR) {
|
||||
$xmlWriter->startElement('w:color');
|
||||
$xmlWriter->writeAttribute('w:val', $color);
|
||||
$xmlWriter->endElement();
|
||||
}
|
||||
|
||||
// Size
|
||||
if ($size != PHPWord::DEFAULT_FONT_SIZE) {
|
||||
if ($size != PhpWord::DEFAULT_FONT_SIZE) {
|
||||
$xmlWriter->startElement('w:sz');
|
||||
$xmlWriter->writeAttribute('w:val', $size * 2);
|
||||
$xmlWriter->endElement();
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,20 +18,21 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007;
|
||||
|
||||
use PhpOffice\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
class DocProps extends WriterPart
|
||||
{
|
||||
public function writeDocPropsApp(PHPWord $phpWord = null)
|
||||
public function writeDocPropsApp(PhpWord $phpWord = null)
|
||||
{
|
||||
// Create XML writer
|
||||
$xmlWriter = null;
|
||||
|
|
@ -102,7 +103,7 @@ class DocProps extends WriterPart
|
|||
$xmlWriter->endElement();
|
||||
|
||||
// Company
|
||||
$xmlWriter->writeElement('Company', $phpWord->getProperties()->getCompany());
|
||||
$xmlWriter->writeElement('Company', $phpWord->getDocumentProperties()->getCompany());
|
||||
|
||||
// LinksUpToDate
|
||||
$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
|
||||
$xmlWriter = null;
|
||||
|
|
@ -145,37 +146,37 @@ class DocProps extends WriterPart
|
|||
$xmlWriter->writeAttribute('xmlns:xsi', 'http://www.w3.org/2001/XMLSchema-instance');
|
||||
|
||||
// dc:creator
|
||||
$xmlWriter->writeElement('dc:creator', $phpWord->getProperties()->getCreator());
|
||||
$xmlWriter->writeElement('dc:creator', $phpWord->getDocumentProperties()->getCreator());
|
||||
|
||||
// cp:lastModifiedBy
|
||||
$xmlWriter->writeElement('cp:lastModifiedBy', $phpWord->getProperties()->getLastModifiedBy());
|
||||
$xmlWriter->writeElement('cp:lastModifiedBy', $phpWord->getDocumentProperties()->getLastModifiedBy());
|
||||
|
||||
// dcterms:created
|
||||
$xmlWriter->startElement('dcterms:created');
|
||||
$xmlWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
|
||||
$xmlWriter->writeRaw(date(DATE_W3C, $phpWord->getProperties()->getCreated()));
|
||||
$xmlWriter->writeRaw(date(DATE_W3C, $phpWord->getDocumentProperties()->getCreated()));
|
||||
$xmlWriter->endElement();
|
||||
|
||||
// dcterms:modified
|
||||
$xmlWriter->startElement('dcterms:modified');
|
||||
$xmlWriter->writeAttribute('xsi:type', 'dcterms:W3CDTF');
|
||||
$xmlWriter->writeRaw(date(DATE_W3C, $phpWord->getProperties()->getModified()));
|
||||
$xmlWriter->writeRaw(date(DATE_W3C, $phpWord->getDocumentProperties()->getModified()));
|
||||
$xmlWriter->endElement();
|
||||
|
||||
// dc:title
|
||||
$xmlWriter->writeElement('dc:title', $phpWord->getProperties()->getTitle());
|
||||
$xmlWriter->writeElement('dc:title', $phpWord->getDocumentProperties()->getTitle());
|
||||
|
||||
// dc:description
|
||||
$xmlWriter->writeElement('dc:description', $phpWord->getProperties()->getDescription());
|
||||
$xmlWriter->writeElement('dc:description', $phpWord->getDocumentProperties()->getDescription());
|
||||
|
||||
// dc:subject
|
||||
$xmlWriter->writeElement('dc:subject', $phpWord->getProperties()->getSubject());
|
||||
$xmlWriter->writeElement('dc:subject', $phpWord->getDocumentProperties()->getSubject());
|
||||
|
||||
// cp:keywords
|
||||
$xmlWriter->writeElement('cp:keywords', $phpWord->getProperties()->getKeywords());
|
||||
$xmlWriter->writeElement('cp:keywords', $phpWord->getDocumentProperties()->getKeywords());
|
||||
|
||||
// cp:category
|
||||
$xmlWriter->writeElement('cp:category', $phpWord->getProperties()->getCategory());
|
||||
$xmlWriter->writeElement('cp:category', $phpWord->getDocumentProperties()->getCategory());
|
||||
|
||||
$xmlWriter->endElement();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,15 +18,16 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007;
|
||||
|
||||
use PhpOffice\PhpWord;
|
||||
use PhpOffice\PhpWord\Section\Footnote;
|
||||
use PhpOffice\PhpWord\Section\Image;
|
||||
use PhpOffice\PhpWord\Section\Link;
|
||||
|
|
@ -46,7 +47,7 @@ use PhpOffice\PhpWord\TOC;
|
|||
|
||||
class Document extends Base
|
||||
{
|
||||
public function writeDocument(PHPWord $phpWord = null)
|
||||
public function writeDocument(PhpWord $phpWord = null)
|
||||
{
|
||||
// Create XML writer
|
||||
if ($this->getParentWriter()->getUseDiskCaching()) {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,20 +18,21 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007;
|
||||
|
||||
use PhpOffice\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
class Rels extends WriterPart
|
||||
{
|
||||
public function writeRelationships(PHPWord $phpWord = null)
|
||||
public function writeRelationships(PhpWord $phpWord = null)
|
||||
{
|
||||
// Create XML writer
|
||||
$xmlWriter = null;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,15 +18,16 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007;
|
||||
|
||||
use PhpOffice\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
|
|
@ -37,7 +38,7 @@ class Styles extends Base
|
|||
{
|
||||
private $_document;
|
||||
|
||||
public function writeStyles(PHPWord $phpWord = null)
|
||||
public function writeStyles(PhpWord $phpWord = null)
|
||||
{
|
||||
// Create XML writer
|
||||
$xmlWriter = null;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
/**
|
||||
* PHPWord
|
||||
* PhpWord
|
||||
*
|
||||
* Copyright (c) 2014 PHPWord
|
||||
* Copyright (c) 2014 PhpWord
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
|
|
@ -18,9 +18,9 @@
|
|||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PHPWord
|
||||
* @package PHPWord
|
||||
* @copyright Copyright (c) 2014 PHPWord
|
||||
* @category PhpWord
|
||||
* @package PhpWord
|
||||
* @copyright Copyright (c) 2014 PhpWord
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
* @version 0.8.0
|
||||
*/
|
||||
|
|
|
|||
34
README.md
34
README.md
|
|
@ -1,15 +1,15 @@
|
|||
# PHPWord
|
||||
# PhpWord
|
||||
|
||||
[](https://travis-ci.org/PHPOffice/PHPWord)
|
||||
[](https://travis-ci.org/PHPOffice/PhpWord)
|
||||
[](https://packagist.org/packages/phpoffice/phpword) [](https://packagist.org/packages/phpoffice/phpword) [](https://packagist.org/packages/phpoffice/phpword) [](https://packagist.org/packages/phpoffice/phpword)
|
||||
|
||||
__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).
|
||||
|
||||
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!
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ __Want to contribute?__ Fork us!
|
|||
|
||||
## 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``.
|
||||
|
||||
```json
|
||||
|
|
@ -58,7 +58,7 @@ the following lines to your ``composer.json``.
|
|||
|
||||
## 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
|
||||
|
||||
|
|
@ -79,14 +79,14 @@ We're reorganizing our documentation. Below are some of the most important thing
|
|||
<a name="basic-usage"></a>
|
||||
#### 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
|
||||
$PHPWord = new PHPWord();
|
||||
$phpWord = new PhpOffice\PhpWord();
|
||||
|
||||
// Every element you want to append to the word document is placed in a section.
|
||||
// To create a basic section:
|
||||
$section = $PHPWord->createSection();
|
||||
$section = $phpWord->createSection();
|
||||
|
||||
// After creating a section, you can append elements:
|
||||
$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
|
||||
// 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'));
|
||||
$section->addText('Hello world! I am formatted by a user defined style',
|
||||
'myOwnStyle');
|
||||
|
|
@ -111,7 +111,7 @@ $myTextElement = $section->addText('Hello World!');
|
|||
$myTextElement->setFontStyle($fontStyle);
|
||||
|
||||
// Finally, write the document:
|
||||
$xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($PHPWord, 'Word2007');
|
||||
$xmlWriter = PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
|
||||
$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.
|
||||
|
||||
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
|
||||
// Paragraph with 6 points space after
|
||||
$PHPWord->addParagraphStyle('My Style', array(
|
||||
$phpWord->addParagraphStyle('My Style', array(
|
||||
'spaceAfter' => PhpOffice\PhpWord\Shared\Font::pointSizeToTwips(6))
|
||||
);
|
||||
|
||||
$section = $PHPWord->createSection();
|
||||
$section = $phpWord->createSection();
|
||||
$sectionStyle = $section->getSettings();
|
||||
// half inch left margin
|
||||
$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:
|
||||
|
||||
```php
|
||||
$section = $PHPWord->createSection($sectionSettings);
|
||||
$section = $phpWord->createSection($sectionSettings);
|
||||
```
|
||||
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.
|
||||
|
||||
```php
|
||||
$section = $PHPWord->createSection();
|
||||
$section = $phpWord->createSection();
|
||||
$section->getSettings()->setPageNumberingStart(1);
|
||||
```
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ $cell->getStyle()->setGridSpan(5);
|
|||
You can add images easily using the following example.
|
||||
|
||||
```php
|
||||
$section = $PHPWord->createSection();
|
||||
$section = $phpWord->createSection();
|
||||
$section->addImage('mars.jpg');
|
||||
```
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests;
|
||||
namespace PhpWord\Tests;
|
||||
|
||||
use PHPWord_Autoloader;
|
||||
use PHPWord_Autoloader as Autoloader;
|
||||
|
|
@ -17,11 +17,11 @@ class AutoloaderTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$this->assertNull(
|
||||
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(
|
||||
PHPWord_Autoloader::load('PHPWord'),
|
||||
'PHPWord_Autoloader::load() failed to autoload the PHPWord class'
|
||||
PHPWord_Autoloader::load('PhpWord'),
|
||||
'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 ' .
|
||||
'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(
|
||||
'PhpOffice\\PhpWord\\Exceptions\\InvalidStyleException'
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests;
|
||||
namespace PhpWord\Tests;
|
||||
|
||||
use PhpOffice\PhpWord\DocumentProperties;
|
||||
|
||||
/**
|
||||
* @package PHPWord\Tests
|
||||
* @package PhpWord\Tests
|
||||
* @coversDefaultClass PhpOffice\PhpWord\DocumentProperties
|
||||
* @runTestsInSeparateProcesses
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Exceptions;
|
||||
namespace PhpWord\Tests\Exceptions;
|
||||
|
||||
use PhpOffice\PhpWord\Exceptions\Exception;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Exceptions;
|
||||
namespace PhpWord\Tests\Exceptions;
|
||||
|
||||
use PhpOffice\PhpWord\Exceptions\InvalidImageException;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Exceptions;
|
||||
namespace PhpWord\Tests\Exceptions;
|
||||
|
||||
use PhpOffice\PhpWord\Exceptions\InvalidStyleException;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Exceptions;
|
||||
namespace PhpWord\Tests\Exceptions;
|
||||
|
||||
use PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests;
|
||||
namespace PhpWord\Tests;
|
||||
|
||||
use PhpOffice\PHPWord;
|
||||
use PhpOffice\PhpWord;
|
||||
use PhpOffice\PhpWord\IOFactory;
|
||||
|
||||
/**
|
||||
* @@coversDefaultClass PhpOffice\PhpWord\IOFactory
|
||||
* @package PHPWord\Tests
|
||||
* @package PhpWord\Tests
|
||||
* @runTestsInSeparateProcesses
|
||||
*/
|
||||
final class IOFactoryTest extends \PHPUnit_Framework_TestCase
|
||||
|
|
@ -18,7 +18,7 @@ final class IOFactoryTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
$this->assertInstanceOf(
|
||||
'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()
|
||||
{
|
||||
IOFactory::createWriter(new PHPWord(), 'Word2006');
|
||||
IOFactory::createWriter(new PhpWord(), 'Word2006');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests;
|
||||
namespace PhpWord\Tests;
|
||||
|
||||
use PhpOffice\PhpWord\Media;
|
||||
use PhpOffice\PhpWord\Section;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Reader;
|
||||
namespace PhpWord\Tests\Reader;
|
||||
|
||||
use PhpOffice\PhpWord\Reader\Word2007;
|
||||
use PhpOffice\PhpWord\IOFactory;
|
||||
|
||||
/**
|
||||
* @package PHPWord\Tests
|
||||
* @package PhpWord\Tests
|
||||
*/
|
||||
class Word2007Test extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
|
@ -61,6 +61,6 @@ class Word2007Test extends \PHPUnit_Framework_TestCase
|
|||
);
|
||||
$file = $dir . DIRECTORY_SEPARATOR . 'reader.docx';
|
||||
$object = IOFactory::load($file);
|
||||
$this->assertInstanceOf('PhpOffice\\PHPWord', $object);
|
||||
$this->assertInstanceOf('PhpOffice\\PhpWord', $object);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Section\Footer;
|
||||
namespace PhpWord\Tests\Section\Footer;
|
||||
|
||||
use PhpOffice\PhpWord\Section\Footer\PreserveText;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Section;
|
||||
namespace PhpWord\Tests\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Section\Footer;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Section;
|
||||
namespace PhpWord\Tests\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Section\Footnote;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Section;
|
||||
namespace PhpWord\Tests\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Section\Header;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Section;
|
||||
namespace PhpWord\Tests\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Section\Image;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Section;
|
||||
namespace PhpWord\Tests\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Section\Link;
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Section;
|
||||
namespace PhpWord\Tests\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Section\ListItem;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Section;
|
||||
namespace PhpWord\Tests\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Section\MemoryImage;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Section;
|
||||
namespace PhpWord\Tests\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Section\Object;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Section;
|
||||
namespace PhpWord\Tests\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Section\PageBreak;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Section;
|
||||
namespace PhpWord\Tests\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Section\Settings;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Section\Table;
|
||||
namespace PhpWord\Tests\Section\Table;
|
||||
|
||||
use PhpOffice\PhpWord\Section\Table\Cell;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Section\Table;
|
||||
namespace PhpWord\Tests\Section\Table;
|
||||
|
||||
use PhpOffice\PhpWord\Section\Table\Row;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Section;
|
||||
namespace PhpWord\Tests\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Section\Table;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
<?php
|
||||
namespace PHPWord\Tests\Section;
|
||||
namespace PhpWord\Tests\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Section\TextBreak;
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
use PhpOffice\PhpWord\Style\Paragraph;
|
||||
|
||||
/**
|
||||
* @package PHPWord\Tests
|
||||
* @package PhpWord\Tests
|
||||
* @coversDefaultClass PhpOffice\PhpWord\Section\TextBreak
|
||||
* @runTestsInSeparateProcesses
|
||||
*/
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue