Fixed some merge issues
This commit is contained in:
parent
39e4dd2259
commit
d09f0958c6
67
Classes/PHPWord.php
Normal file → Executable file
67
Classes/PHPWord.php
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPWord
|
* PHPWord
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 PHPWord
|
* Copyright (c) 2013 PHPWord
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,13 +20,13 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 010 PHPWord
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version Beta 0.6.3, 08.07.2011
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** PHPWORD_BASE_PATH */
|
/** PHPWORD_BASE_PATH */
|
||||||
if(!defined('PHPWORD_BASE_PATH')) {
|
if (!defined('PHPWORD_BASE_PATH')) {
|
||||||
define('PHPWORD_BASE_PATH', dirname(__FILE__) . '/');
|
define('PHPWORD_BASE_PATH', dirname(__FILE__) . '/');
|
||||||
require PHPWORD_BASE_PATH . 'PHPWord/Autoloader.php';
|
require PHPWORD_BASE_PATH . 'PHPWord/Autoloader.php';
|
||||||
PHPWord_Autoloader::Register();
|
PHPWord_Autoloader::Register();
|
||||||
@ -35,12 +35,9 @@ if(!defined('PHPWORD_BASE_PATH')) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPWord
|
* PHPWord
|
||||||
*
|
|
||||||
* @category PHPWord
|
|
||||||
* @package PHPWord
|
|
||||||
* @copyright Copyright (c) 2011 PHPWord
|
|
||||||
*/
|
*/
|
||||||
class PHPWord {
|
class PHPWord
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Document properties
|
* Document properties
|
||||||
@ -74,7 +71,8 @@ class PHPWord {
|
|||||||
/**
|
/**
|
||||||
* Create a new PHPWord Document
|
* Create a new PHPWord Document
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct()
|
||||||
|
{
|
||||||
$this->_properties = new PHPWord_DocumentProperties();
|
$this->_properties = new PHPWord_DocumentProperties();
|
||||||
$this->_defaultFontName = 'Arial';
|
$this->_defaultFontName = 'Arial';
|
||||||
$this->_defaultFontSize = 20;
|
$this->_defaultFontSize = 20;
|
||||||
@ -84,7 +82,8 @@ class PHPWord {
|
|||||||
* Get properties
|
* Get properties
|
||||||
* @return PHPWord_DocumentProperties
|
* @return PHPWord_DocumentProperties
|
||||||
*/
|
*/
|
||||||
public function getProperties() {
|
public function getProperties()
|
||||||
|
{
|
||||||
return $this->_properties;
|
return $this->_properties;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,7 +93,8 @@ class PHPWord {
|
|||||||
* @param PHPWord_DocumentProperties $value
|
* @param PHPWord_DocumentProperties $value
|
||||||
* @return PHPWord
|
* @return PHPWord
|
||||||
*/
|
*/
|
||||||
public function setProperties(PHPWord_DocumentProperties $value) {
|
public function setProperties(PHPWord_DocumentProperties $value)
|
||||||
|
{
|
||||||
$this->_properties = $value;
|
$this->_properties = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -105,7 +105,8 @@ class PHPWord {
|
|||||||
* @param PHPWord_Section_Settings $settings
|
* @param PHPWord_Section_Settings $settings
|
||||||
* @return PHPWord_Section
|
* @return PHPWord_Section
|
||||||
*/
|
*/
|
||||||
public function createSection($settings = null) {
|
public function createSection($settings = null)
|
||||||
|
{
|
||||||
$sectionCount = $this->_countSections() + 1;
|
$sectionCount = $this->_countSections() + 1;
|
||||||
|
|
||||||
$section = new PHPWord_Section($sectionCount, $settings);
|
$section = new PHPWord_Section($sectionCount, $settings);
|
||||||
@ -117,7 +118,8 @@ class PHPWord {
|
|||||||
* Get default Font name
|
* Get default Font name
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDefaultFontName() {
|
public function getDefaultFontName()
|
||||||
|
{
|
||||||
return $this->_defaultFontName;
|
return $this->_defaultFontName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +127,8 @@ class PHPWord {
|
|||||||
* Set default Font name
|
* Set default Font name
|
||||||
* @param string $pValue
|
* @param string $pValue
|
||||||
*/
|
*/
|
||||||
public function setDefaultFontName($pValue) {
|
public function setDefaultFontName($pValue)
|
||||||
|
{
|
||||||
$this->_defaultFontName = $pValue;
|
$this->_defaultFontName = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,7 +136,8 @@ class PHPWord {
|
|||||||
* Get default Font size
|
* Get default Font size
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getDefaultFontSize() {
|
public function getDefaultFontSize()
|
||||||
|
{
|
||||||
return $this->_defaultFontSize;
|
return $this->_defaultFontSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +145,8 @@ class PHPWord {
|
|||||||
* Set default Font size
|
* Set default Font size
|
||||||
* @param int $pValue
|
* @param int $pValue
|
||||||
*/
|
*/
|
||||||
public function setDefaultFontSize($pValue) {
|
public function setDefaultFontSize($pValue)
|
||||||
|
{
|
||||||
$pValue = $pValue * 2;
|
$pValue = $pValue * 2;
|
||||||
$this->_defaultFontSize = $pValue;
|
$this->_defaultFontSize = $pValue;
|
||||||
}
|
}
|
||||||
@ -152,7 +157,8 @@ class PHPWord {
|
|||||||
* @param $styleName string
|
* @param $styleName string
|
||||||
* @param $styles array
|
* @param $styles array
|
||||||
*/
|
*/
|
||||||
public function addParagraphStyle($styleName, $styles) {
|
public function addParagraphStyle($styleName, $styles)
|
||||||
|
{
|
||||||
PHPWord_Style::addParagraphStyle($styleName, $styles);
|
PHPWord_Style::addParagraphStyle($styleName, $styles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,7 +168,8 @@ class PHPWord {
|
|||||||
* @param $styleName string
|
* @param $styleName string
|
||||||
* @param $styles array
|
* @param $styles array
|
||||||
*/
|
*/
|
||||||
public function addFontStyle($styleName, $styleFont, $styleParagraph = null) {
|
public function addFontStyle($styleName, $styleFont, $styleParagraph = null)
|
||||||
|
{
|
||||||
PHPWord_Style::addFontStyle($styleName, $styleFont, $styleParagraph);
|
PHPWord_Style::addFontStyle($styleName, $styleFont, $styleParagraph);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -172,7 +179,8 @@ class PHPWord {
|
|||||||
* @param $styleName string
|
* @param $styleName string
|
||||||
* @param $styles array
|
* @param $styles array
|
||||||
*/
|
*/
|
||||||
public function addTableStyle($styleName, $styleTable, $styleFirstRow = null) {
|
public function addTableStyle($styleName, $styleTable, $styleFirstRow = null)
|
||||||
|
{
|
||||||
PHPWord_Style::addTableStyle($styleName, $styleTable, $styleFirstRow);
|
PHPWord_Style::addTableStyle($styleName, $styleTable, $styleFirstRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -182,7 +190,8 @@ class PHPWord {
|
|||||||
* @param $titleCount int
|
* @param $titleCount int
|
||||||
* @param $styles array
|
* @param $styles array
|
||||||
*/
|
*/
|
||||||
public function addTitleStyle($titleCount, $styleFont, $styleParagraph = null) {
|
public function addTitleStyle($titleCount, $styleFont, $styleParagraph = null)
|
||||||
|
{
|
||||||
PHPWord_Style::addTitleStyle($titleCount, $styleFont, $styleParagraph);
|
PHPWord_Style::addTitleStyle($titleCount, $styleFont, $styleParagraph);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,7 +201,8 @@ class PHPWord {
|
|||||||
* @param $styleName string
|
* @param $styleName string
|
||||||
* @param $styles array
|
* @param $styles array
|
||||||
*/
|
*/
|
||||||
public function addLinkStyle($styleName, $styles) {
|
public function addLinkStyle($styleName, $styles)
|
||||||
|
{
|
||||||
PHPWord_Style::addLinkStyle($styleName, $styles);
|
PHPWord_Style::addLinkStyle($styleName, $styles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,7 +210,8 @@ class PHPWord {
|
|||||||
* Get sections
|
* Get sections
|
||||||
* @return PHPWord_Section[]
|
* @return PHPWord_Section[]
|
||||||
*/
|
*/
|
||||||
public function getSections() {
|
public function getSections()
|
||||||
|
{
|
||||||
return $this->_sectionCollection;
|
return $this->_sectionCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +219,8 @@ class PHPWord {
|
|||||||
* Get section count
|
* Get section count
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
private function _countSections() {
|
private function _countSections()
|
||||||
|
{
|
||||||
return count($this->_sectionCollection);
|
return count($this->_sectionCollection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,12 +230,13 @@ class PHPWord {
|
|||||||
* @param string $strFilename
|
* @param string $strFilename
|
||||||
* @return PHPWord_Template
|
* @return PHPWord_Template
|
||||||
*/
|
*/
|
||||||
public function loadTemplate($strFilename) {
|
public function loadTemplate($strFilename)
|
||||||
if(file_exists($strFilename)) {
|
{
|
||||||
|
if (file_exists($strFilename)) {
|
||||||
$template = new PHPWord_Template($strFilename);
|
$template = new PHPWord_Template($strFilename);
|
||||||
return $template;
|
return $template;
|
||||||
} else {
|
} else {
|
||||||
trigger_error('Template file '.$strFilename.' not found.', E_USER_ERROR);
|
trigger_error('Template file ' . $strFilename . ' not found.', E_USER_ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
5
Classes/PHPWord/DocumentProperties.php
Normal file → Executable file
5
Classes/PHPWord/DocumentProperties.php
Normal file → Executable file
@ -20,14 +20,13 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPWord_DocumentProperties
|
* Class PHPWord_DocumentProperties
|
||||||
*/
|
*/
|
||||||
class PHPWord_DocumentProperties
|
class PHPWord_DocumentProperties
|
||||||
{
|
{
|
||||||
|
|||||||
17
Classes/PHPWord/Exception.php
Normal file → Executable file
17
Classes/PHPWord/Exception.php
Normal file → Executable file
@ -20,20 +20,16 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2009 - 2010 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version ##VERSION##, ##DATE##
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPWord_Exception
|
* Class PHPWord_Exception
|
||||||
*
|
|
||||||
* @category PHPWord
|
|
||||||
* @package PHPWord
|
|
||||||
* @copyright Copyright (c) 2006 - 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
|
||||||
*/
|
*/
|
||||||
class PHPWord_Exception extends Exception {
|
class PHPWord_Exception extends Exception
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Error handler callback
|
* Error handler callback
|
||||||
*
|
*
|
||||||
@ -43,7 +39,8 @@ class PHPWord_Exception extends Exception {
|
|||||||
* @param mixed $line
|
* @param mixed $line
|
||||||
* @param mixed $context
|
* @param mixed $context
|
||||||
*/
|
*/
|
||||||
public static function errorHandlerCallback($code, $string, $file, $line, $context) {
|
public static function errorHandlerCallback($code, $string, $file, $line, $context)
|
||||||
|
{
|
||||||
$e = new self($string, $code);
|
$e = new self($string, $code);
|
||||||
$e->line = $line;
|
$e->line = $line;
|
||||||
$e->file = $file;
|
$e->file = $file;
|
||||||
|
|||||||
3
Classes/PHPWord/HashTable.php
Normal file → Executable file
3
Classes/PHPWord/HashTable.php
Normal file → Executable file
@ -20,12 +20,11 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPWord_HashTable
|
* PHPWord_HashTable
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/IOFactory.php
Normal file → Executable file
2
Classes/PHPWord/IOFactory.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Media.php
Normal file → Executable file
2
Classes/PHPWord/Media.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
119
Classes/PHPWord/Section.php
Normal file → Executable file
119
Classes/PHPWord/Section.php
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPWord
|
* PHPWord
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 PHPWord
|
* Copyright (c) 2013 PHPWord
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,20 +20,16 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 010 PHPWord
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version Beta 0.6.3, 08.07.2011
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPWord_Section
|
* Class PHPWord_Section
|
||||||
*
|
|
||||||
* @category PHPWord
|
|
||||||
* @package PHPWord_Section
|
|
||||||
* @copyright Copyright (c) 2011 PHPWord
|
|
||||||
*/
|
*/
|
||||||
class PHPWord_Section {
|
class PHPWord_Section
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Section count
|
* Section count
|
||||||
@ -77,14 +73,15 @@ class PHPWord_Section {
|
|||||||
* @param int $sectionCount
|
* @param int $sectionCount
|
||||||
* @param mixed $settings
|
* @param mixed $settings
|
||||||
*/
|
*/
|
||||||
public function __construct($sectionCount, $settings = null) {
|
public function __construct($sectionCount, $settings = null)
|
||||||
|
{
|
||||||
$this->_sectionCount = $sectionCount;
|
$this->_sectionCount = $sectionCount;
|
||||||
$this->_settings = new PHPWord_Section_Settings();
|
$this->_settings = new PHPWord_Section_Settings();
|
||||||
|
|
||||||
if(!is_null($settings) && is_array($settings)) {
|
if (!is_null($settings) && is_array($settings)) {
|
||||||
foreach($settings as $key => $value) {
|
foreach ($settings as $key => $value) {
|
||||||
if(substr($key, 0, 1) != '_') {
|
if (substr($key, 0, 1) != '_') {
|
||||||
$key = '_'.$key;
|
$key = '_' . $key;
|
||||||
}
|
}
|
||||||
$this->_settings->setSettingValue($key, $value);
|
$this->_settings->setSettingValue($key, $value);
|
||||||
}
|
}
|
||||||
@ -96,7 +93,8 @@ class PHPWord_Section {
|
|||||||
*
|
*
|
||||||
* @return PHPWord_Section_Settings
|
* @return PHPWord_Section_Settings
|
||||||
*/
|
*/
|
||||||
public function getSettings() {
|
public function getSettings()
|
||||||
|
{
|
||||||
return $this->_settings;
|
return $this->_settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,8 +106,9 @@ class PHPWord_Section {
|
|||||||
* @param mixed $styleParagraph
|
* @param mixed $styleParagraph
|
||||||
* @return PHPWord_Section_Text
|
* @return PHPWord_Section_Text
|
||||||
*/
|
*/
|
||||||
public function addText($text, $styleFont = null, $styleParagraph = null) {
|
public function addText($text, $styleFont = null, $styleParagraph = null)
|
||||||
if(!PHPWord_Shared_String::IsUTF8($text)){
|
{
|
||||||
|
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||||
$text = utf8_encode($text);
|
$text = utf8_encode($text);
|
||||||
}
|
}
|
||||||
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
|
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
|
||||||
@ -126,12 +125,13 @@ class PHPWord_Section {
|
|||||||
* @param mixed $styleParagraph
|
* @param mixed $styleParagraph
|
||||||
* @return PHPWord_Section_Link
|
* @return PHPWord_Section_Link
|
||||||
*/
|
*/
|
||||||
public function addLink($linkSrc, $linkName = null, $styleFont = null, $styleParagraph = null) {
|
public function addLink($linkSrc, $linkName = null, $styleFont = null, $styleParagraph = null)
|
||||||
if(!PHPWord_Shared_String::IsUTF8($linkSrc)){
|
{
|
||||||
|
if (!PHPWord_Shared_String::IsUTF8($linkSrc)) {
|
||||||
$linkSrc = utf8_encode($linkSrc);
|
$linkSrc = utf8_encode($linkSrc);
|
||||||
}
|
}
|
||||||
if(!is_null($linkName)) {
|
if (!is_null($linkName)) {
|
||||||
if(!PHPWord_Shared_String::IsUTF8($linkName)){
|
if (!PHPWord_Shared_String::IsUTF8($linkName)) {
|
||||||
$linkName = utf8_encode($linkName);
|
$linkName = utf8_encode($linkName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,8 +149,9 @@ class PHPWord_Section {
|
|||||||
*
|
*
|
||||||
* @param int $count
|
* @param int $count
|
||||||
*/
|
*/
|
||||||
public function addTextBreak($count = 1) {
|
public function addTextBreak($count = 1)
|
||||||
for($i=1; $i<=$count; $i++) {
|
{
|
||||||
|
for ($i = 1; $i <= $count; $i++) {
|
||||||
$this->_elementCollection[] = new PHPWord_Section_TextBreak();
|
$this->_elementCollection[] = new PHPWord_Section_TextBreak();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,7 +159,8 @@ class PHPWord_Section {
|
|||||||
/**
|
/**
|
||||||
* Add a PageBreak Element
|
* Add a PageBreak Element
|
||||||
*/
|
*/
|
||||||
public function addPageBreak() {
|
public function addPageBreak()
|
||||||
|
{
|
||||||
$this->_elementCollection[] = new PHPWord_Section_PageBreak();
|
$this->_elementCollection[] = new PHPWord_Section_PageBreak();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +170,8 @@ class PHPWord_Section {
|
|||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @return PHPWord_Section_Table
|
* @return PHPWord_Section_Table
|
||||||
*/
|
*/
|
||||||
public function addTable($style = null) {
|
public function addTable($style = null)
|
||||||
|
{
|
||||||
$table = new PHPWord_Section_Table('section', $this->_sectionCount, $style);
|
$table = new PHPWord_Section_Table('section', $this->_sectionCount, $style);
|
||||||
$this->_elementCollection[] = $table;
|
$this->_elementCollection[] = $table;
|
||||||
return $table;
|
return $table;
|
||||||
@ -184,8 +187,9 @@ class PHPWord_Section {
|
|||||||
* @param mixed $styleParagraph
|
* @param mixed $styleParagraph
|
||||||
* @return PHPWord_Section_ListItem
|
* @return PHPWord_Section_ListItem
|
||||||
*/
|
*/
|
||||||
public function addListItem($text, $depth = 0, $styleFont = null, $styleList = null, $styleParagraph = null) {
|
public function addListItem($text, $depth = 0, $styleFont = null, $styleList = null, $styleParagraph = null)
|
||||||
if(!PHPWord_Shared_String::IsUTF8($text)){
|
{
|
||||||
|
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||||
$text = utf8_encode($text);
|
$text = utf8_encode($text);
|
||||||
}
|
}
|
||||||
$listItem = new PHPWord_Section_ListItem($text, $depth, $styleFont, $styleList, $styleParagraph);
|
$listItem = new PHPWord_Section_ListItem($text, $depth, $styleFont, $styleList, $styleParagraph);
|
||||||
@ -200,21 +204,22 @@ class PHPWord_Section {
|
|||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @return PHPWord_Section_Object
|
* @return PHPWord_Section_Object
|
||||||
*/
|
*/
|
||||||
public function addObject($src, $style = null) {
|
public function addObject($src, $style = null)
|
||||||
|
{
|
||||||
$object = new PHPWord_Section_Object($src, $style);
|
$object = new PHPWord_Section_Object($src, $style);
|
||||||
|
|
||||||
if(!is_null($object->getSource())) {
|
if (!is_null($object->getSource())) {
|
||||||
$inf = pathinfo($src);
|
$inf = pathinfo($src);
|
||||||
$ext = $inf['extension'];
|
$ext = $inf['extension'];
|
||||||
if(strlen($ext) == 4 && strtolower(substr($ext, -1)) == 'x') {
|
if (strlen($ext) == 4 && strtolower(substr($ext, -1)) == 'x') {
|
||||||
$ext = substr($ext, 0, -1);
|
$ext = substr($ext, 0, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$iconSrc = PHPWORD_BASE_PATH . 'PHPWord/_staticDocParts/';
|
$iconSrc = PHPWORD_BASE_PATH . 'PHPWord/_staticDocParts/';
|
||||||
if(!file_exists($iconSrc.'_'.$ext.'.png')) {
|
if (!file_exists($iconSrc . '_' . $ext . '.png')) {
|
||||||
$iconSrc = $iconSrc.'_default.png';
|
$iconSrc = $iconSrc . '_default.png';
|
||||||
} else {
|
} else {
|
||||||
$iconSrc .= '_'.$ext.'.png';
|
$iconSrc .= '_' . $ext . '.png';
|
||||||
}
|
}
|
||||||
|
|
||||||
$rIDimg = PHPWord_Media::addSectionMediaElement($iconSrc, 'image');
|
$rIDimg = PHPWord_Media::addSectionMediaElement($iconSrc, 'image');
|
||||||
@ -240,10 +245,11 @@ class PHPWord_Section {
|
|||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @return PHPWord_Section_Image
|
* @return PHPWord_Section_Image
|
||||||
*/
|
*/
|
||||||
public function addImage($src, $style = null) {
|
public function addImage($src, $style = null)
|
||||||
|
{
|
||||||
$image = new PHPWord_Section_Image($src, $style);
|
$image = new PHPWord_Section_Image($src, $style);
|
||||||
|
|
||||||
if(!is_null($image->getSource())) {
|
if (!is_null($image->getSource())) {
|
||||||
$rID = PHPWord_Media::addSectionMediaElement($src, 'image');
|
$rID = PHPWord_Media::addSectionMediaElement($src, 'image');
|
||||||
$image->setRelationId($rID);
|
$image->setRelationId($rID);
|
||||||
|
|
||||||
@ -261,9 +267,10 @@ class PHPWord_Section {
|
|||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @return PHPWord_Section_MemoryImage
|
* @return PHPWord_Section_MemoryImage
|
||||||
*/
|
*/
|
||||||
public function addMemoryImage($link, $style = null) {
|
public function addMemoryImage($link, $style = null)
|
||||||
|
{
|
||||||
$memoryImage = new PHPWord_Section_MemoryImage($link, $style);
|
$memoryImage = new PHPWord_Section_MemoryImage($link, $style);
|
||||||
if(!is_null($memoryImage->getSource())) {
|
if (!is_null($memoryImage->getSource())) {
|
||||||
$rID = PHPWord_Media::addSectionMediaElement($link, 'image', $memoryImage);
|
$rID = PHPWord_Media::addSectionMediaElement($link, 'image', $memoryImage);
|
||||||
$memoryImage->setRelationId($rID);
|
$memoryImage->setRelationId($rID);
|
||||||
|
|
||||||
@ -281,7 +288,8 @@ class PHPWord_Section {
|
|||||||
* @param mixed $styleTOC
|
* @param mixed $styleTOC
|
||||||
* @return PHPWord_TOC
|
* @return PHPWord_TOC
|
||||||
*/
|
*/
|
||||||
public function addTOC($styleFont = null, $styleTOC = null) {
|
public function addTOC($styleFont = null, $styleTOC = null)
|
||||||
|
{
|
||||||
$toc = new PHPWord_TOC($styleFont, $styleTOC);
|
$toc = new PHPWord_TOC($styleFont, $styleTOC);
|
||||||
$this->_elementCollection[] = $toc;
|
$this->_elementCollection[] = $toc;
|
||||||
return $toc;
|
return $toc;
|
||||||
@ -294,13 +302,14 @@ class PHPWord_Section {
|
|||||||
* @param int $depth
|
* @param int $depth
|
||||||
* @return PHPWord_Section_Title
|
* @return PHPWord_Section_Title
|
||||||
*/
|
*/
|
||||||
public function addTitle($text, $depth = 1) {
|
public function addTitle($text, $depth = 1)
|
||||||
if(!PHPWord_Shared_String::IsUTF8($text)){
|
{
|
||||||
|
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||||
$text = utf8_encode($text);
|
$text = utf8_encode($text);
|
||||||
}
|
}
|
||||||
$styles = PHPWord_Style::getStyles();
|
$styles = PHPWord_Style::getStyles();
|
||||||
if(array_key_exists('Heading_'.$depth, $styles)) {
|
if (array_key_exists('Heading_' . $depth, $styles)) {
|
||||||
$style = 'Heading'.$depth;
|
$style = 'Heading' . $depth;
|
||||||
} else {
|
} else {
|
||||||
$style = null;
|
$style = null;
|
||||||
}
|
}
|
||||||
@ -323,7 +332,8 @@ class PHPWord_Section {
|
|||||||
*
|
*
|
||||||
* @return PHPWord_Section_TextRun
|
* @return PHPWord_Section_TextRun
|
||||||
*/
|
*/
|
||||||
public function createTextRun($styleParagraph = null) {
|
public function createTextRun($styleParagraph = null)
|
||||||
|
{
|
||||||
$textRun = new PHPWord_Section_TextRun($styleParagraph);
|
$textRun = new PHPWord_Section_TextRun($styleParagraph);
|
||||||
$this->_elementCollection[] = $textRun;
|
$this->_elementCollection[] = $textRun;
|
||||||
return $textRun;
|
return $textRun;
|
||||||
@ -334,7 +344,8 @@ class PHPWord_Section {
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getElements() {
|
public function getElements()
|
||||||
|
{
|
||||||
return $this->_elementCollection;
|
return $this->_elementCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -343,7 +354,8 @@ class PHPWord_Section {
|
|||||||
*
|
*
|
||||||
* @return PHPWord_Section_Header
|
* @return PHPWord_Section_Header
|
||||||
*/
|
*/
|
||||||
public function createHeader() {
|
public function createHeader()
|
||||||
|
{
|
||||||
$header = new PHPWord_Section_Header($this->_sectionCount);
|
$header = new PHPWord_Section_Header($this->_sectionCount);
|
||||||
$this->_headers[] = $header;
|
$this->_headers[] = $header;
|
||||||
return $header;
|
return $header;
|
||||||
@ -354,7 +366,8 @@ class PHPWord_Section {
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getHeaders() {
|
public function getHeaders()
|
||||||
|
{
|
||||||
return $this->_headers;
|
return $this->_headers;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -367,8 +380,9 @@ class PHPWord_Section {
|
|||||||
*
|
*
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
*/
|
*/
|
||||||
public function hasDifferentFirstPage() {
|
public function hasDifferentFirstPage()
|
||||||
$value = array_filter($this->_headers, function(PHPWord_Section_Header &$header) {
|
{
|
||||||
|
$value = array_filter($this->_headers, function (PHPWord_Section_Header &$header) {
|
||||||
return $header->getType() == PHPWord_Section_Header::FIRST;
|
return $header->getType() == PHPWord_Section_Header::FIRST;
|
||||||
});
|
});
|
||||||
return count($value) > 0;
|
return count($value) > 0;
|
||||||
@ -379,7 +393,8 @@ class PHPWord_Section {
|
|||||||
*
|
*
|
||||||
* @return PHPWord_Section_Footer
|
* @return PHPWord_Section_Footer
|
||||||
*/
|
*/
|
||||||
public function createFooter() {
|
public function createFooter()
|
||||||
|
{
|
||||||
$footer = new PHPWord_Section_Footer($this->_sectionCount);
|
$footer = new PHPWord_Section_Footer($this->_sectionCount);
|
||||||
$this->_footer = $footer;
|
$this->_footer = $footer;
|
||||||
return $footer;
|
return $footer;
|
||||||
@ -390,8 +405,8 @@ class PHPWord_Section {
|
|||||||
*
|
*
|
||||||
* @return PHPWord_Section_Footer
|
* @return PHPWord_Section_Footer
|
||||||
*/
|
*/
|
||||||
public function getFooter() {
|
public function getFooter()
|
||||||
|
{
|
||||||
return $this->_footer;
|
return $this->_footer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
61
Classes/PHPWord/Section/Footer.php
Normal file → Executable file
61
Classes/PHPWord/Section/Footer.php
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPWord
|
* PHPWord
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 PHPWord
|
* Copyright (c) 2013 PHPWord
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,20 +20,16 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 010 PHPWord
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version Beta 0.6.3, 08.07.2011
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPWord_Section_Footer
|
* PHPWord_Section_Footer
|
||||||
*
|
|
||||||
* @category PHPWord
|
|
||||||
* @package PHPWord_Section
|
|
||||||
* @copyright Copyright (c) 2011 PHPWord
|
|
||||||
*/
|
*/
|
||||||
class PHPWord_Section_Footer {
|
class PHPWord_Section_Footer
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Footer Count
|
* Footer Count
|
||||||
@ -59,7 +55,8 @@ class PHPWord_Section_Footer {
|
|||||||
/**
|
/**
|
||||||
* Create a new Footer
|
* Create a new Footer
|
||||||
*/
|
*/
|
||||||
public function __construct($sectionCount) {
|
public function __construct($sectionCount)
|
||||||
|
{
|
||||||
$this->_footerCount = $sectionCount;
|
$this->_footerCount = $sectionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,8 +68,9 @@ class PHPWord_Section_Footer {
|
|||||||
* @param mixed $styleParagraph
|
* @param mixed $styleParagraph
|
||||||
* @return PHPWord_Section_Text
|
* @return PHPWord_Section_Text
|
||||||
*/
|
*/
|
||||||
public function addText($text, $styleFont = null, $styleParagraph = null) {
|
public function addText($text, $styleFont = null, $styleParagraph = null)
|
||||||
if(!PHPWord_Shared_String::IsUTF8($text)){
|
{
|
||||||
|
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||||
$text = utf8_encode($text);
|
$text = utf8_encode($text);
|
||||||
}
|
}
|
||||||
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
|
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
|
||||||
@ -85,8 +83,9 @@ class PHPWord_Section_Footer {
|
|||||||
*
|
*
|
||||||
* @param int $count
|
* @param int $count
|
||||||
*/
|
*/
|
||||||
public function addTextBreak($count = 1) {
|
public function addTextBreak($count = 1)
|
||||||
for($i=1; $i<=$count; $i++) {
|
{
|
||||||
|
for ($i = 1; $i <= $count; $i++) {
|
||||||
$this->_elementCollection[] = new PHPWord_Section_TextBreak();
|
$this->_elementCollection[] = new PHPWord_Section_TextBreak();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -96,7 +95,8 @@ class PHPWord_Section_Footer {
|
|||||||
*
|
*
|
||||||
* @return PHPWord_Section_TextRun
|
* @return PHPWord_Section_TextRun
|
||||||
*/
|
*/
|
||||||
public function createTextRun($styleParagraph = null) {
|
public function createTextRun($styleParagraph = null)
|
||||||
|
{
|
||||||
$textRun = new PHPWord_Section_TextRun($styleParagraph);
|
$textRun = new PHPWord_Section_TextRun($styleParagraph);
|
||||||
$this->_elementCollection[] = $textRun;
|
$this->_elementCollection[] = $textRun;
|
||||||
return $textRun;
|
return $textRun;
|
||||||
@ -108,7 +108,8 @@ class PHPWord_Section_Footer {
|
|||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @return PHPWord_Section_Table
|
* @return PHPWord_Section_Table
|
||||||
*/
|
*/
|
||||||
public function addTable($style = null) {
|
public function addTable($style = null)
|
||||||
|
{
|
||||||
$table = new PHPWord_Section_Table('footer', $this->_footerCount, $style);
|
$table = new PHPWord_Section_Table('footer', $this->_footerCount, $style);
|
||||||
$this->_elementCollection[] = $table;
|
$this->_elementCollection[] = $table;
|
||||||
return $table;
|
return $table;
|
||||||
@ -121,10 +122,11 @@ class PHPWord_Section_Footer {
|
|||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @return PHPWord_Section_Image
|
* @return PHPWord_Section_Image
|
||||||
*/
|
*/
|
||||||
public function addImage($src, $style = null) {
|
public function addImage($src, $style = null)
|
||||||
|
{
|
||||||
$image = new PHPWord_Section_Image($src, $style);
|
$image = new PHPWord_Section_Image($src, $style);
|
||||||
|
|
||||||
if(!is_null($image->getSource())) {
|
if (!is_null($image->getSource())) {
|
||||||
$rID = PHPWord_Media::addFooterMediaElement($this->_footerCount, $src);
|
$rID = PHPWord_Media::addFooterMediaElement($this->_footerCount, $src);
|
||||||
$image->setRelationId($rID);
|
$image->setRelationId($rID);
|
||||||
|
|
||||||
@ -142,9 +144,10 @@ class PHPWord_Section_Footer {
|
|||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @return PHPWord_Section_MemoryImage
|
* @return PHPWord_Section_MemoryImage
|
||||||
*/
|
*/
|
||||||
public function addMemoryImage($link, $style = null) {
|
public function addMemoryImage($link, $style = null)
|
||||||
|
{
|
||||||
$memoryImage = new PHPWord_Section_MemoryImage($link, $style);
|
$memoryImage = new PHPWord_Section_MemoryImage($link, $style);
|
||||||
if(!is_null($memoryImage->getSource())) {
|
if (!is_null($memoryImage->getSource())) {
|
||||||
$rID = PHPWord_Media::addFooterMediaElement($this->_footerCount, $link, $memoryImage);
|
$rID = PHPWord_Media::addFooterMediaElement($this->_footerCount, $link, $memoryImage);
|
||||||
$memoryImage->setRelationId($rID);
|
$memoryImage->setRelationId($rID);
|
||||||
|
|
||||||
@ -163,8 +166,9 @@ class PHPWord_Section_Footer {
|
|||||||
* @param mixed $styleParagraph
|
* @param mixed $styleParagraph
|
||||||
* @return PHPWord_Section_Footer_PreserveText
|
* @return PHPWord_Section_Footer_PreserveText
|
||||||
*/
|
*/
|
||||||
public function addPreserveText($text, $styleFont = null, $styleParagraph = null) {
|
public function addPreserveText($text, $styleFont = null, $styleParagraph = null)
|
||||||
if(!PHPWord_Shared_String::IsUTF8($text)){
|
{
|
||||||
|
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||||
$text = utf8_encode($text);
|
$text = utf8_encode($text);
|
||||||
}
|
}
|
||||||
$ptext = new PHPWord_Section_Footer_PreserveText($text, $styleFont, $styleParagraph);
|
$ptext = new PHPWord_Section_Footer_PreserveText($text, $styleFont, $styleParagraph);
|
||||||
@ -175,7 +179,8 @@ class PHPWord_Section_Footer {
|
|||||||
/**
|
/**
|
||||||
* Get Footer Relation ID
|
* Get Footer Relation ID
|
||||||
*/
|
*/
|
||||||
public function getRelationId() {
|
public function getRelationId()
|
||||||
|
{
|
||||||
return $this->_rId;
|
return $this->_rId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -184,22 +189,24 @@ class PHPWord_Section_Footer {
|
|||||||
*
|
*
|
||||||
* @param int $rId
|
* @param int $rId
|
||||||
*/
|
*/
|
||||||
public function setRelationId($rId) {
|
public function setRelationId($rId)
|
||||||
|
{
|
||||||
$this->_rId = $rId;
|
$this->_rId = $rId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all Footer Elements
|
* Get all Footer Elements
|
||||||
*/
|
*/
|
||||||
public function getElements() {
|
public function getElements()
|
||||||
|
{
|
||||||
return $this->_elementCollection;
|
return $this->_elementCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Footer Count
|
* Get Footer Count
|
||||||
*/
|
*/
|
||||||
public function getFooterCount() {
|
public function getFooterCount()
|
||||||
|
{
|
||||||
return $this->_footerCount;
|
return $this->_footerCount;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
2
Classes/PHPWord/Section/Footer/PreserveText.php
Normal file → Executable file
2
Classes/PHPWord/Section/Footer/PreserveText.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
78
Classes/PHPWord/Section/Header.php
Normal file → Executable file
78
Classes/PHPWord/Section/Header.php
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPWord
|
* PHPWord
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 PHPWord
|
* Copyright (c) 2013 PHPWord
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,20 +20,16 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 010 PHPWord
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version Beta 0.6.3, 08.07.2011
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPWord_Section_Header
|
* PHPWord_Section_Header
|
||||||
*
|
|
||||||
* @category PHPWord
|
|
||||||
* @package PHPWord_Section
|
|
||||||
* @copyright Copyright (c) 2011 PHPWord
|
|
||||||
*/
|
*/
|
||||||
class PHPWord_Section_Header {
|
class PHPWord_Section_Header
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Header Count
|
* Header Count
|
||||||
@ -88,7 +84,8 @@ class PHPWord_Section_Header {
|
|||||||
/**
|
/**
|
||||||
* Create a new Header
|
* Create a new Header
|
||||||
*/
|
*/
|
||||||
public function __construct($sectionCount) {
|
public function __construct($sectionCount)
|
||||||
|
{
|
||||||
$this->_headerCount = $sectionCount;
|
$this->_headerCount = $sectionCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,8 +97,9 @@ class PHPWord_Section_Header {
|
|||||||
* @param mixed $styleParagraph
|
* @param mixed $styleParagraph
|
||||||
* @return PHPWord_Section_Text
|
* @return PHPWord_Section_Text
|
||||||
*/
|
*/
|
||||||
public function addText($text, $styleFont = null, $styleParagraph = null) {
|
public function addText($text, $styleFont = null, $styleParagraph = null)
|
||||||
if(!PHPWord_Shared_String::IsUTF8($text)){
|
{
|
||||||
|
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||||
$text = utf8_encode($text);
|
$text = utf8_encode($text);
|
||||||
}
|
}
|
||||||
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
|
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
|
||||||
@ -114,8 +112,9 @@ class PHPWord_Section_Header {
|
|||||||
*
|
*
|
||||||
* @param int $count
|
* @param int $count
|
||||||
*/
|
*/
|
||||||
public function addTextBreak($count = 1) {
|
public function addTextBreak($count = 1)
|
||||||
for($i=1; $i<=$count; $i++) {
|
{
|
||||||
|
for ($i = 1; $i <= $count; $i++) {
|
||||||
$this->_elementCollection[] = new PHPWord_Section_TextBreak();
|
$this->_elementCollection[] = new PHPWord_Section_TextBreak();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,7 +124,8 @@ class PHPWord_Section_Header {
|
|||||||
*
|
*
|
||||||
* @return PHPWord_Section_TextRun
|
* @return PHPWord_Section_TextRun
|
||||||
*/
|
*/
|
||||||
public function createTextRun($styleParagraph = null) {
|
public function createTextRun($styleParagraph = null)
|
||||||
|
{
|
||||||
$textRun = new PHPWord_Section_TextRun($styleParagraph);
|
$textRun = new PHPWord_Section_TextRun($styleParagraph);
|
||||||
$this->_elementCollection[] = $textRun;
|
$this->_elementCollection[] = $textRun;
|
||||||
return $textRun;
|
return $textRun;
|
||||||
@ -137,7 +137,8 @@ class PHPWord_Section_Header {
|
|||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @return PHPWord_Section_Table
|
* @return PHPWord_Section_Table
|
||||||
*/
|
*/
|
||||||
public function addTable($style = null) {
|
public function addTable($style = null)
|
||||||
|
{
|
||||||
$table = new PHPWord_Section_Table('header', $this->_headerCount, $style);
|
$table = new PHPWord_Section_Table('header', $this->_headerCount, $style);
|
||||||
$this->_elementCollection[] = $table;
|
$this->_elementCollection[] = $table;
|
||||||
return $table;
|
return $table;
|
||||||
@ -150,10 +151,11 @@ class PHPWord_Section_Header {
|
|||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @return PHPWord_Section_Image
|
* @return PHPWord_Section_Image
|
||||||
*/
|
*/
|
||||||
public function addImage($src, $style = null) {
|
public function addImage($src, $style = null)
|
||||||
|
{
|
||||||
$image = new PHPWord_Section_Image($src, $style);
|
$image = new PHPWord_Section_Image($src, $style);
|
||||||
|
|
||||||
if(!is_null($image->getSource())) {
|
if (!is_null($image->getSource())) {
|
||||||
$rID = PHPWord_Media::addHeaderMediaElement($this->_headerCount, $src);
|
$rID = PHPWord_Media::addHeaderMediaElement($this->_headerCount, $src);
|
||||||
$image->setRelationId($rID);
|
$image->setRelationId($rID);
|
||||||
|
|
||||||
@ -171,9 +173,10 @@ class PHPWord_Section_Header {
|
|||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @return PHPWord_Section_MemoryImage
|
* @return PHPWord_Section_MemoryImage
|
||||||
*/
|
*/
|
||||||
public function addMemoryImage($link, $style = null) {
|
public function addMemoryImage($link, $style = null)
|
||||||
|
{
|
||||||
$memoryImage = new PHPWord_Section_MemoryImage($link, $style);
|
$memoryImage = new PHPWord_Section_MemoryImage($link, $style);
|
||||||
if(!is_null($memoryImage->getSource())) {
|
if (!is_null($memoryImage->getSource())) {
|
||||||
$rID = PHPWord_Media::addHeaderMediaElement($this->_headerCount, $link, $memoryImage);
|
$rID = PHPWord_Media::addHeaderMediaElement($this->_headerCount, $link, $memoryImage);
|
||||||
$memoryImage->setRelationId($rID);
|
$memoryImage->setRelationId($rID);
|
||||||
|
|
||||||
@ -192,8 +195,9 @@ class PHPWord_Section_Header {
|
|||||||
* @param mixed $styleParagraph
|
* @param mixed $styleParagraph
|
||||||
* @return PHPWord_Section_Footer_PreserveText
|
* @return PHPWord_Section_Footer_PreserveText
|
||||||
*/
|
*/
|
||||||
public function addPreserveText($text, $styleFont = null, $styleParagraph = null) {
|
public function addPreserveText($text, $styleFont = null, $styleParagraph = null)
|
||||||
if(!PHPWord_Shared_String::IsUTF8($text)){
|
{
|
||||||
|
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||||
$text = utf8_encode($text);
|
$text = utf8_encode($text);
|
||||||
}
|
}
|
||||||
$ptext = new PHPWord_Section_Footer_PreserveText($text, $styleFont, $styleParagraph);
|
$ptext = new PHPWord_Section_Footer_PreserveText($text, $styleFont, $styleParagraph);
|
||||||
@ -208,10 +212,11 @@ class PHPWord_Section_Header {
|
|||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @return PHPWord_Section_Image
|
* @return PHPWord_Section_Image
|
||||||
*/
|
*/
|
||||||
public function addWatermark($src, $style = null) {
|
public function addWatermark($src, $style = null)
|
||||||
|
{
|
||||||
$image = new PHPWord_Section_Image($src, $style, true);
|
$image = new PHPWord_Section_Image($src, $style, true);
|
||||||
|
|
||||||
if(!is_null($image->getSource())) {
|
if (!is_null($image->getSource())) {
|
||||||
$rID = PHPWord_Media::addHeaderMediaElement($this->_headerCount, $src);
|
$rID = PHPWord_Media::addHeaderMediaElement($this->_headerCount, $src);
|
||||||
$image->setRelationId($rID);
|
$image->setRelationId($rID);
|
||||||
|
|
||||||
@ -225,7 +230,8 @@ class PHPWord_Section_Header {
|
|||||||
/**
|
/**
|
||||||
* Get Header Relation ID
|
* Get Header Relation ID
|
||||||
*/
|
*/
|
||||||
public function getRelationId() {
|
public function getRelationId()
|
||||||
|
{
|
||||||
return $this->_rId;
|
return $this->_rId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,51 +240,57 @@ class PHPWord_Section_Header {
|
|||||||
*
|
*
|
||||||
* @param int $rId
|
* @param int $rId
|
||||||
*/
|
*/
|
||||||
public function setRelationId($rId) {
|
public function setRelationId($rId)
|
||||||
|
{
|
||||||
$this->_rId = $rId;
|
$this->_rId = $rId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all Header Elements
|
* Get all Header Elements
|
||||||
*/
|
*/
|
||||||
public function getElements() {
|
public function getElements()
|
||||||
|
{
|
||||||
return $this->_elementCollection;
|
return $this->_elementCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Header Count
|
* Get Header Count
|
||||||
*/
|
*/
|
||||||
public function getHeaderCount() {
|
public function getHeaderCount()
|
||||||
|
{
|
||||||
return $this->_headerCount;
|
return $this->_headerCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Header Type
|
* Get Header Type
|
||||||
*/
|
*/
|
||||||
public function getType() {
|
public function getType()
|
||||||
|
{
|
||||||
return $this->_type;
|
return $this->_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset back to default
|
* Reset back to default
|
||||||
*/
|
*/
|
||||||
public function resetType() {
|
public function resetType()
|
||||||
|
{
|
||||||
return $this->_type = PHPWord_Section_Header::AUTO;
|
return $this->_type = PHPWord_Section_Header::AUTO;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* First page only header
|
* First page only header
|
||||||
*/
|
*/
|
||||||
public function firstPage() {
|
public function firstPage()
|
||||||
|
{
|
||||||
return $this->_type = PHPWord_Section_Header::FIRST;
|
return $this->_type = PHPWord_Section_Header::FIRST;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Even numbered Pages only
|
* Even numbered Pages only
|
||||||
*/
|
*/
|
||||||
public function evenPage() {
|
public function evenPage()
|
||||||
|
{
|
||||||
return $this->_type = PHPWord_Section_Header::EVEN;
|
return $this->_type = PHPWord_Section_Header::EVEN;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
2
Classes/PHPWord/Section/Image.php
Normal file → Executable file
2
Classes/PHPWord/Section/Image.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Section/Link.php
Normal file → Executable file
2
Classes/PHPWord/Section/Link.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Section/ListItem.php
Normal file → Executable file
2
Classes/PHPWord/Section/ListItem.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Section/MemoryImage.php
Normal file → Executable file
2
Classes/PHPWord/Section/MemoryImage.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Section/Object.php
Normal file → Executable file
2
Classes/PHPWord/Section/Object.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Section/PageBreak.php
Normal file → Executable file
2
Classes/PHPWord/Section/PageBreak.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Section/Settings.php
Normal file → Executable file
2
Classes/PHPWord/Section/Settings.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Section/Table.php
Normal file → Executable file
2
Classes/PHPWord/Section/Table.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
106
Classes/PHPWord/Section/Table/Cell.php
Normal file → Executable file
106
Classes/PHPWord/Section/Table/Cell.php
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPWord
|
* PHPWord
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 PHPWord
|
* Copyright (c) 2013 PHPWord
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,20 +20,16 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 010 PHPWord
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version Beta 0.6.3, 08.07.2011
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPWord_Section_Table_Cell
|
* PHPWord_Section_Table_Cell
|
||||||
*
|
|
||||||
* @category PHPWord
|
|
||||||
* @package PHPWord_Section_Table
|
|
||||||
* @copyright Copyright (c) 2011 PHPWord
|
|
||||||
*/
|
*/
|
||||||
class PHPWord_Section_Table_Cell {
|
class PHPWord_Section_Table_Cell
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cell Width
|
* Cell Width
|
||||||
@ -79,18 +75,19 @@ class PHPWord_Section_Table_Cell {
|
|||||||
* @param int $width
|
* @param int $width
|
||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
*/
|
*/
|
||||||
public function __construct($insideOf, $pCount, $width = null, $style = null) {
|
public function __construct($insideOf, $pCount, $width = null, $style = null)
|
||||||
|
{
|
||||||
$this->_insideOf = $insideOf;
|
$this->_insideOf = $insideOf;
|
||||||
$this->_pCount = $pCount;
|
$this->_pCount = $pCount;
|
||||||
$this->_width = $width;
|
$this->_width = $width;
|
||||||
|
|
||||||
if(!is_null($style)) {
|
if (!is_null($style)) {
|
||||||
if(is_array($style)) {
|
if (is_array($style)) {
|
||||||
$this->_style = new PHPWord_Style_Cell();
|
$this->_style = new PHPWord_Style_Cell();
|
||||||
|
|
||||||
foreach($style as $key => $value) {
|
foreach ($style as $key => $value) {
|
||||||
if(substr($key, 0, 1) != '_') {
|
if (substr($key, 0, 1) != '_') {
|
||||||
$key = '_'.$key;
|
$key = '_' . $key;
|
||||||
}
|
}
|
||||||
$this->_style->setStyleValue($key, $value);
|
$this->_style->setStyleValue($key, $value);
|
||||||
}
|
}
|
||||||
@ -107,8 +104,9 @@ class PHPWord_Section_Table_Cell {
|
|||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @return PHPWord_Section_Text
|
* @return PHPWord_Section_Text
|
||||||
*/
|
*/
|
||||||
public function addText($text, $styleFont = null, $styleParagraph = null) {
|
public function addText($text, $styleFont = null, $styleParagraph = null)
|
||||||
if(!PHPWord_Shared_String::IsUTF8($text)){
|
{
|
||||||
|
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||||
$text = utf8_encode($text);
|
$text = utf8_encode($text);
|
||||||
}
|
}
|
||||||
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
|
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
|
||||||
@ -124,13 +122,14 @@ class PHPWord_Section_Table_Cell {
|
|||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @return PHPWord_Section_Link
|
* @return PHPWord_Section_Link
|
||||||
*/
|
*/
|
||||||
public function addLink($linkSrc, $linkName = null, $style = null) {
|
public function addLink($linkSrc, $linkName = null, $style = null)
|
||||||
if($this->_insideOf == 'section') {
|
{
|
||||||
if(!PHPWord_Shared_String::IsUTF8($linkSrc)){
|
if ($this->_insideOf == 'section') {
|
||||||
|
if (!PHPWord_Shared_String::IsUTF8($linkSrc)) {
|
||||||
$linkSrc = utf8_encode($linkSrc);
|
$linkSrc = utf8_encode($linkSrc);
|
||||||
}
|
}
|
||||||
if(!is_null($linkName)) {
|
if (!is_null($linkName)) {
|
||||||
if(!PHPWord_Shared_String::IsUTF8($linkName)){
|
if (!PHPWord_Shared_String::IsUTF8($linkName)) {
|
||||||
$linkName = utf8_encode($linkName);
|
$linkName = utf8_encode($linkName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,7 +151,8 @@ class PHPWord_Section_Table_Cell {
|
|||||||
*
|
*
|
||||||
* @param int $count
|
* @param int $count
|
||||||
*/
|
*/
|
||||||
public function addTextBreak() {
|
public function addTextBreak()
|
||||||
|
{
|
||||||
$this->_elementCollection[] = new PHPWord_Section_TextBreak();
|
$this->_elementCollection[] = new PHPWord_Section_TextBreak();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,8 +165,9 @@ class PHPWord_Section_Table_Cell {
|
|||||||
* @param mixed $styleList
|
* @param mixed $styleList
|
||||||
* @return PHPWord_Section_ListItem
|
* @return PHPWord_Section_ListItem
|
||||||
*/
|
*/
|
||||||
public function addListItem($text, $depth = 0, $styleText = null, $styleList = null) {
|
public function addListItem($text, $depth = 0, $styleText = null, $styleList = null)
|
||||||
if(!PHPWord_Shared_String::IsUTF8($text)){
|
{
|
||||||
|
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||||
$text = utf8_encode($text);
|
$text = utf8_encode($text);
|
||||||
}
|
}
|
||||||
$listItem = new PHPWord_Section_ListItem($text, $depth, $styleText, $styleList);
|
$listItem = new PHPWord_Section_ListItem($text, $depth, $styleText, $styleList);
|
||||||
@ -181,15 +182,16 @@ class PHPWord_Section_Table_Cell {
|
|||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @return PHPWord_Section_Image
|
* @return PHPWord_Section_Image
|
||||||
*/
|
*/
|
||||||
public function addImage($src, $style = null) {
|
public function addImage($src, $style = null)
|
||||||
|
{
|
||||||
$image = new PHPWord_Section_Image($src, $style);
|
$image = new PHPWord_Section_Image($src, $style);
|
||||||
|
|
||||||
if(!is_null($image->getSource())) {
|
if (!is_null($image->getSource())) {
|
||||||
if($this->_insideOf == 'section') {
|
if ($this->_insideOf == 'section') {
|
||||||
$rID = PHPWord_Media::addSectionMediaElement($src, 'image');
|
$rID = PHPWord_Media::addSectionMediaElement($src, 'image');
|
||||||
} elseif($this->_insideOf == 'header') {
|
} elseif ($this->_insideOf == 'header') {
|
||||||
$rID = PHPWord_Media::addHeaderMediaElement($this->_pCount, $src);
|
$rID = PHPWord_Media::addHeaderMediaElement($this->_pCount, $src);
|
||||||
} elseif($this->_insideOf == 'footer') {
|
} elseif ($this->_insideOf == 'footer') {
|
||||||
$rID = PHPWord_Media::addFooterMediaElement($this->_pCount, $src);
|
$rID = PHPWord_Media::addFooterMediaElement($this->_pCount, $src);
|
||||||
}
|
}
|
||||||
$image->setRelationId($rID);
|
$image->setRelationId($rID);
|
||||||
@ -208,14 +210,15 @@ class PHPWord_Section_Table_Cell {
|
|||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @return PHPWord_Section_MemoryImage
|
* @return PHPWord_Section_MemoryImage
|
||||||
*/
|
*/
|
||||||
public function addMemoryImage($link, $style = null) {
|
public function addMemoryImage($link, $style = null)
|
||||||
|
{
|
||||||
$memoryImage = new PHPWord_Section_MemoryImage($link, $style);
|
$memoryImage = new PHPWord_Section_MemoryImage($link, $style);
|
||||||
if(!is_null($memoryImage->getSource())) {
|
if (!is_null($memoryImage->getSource())) {
|
||||||
if($this->_insideOf == 'section') {
|
if ($this->_insideOf == 'section') {
|
||||||
$rID = PHPWord_Media::addSectionMediaElement($link, 'image', $memoryImage);
|
$rID = PHPWord_Media::addSectionMediaElement($link, 'image', $memoryImage);
|
||||||
} elseif($this->_insideOf == 'header') {
|
} elseif ($this->_insideOf == 'header') {
|
||||||
$rID = PHPWord_Media::addHeaderMediaElement($this->_pCount, $link, $memoryImage);
|
$rID = PHPWord_Media::addHeaderMediaElement($this->_pCount, $link, $memoryImage);
|
||||||
} elseif($this->_insideOf == 'footer') {
|
} elseif ($this->_insideOf == 'footer') {
|
||||||
$rID = PHPWord_Media::addFooterMediaElement($this->_pCount, $link, $memoryImage);
|
$rID = PHPWord_Media::addFooterMediaElement($this->_pCount, $link, $memoryImage);
|
||||||
}
|
}
|
||||||
$memoryImage->setRelationId($rID);
|
$memoryImage->setRelationId($rID);
|
||||||
@ -234,21 +237,22 @@ class PHPWord_Section_Table_Cell {
|
|||||||
* @param mixed $style
|
* @param mixed $style
|
||||||
* @return PHPWord_Section_Object
|
* @return PHPWord_Section_Object
|
||||||
*/
|
*/
|
||||||
public function addObject($src, $style = null) {
|
public function addObject($src, $style = null)
|
||||||
|
{
|
||||||
$object = new PHPWord_Section_Object($src, $style);
|
$object = new PHPWord_Section_Object($src, $style);
|
||||||
|
|
||||||
if(!is_null($object->getSource())) {
|
if (!is_null($object->getSource())) {
|
||||||
$inf = pathinfo($src);
|
$inf = pathinfo($src);
|
||||||
$ext = $inf['extension'];
|
$ext = $inf['extension'];
|
||||||
if(strlen($ext) == 4 && strtolower(substr($ext, -1)) == 'x') {
|
if (strlen($ext) == 4 && strtolower(substr($ext, -1)) == 'x') {
|
||||||
$ext = substr($ext, 0, -1);
|
$ext = substr($ext, 0, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$iconSrc = PHPWORD_BASE_PATH . 'PHPWord/_staticDocParts/';
|
$iconSrc = PHPWORD_BASE_PATH . 'PHPWord/_staticDocParts/';
|
||||||
if(!file_exists($iconSrc.'_'.$ext.'.png')) {
|
if (!file_exists($iconSrc . '_' . $ext . '.png')) {
|
||||||
$iconSrc = $iconSrc.'_default.png';
|
$iconSrc = $iconSrc . '_default.png';
|
||||||
} else {
|
} else {
|
||||||
$iconSrc .= '_'.$ext.'.png';
|
$iconSrc .= '_' . $ext . '.png';
|
||||||
}
|
}
|
||||||
|
|
||||||
$rIDimg = PHPWord_Media::addSectionMediaElement($iconSrc, 'image');
|
$rIDimg = PHPWord_Media::addSectionMediaElement($iconSrc, 'image');
|
||||||
@ -275,9 +279,10 @@ class PHPWord_Section_Table_Cell {
|
|||||||
* @param mixed $styleParagraph
|
* @param mixed $styleParagraph
|
||||||
* @return PHPWord_Section_Footer_PreserveText
|
* @return PHPWord_Section_Footer_PreserveText
|
||||||
*/
|
*/
|
||||||
public function addPreserveText($text, $styleFont = null, $styleParagraph = null) {
|
public function addPreserveText($text, $styleFont = null, $styleParagraph = null)
|
||||||
if($this->_insideOf == 'footer' || $this->_insideOf == 'header') {
|
{
|
||||||
if(!PHPWord_Shared_String::IsUTF8($text)){
|
if ($this->_insideOf == 'footer' || $this->_insideOf == 'header') {
|
||||||
|
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||||
$text = utf8_encode($text);
|
$text = utf8_encode($text);
|
||||||
}
|
}
|
||||||
$ptext = new PHPWord_Section_Footer_PreserveText($text, $styleFont, $styleParagraph);
|
$ptext = new PHPWord_Section_Footer_PreserveText($text, $styleFont, $styleParagraph);
|
||||||
@ -293,7 +298,8 @@ class PHPWord_Section_Table_Cell {
|
|||||||
*
|
*
|
||||||
* @return PHPWord_Section_TextRun
|
* @return PHPWord_Section_TextRun
|
||||||
*/
|
*/
|
||||||
public function createTextRun($styleParagraph = null) {
|
public function createTextRun($styleParagraph = null)
|
||||||
|
{
|
||||||
$textRun = new PHPWord_Section_TextRun($styleParagraph);
|
$textRun = new PHPWord_Section_TextRun($styleParagraph);
|
||||||
$this->_elementCollection[] = $textRun;
|
$this->_elementCollection[] = $textRun;
|
||||||
return $textRun;
|
return $textRun;
|
||||||
@ -304,7 +310,8 @@ class PHPWord_Section_Table_Cell {
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function getElements() {
|
public function getElements()
|
||||||
|
{
|
||||||
return $this->_elementCollection;
|
return $this->_elementCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,7 +320,8 @@ class PHPWord_Section_Table_Cell {
|
|||||||
*
|
*
|
||||||
* @return PHPWord_Style_Cell
|
* @return PHPWord_Style_Cell
|
||||||
*/
|
*/
|
||||||
public function getStyle() {
|
public function getStyle()
|
||||||
|
{
|
||||||
return $this->_style;
|
return $this->_style;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,8 +330,8 @@ class PHPWord_Section_Table_Cell {
|
|||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getWidth() {
|
public function getWidth()
|
||||||
|
{
|
||||||
return $this->_width;
|
return $this->_width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
|||||||
2
Classes/PHPWord/Section/Text.php
Normal file → Executable file
2
Classes/PHPWord/Section/Text.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Section/TextBreak.php
Normal file → Executable file
2
Classes/PHPWord/Section/TextBreak.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
42
Classes/PHPWord/Section/TextRun.php
Normal file → Executable file
42
Classes/PHPWord/Section/TextRun.php
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPWord
|
* PHPWord
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 PHPWord
|
* Copyright (c) 2013 PHPWord
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,20 +20,16 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 010 PHPWord
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version Beta 0.6.3, 08.07.2011
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPWord_Section_TextRun
|
* PHPWord_Section_TextRun
|
||||||
*
|
|
||||||
* @category PHPWord
|
|
||||||
* @package PHPWord_Section
|
|
||||||
* @copyright Copyright (c) 2011 PHPWord
|
|
||||||
*/
|
*/
|
||||||
class PHPWord_Section_TextRun {
|
class PHPWord_Section_TextRun
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paragraph style
|
* Paragraph style
|
||||||
@ -53,16 +49,17 @@ class PHPWord_Section_TextRun {
|
|||||||
/**
|
/**
|
||||||
* Create a new TextRun Element
|
* Create a new TextRun Element
|
||||||
*/
|
*/
|
||||||
public function __construct($styleParagraph = null) {
|
public function __construct($styleParagraph = null)
|
||||||
|
{
|
||||||
$this->_elementCollection = array();
|
$this->_elementCollection = array();
|
||||||
|
|
||||||
// Set paragraph style
|
// Set paragraph style
|
||||||
if(is_array($styleParagraph)) {
|
if (is_array($styleParagraph)) {
|
||||||
$this->_styleParagraph = new PHPWord_Style_Paragraph();
|
$this->_styleParagraph = new PHPWord_Style_Paragraph();
|
||||||
|
|
||||||
foreach($styleParagraph as $key => $value) {
|
foreach ($styleParagraph as $key => $value) {
|
||||||
if(substr($key, 0, 1) != '_') {
|
if (substr($key, 0, 1) != '_') {
|
||||||
$key = '_'.$key;
|
$key = '_' . $key;
|
||||||
}
|
}
|
||||||
$this->_styleParagraph->setStyleValue($key, $value);
|
$this->_styleParagraph->setStyleValue($key, $value);
|
||||||
}
|
}
|
||||||
@ -79,8 +76,9 @@ class PHPWord_Section_TextRun {
|
|||||||
* @var mixed $styleFont
|
* @var mixed $styleFont
|
||||||
* @return PHPWord_Section_Text
|
* @return PHPWord_Section_Text
|
||||||
*/
|
*/
|
||||||
public function addText($text = null, $styleFont = null) {
|
public function addText($text = null, $styleFont = null)
|
||||||
if(!PHPWord_Shared_String::IsUTF8($text)){
|
{
|
||||||
|
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||||
$text = utf8_encode($text);
|
$text = utf8_encode($text);
|
||||||
}
|
}
|
||||||
$text = new PHPWord_Section_Text($text, $styleFont);
|
$text = new PHPWord_Section_Text($text, $styleFont);
|
||||||
@ -96,9 +94,10 @@ class PHPWord_Section_TextRun {
|
|||||||
* @param mixed $styleFont
|
* @param mixed $styleFont
|
||||||
* @return PHPWord_Section_Link
|
* @return PHPWord_Section_Link
|
||||||
*/
|
*/
|
||||||
public function addLink($linkSrc, $linkName = null, $styleFont = null) {
|
public function addLink($linkSrc, $linkName = null, $styleFont = null)
|
||||||
|
{
|
||||||
$linkSrc = utf8_encode($linkSrc);
|
$linkSrc = utf8_encode($linkSrc);
|
||||||
if(!is_null($linkName)) {
|
if (!is_null($linkName)) {
|
||||||
$linkName = utf8_encode($linkName);
|
$linkName = utf8_encode($linkName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +114,8 @@ class PHPWord_Section_TextRun {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getElements() {
|
public function getElements()
|
||||||
|
{
|
||||||
return $this->_elementCollection;
|
return $this->_elementCollection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,8 +124,8 @@ class PHPWord_Section_TextRun {
|
|||||||
*
|
*
|
||||||
* @return PHPWord_Style_Paragraph
|
* @return PHPWord_Style_Paragraph
|
||||||
*/
|
*/
|
||||||
public function getParagraphStyle() {
|
public function getParagraphStyle()
|
||||||
|
{
|
||||||
return $this->_styleParagraph;
|
return $this->_styleParagraph;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
2
Classes/PHPWord/Section/Title.php
Normal file → Executable file
2
Classes/PHPWord/Section/Title.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Shared/Drawing.php
Normal file → Executable file
2
Classes/PHPWord/Shared/Drawing.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Shared/File.php
Normal file → Executable file
2
Classes/PHPWord/Shared/File.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Shared/Font.php
Normal file → Executable file
2
Classes/PHPWord/Shared/Font.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
35
Classes/PHPWord/Shared/String.php
Normal file → Executable file
35
Classes/PHPWord/Shared/String.php
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPWord
|
* PHPWord
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 PHPWord
|
* Copyright (c) 2013 PHPWord
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,12 +20,14 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 010 PHPWord
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version Beta 0.6.3, 08.07.2011
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class PHPWord_Shared_String
|
||||||
|
*/
|
||||||
class PHPWord_Shared_String
|
class PHPWord_Shared_String
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
@ -52,10 +54,11 @@ class PHPWord_Shared_String
|
|||||||
/**
|
/**
|
||||||
* Build control characters array
|
* Build control characters array
|
||||||
*/
|
*/
|
||||||
private static function _buildControlCharacters() {
|
private static function _buildControlCharacters()
|
||||||
|
{
|
||||||
for ($i = 0; $i <= 19; ++$i) {
|
for ($i = 0; $i <= 19; ++$i) {
|
||||||
if ($i != 9 && $i != 10 && $i != 13) {
|
if ($i != 9 && $i != 10 && $i != 13) {
|
||||||
$find = '_x' . sprintf('%04s' , strtoupper(dechex($i))) . '_';
|
$find = '_x' . sprintf('%04s', strtoupper(dechex($i))) . '_';
|
||||||
$replace = chr($i);
|
$replace = chr($i);
|
||||||
self::$_controlCharacters[$find] = $replace;
|
self::$_controlCharacters[$find] = $replace;
|
||||||
}
|
}
|
||||||
@ -110,12 +113,13 @@ class PHPWord_Shared_String
|
|||||||
* @param string $value Value to unescape
|
* @param string $value Value to unescape
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function ControlCharacterOOXML2PHP($value = '') {
|
public static function ControlCharacterOOXML2PHP($value = '')
|
||||||
if(empty(self::$_controlCharacters)) {
|
{
|
||||||
|
if (empty(self::$_controlCharacters)) {
|
||||||
self::_buildControlCharacters();
|
self::_buildControlCharacters();
|
||||||
}
|
}
|
||||||
|
|
||||||
return str_replace( array_keys(self::$_controlCharacters), array_values(self::$_controlCharacters), $value );
|
return str_replace(array_keys(self::$_controlCharacters), array_values(self::$_controlCharacters), $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -132,12 +136,13 @@ class PHPWord_Shared_String
|
|||||||
* @param string $value Value to escape
|
* @param string $value Value to escape
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function ControlCharacterPHP2OOXML($value = '') {
|
public static function ControlCharacterPHP2OOXML($value = '')
|
||||||
if(empty(self::$_controlCharacters)) {
|
{
|
||||||
|
if (empty(self::$_controlCharacters)) {
|
||||||
self::_buildControlCharacters();
|
self::_buildControlCharacters();
|
||||||
}
|
}
|
||||||
|
|
||||||
return str_replace( array_values(self::$_controlCharacters), array_keys(self::$_controlCharacters), $value );
|
return str_replace(array_values(self::$_controlCharacters), array_keys(self::$_controlCharacters), $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,7 +151,8 @@ class PHPWord_Shared_String
|
|||||||
* @param string $value
|
* @param string $value
|
||||||
* @return boolean
|
* @return boolean
|
||||||
*/
|
*/
|
||||||
public static function IsUTF8($value = '') {
|
public static function IsUTF8($value = '')
|
||||||
|
{
|
||||||
return $value === '' || preg_match('/^./su', $value) === 1;
|
return $value === '' || preg_match('/^./su', $value) === 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +162,8 @@ class PHPWord_Shared_String
|
|||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function FormatNumber($value) {
|
public static function FormatNumber($value)
|
||||||
|
{
|
||||||
return number_format($value, 2, '.', '');
|
return number_format($value, 2, '.', '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
Classes/PHPWord/Shared/XMLWriter.php
Normal file → Executable file
2
Classes/PHPWord/Shared/XMLWriter.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Shared/ZipStreamWrapper.php
Normal file → Executable file
2
Classes/PHPWord/Shared/ZipStreamWrapper.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Style.php
Normal file → Executable file
2
Classes/PHPWord/Style.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
121
Classes/PHPWord/Style/Cell.php
Normal file → Executable file
121
Classes/PHPWord/Style/Cell.php
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPWord
|
* PHPWord
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 PHPWord
|
* Copyright (c) 2013 PHPWord
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,20 +20,16 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 010 PHPWord
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version Beta 0.6.3, 08.07.2011
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPWord_Style_Cell
|
* PHPWord_Style_Cell
|
||||||
*
|
|
||||||
* @category PHPWord
|
|
||||||
* @package PHPWord_Style
|
|
||||||
* @copyright Copyright (c) 2011 PHPWord
|
|
||||||
*/
|
*/
|
||||||
class PHPWord_Style_Cell {
|
class PHPWord_Style_Cell
|
||||||
|
{
|
||||||
|
|
||||||
const TEXT_DIR_BTLR = 'btLr';
|
const TEXT_DIR_BTLR = 'btLr';
|
||||||
const TEXT_DIR_TBRL = 'tbRl';
|
const TEXT_DIR_TBRL = 'tbRl';
|
||||||
@ -139,7 +135,8 @@ class PHPWord_Style_Cell {
|
|||||||
/**
|
/**
|
||||||
* Create a new Cell Style
|
* Create a new Cell Style
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct()
|
||||||
|
{
|
||||||
$this->_valign = null;
|
$this->_valign = null;
|
||||||
$this->_textDirection = null;
|
$this->_textDirection = null;
|
||||||
$this->_bgColor = null;
|
$this->_bgColor = null;
|
||||||
@ -160,52 +157,62 @@ class PHPWord_Style_Cell {
|
|||||||
* @var string $key
|
* @var string $key
|
||||||
* @var mixed $value
|
* @var mixed $value
|
||||||
*/
|
*/
|
||||||
public function setStyleValue($key, $value) {
|
public function setStyleValue($key, $value)
|
||||||
if($key == '_borderSize') {
|
{
|
||||||
|
if ($key == '_borderSize') {
|
||||||
$this->setBorderSize($value);
|
$this->setBorderSize($value);
|
||||||
} elseif($key == '_borderColor') {
|
} elseif ($key == '_borderColor') {
|
||||||
$this->setBorderColor($value);
|
$this->setBorderColor($value);
|
||||||
} else {
|
} else {
|
||||||
$this->$key = $value;
|
$this->$key = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getVAlign() {
|
public function getVAlign()
|
||||||
|
{
|
||||||
return $this->_valign;
|
return $this->_valign;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setVAlign($pValue = null) {
|
public function setVAlign($pValue = null)
|
||||||
|
{
|
||||||
$this->_valign = $pValue;
|
$this->_valign = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTextDirection() {
|
public function getTextDirection()
|
||||||
|
{
|
||||||
return $this->_textDirection;
|
return $this->_textDirection;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setTextDirection($pValue = null) {
|
public function setTextDirection($pValue = null)
|
||||||
|
{
|
||||||
$this->_textDirection = $pValue;
|
$this->_textDirection = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBgColor() {
|
public function getBgColor()
|
||||||
|
{
|
||||||
return $this->_bgColor;
|
return $this->_bgColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setBgColor($pValue = null) {
|
public function setBgColor($pValue = null)
|
||||||
|
{
|
||||||
$this->_bgColor = $pValue;
|
$this->_bgColor = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setHeight($pValue = null) {
|
public function setHeight($pValue = null)
|
||||||
|
{
|
||||||
$this->_height = $pValue;
|
$this->_height = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setBorderSize($pValue = null) {
|
public function setBorderSize($pValue = null)
|
||||||
|
{
|
||||||
$this->_borderTopSize = $pValue;
|
$this->_borderTopSize = $pValue;
|
||||||
$this->_borderLeftSize = $pValue;
|
$this->_borderLeftSize = $pValue;
|
||||||
$this->_borderRightSize = $pValue;
|
$this->_borderRightSize = $pValue;
|
||||||
$this->_borderBottomSize = $pValue;
|
$this->_borderBottomSize = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBorderSize() {
|
public function getBorderSize()
|
||||||
|
{
|
||||||
$t = $this->getBorderTopSize();
|
$t = $this->getBorderTopSize();
|
||||||
$l = $this->getBorderLeftSize();
|
$l = $this->getBorderLeftSize();
|
||||||
$r = $this->getBorderRightSize();
|
$r = $this->getBorderRightSize();
|
||||||
@ -214,14 +221,16 @@ class PHPWord_Style_Cell {
|
|||||||
return array($t, $l, $r, $b);
|
return array($t, $l, $r, $b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setBorderColor($pValue = null) {
|
public function setBorderColor($pValue = null)
|
||||||
|
{
|
||||||
$this->_borderTopColor = $pValue;
|
$this->_borderTopColor = $pValue;
|
||||||
$this->_borderLeftColor = $pValue;
|
$this->_borderLeftColor = $pValue;
|
||||||
$this->_borderRightColor = $pValue;
|
$this->_borderRightColor = $pValue;
|
||||||
$this->_borderBottomColor = $pValue;
|
$this->_borderBottomColor = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBorderColor() {
|
public function getBorderColor()
|
||||||
|
{
|
||||||
$t = $this->getBorderTopColor();
|
$t = $this->getBorderTopColor();
|
||||||
$l = $this->getBorderLeftColor();
|
$l = $this->getBorderLeftColor();
|
||||||
$r = $this->getBorderRightColor();
|
$r = $this->getBorderRightColor();
|
||||||
@ -230,89 +239,109 @@ class PHPWord_Style_Cell {
|
|||||||
return array($t, $l, $r, $b);
|
return array($t, $l, $r, $b);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setBorderTopSize($pValue = null) {
|
public function setBorderTopSize($pValue = null)
|
||||||
|
{
|
||||||
$this->_borderTopSize = $pValue;
|
$this->_borderTopSize = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBorderTopSize() {
|
public function getBorderTopSize()
|
||||||
|
{
|
||||||
return $this->_borderTopSize;
|
return $this->_borderTopSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setBorderTopColor($pValue = null) {
|
public function setBorderTopColor($pValue = null)
|
||||||
|
{
|
||||||
$this->_borderTopColor = $pValue;
|
$this->_borderTopColor = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBorderTopColor() {
|
public function getBorderTopColor()
|
||||||
|
{
|
||||||
return $this->_borderTopColor;
|
return $this->_borderTopColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setBorderLeftSize($pValue = null) {
|
public function setBorderLeftSize($pValue = null)
|
||||||
|
{
|
||||||
$this->_borderLeftSize = $pValue;
|
$this->_borderLeftSize = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBorderLeftSize() {
|
public function getBorderLeftSize()
|
||||||
|
{
|
||||||
return $this->_borderLeftSize;
|
return $this->_borderLeftSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setBorderLeftColor($pValue = null) {
|
public function setBorderLeftColor($pValue = null)
|
||||||
|
{
|
||||||
$this->_borderLeftColor = $pValue;
|
$this->_borderLeftColor = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBorderLeftColor() {
|
public function getBorderLeftColor()
|
||||||
|
{
|
||||||
return $this->_borderLeftColor;
|
return $this->_borderLeftColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setBorderRightSize($pValue = null) {
|
public function setBorderRightSize($pValue = null)
|
||||||
|
{
|
||||||
$this->_borderRightSize = $pValue;
|
$this->_borderRightSize = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBorderRightSize() {
|
public function getBorderRightSize()
|
||||||
|
{
|
||||||
return $this->_borderRightSize;
|
return $this->_borderRightSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setBorderRightColor($pValue = null) {
|
public function setBorderRightColor($pValue = null)
|
||||||
|
{
|
||||||
$this->_borderRightColor = $pValue;
|
$this->_borderRightColor = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBorderRightColor() {
|
public function getBorderRightColor()
|
||||||
|
{
|
||||||
return $this->_borderRightColor;
|
return $this->_borderRightColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public function setBorderBottomSize($pValue = null) {
|
public function setBorderBottomSize($pValue = null)
|
||||||
|
{
|
||||||
$this->_borderBottomSize = $pValue;
|
$this->_borderBottomSize = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBorderBottomSize() {
|
public function getBorderBottomSize()
|
||||||
|
{
|
||||||
return $this->_borderBottomSize;
|
return $this->_borderBottomSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setBorderBottomColor($pValue = null) {
|
public function setBorderBottomColor($pValue = null)
|
||||||
|
{
|
||||||
$this->_borderBottomColor = $pValue;
|
$this->_borderBottomColor = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getBorderBottomColor() {
|
public function getBorderBottomColor()
|
||||||
|
{
|
||||||
return $this->_borderBottomColor;
|
return $this->_borderBottomColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDefaultBorderColor() {
|
public function getDefaultBorderColor()
|
||||||
|
{
|
||||||
return $this->_defaultBorderColor;
|
return $this->_defaultBorderColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setGridSpan($pValue = null) {
|
public function setGridSpan($pValue = null)
|
||||||
|
{
|
||||||
$this->_gridSpan = $pValue;
|
$this->_gridSpan = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getGridSpan() {
|
public function getGridSpan()
|
||||||
|
{
|
||||||
return $this->_gridSpan;
|
return $this->_gridSpan;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setVMerge($pValue = null) {
|
public function setVMerge($pValue = null)
|
||||||
|
{
|
||||||
$this->_vMerge = $pValue;
|
$this->_vMerge = $pValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getVMerge() {
|
public function getVMerge()
|
||||||
|
{
|
||||||
return $this->_vMerge;
|
return $this->_vMerge;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
2
Classes/PHPWord/Style/Font.php
Normal file → Executable file
2
Classes/PHPWord/Style/Font.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Style/Image.php
Normal file → Executable file
2
Classes/PHPWord/Style/Image.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Style/ListItem.php
Normal file → Executable file
2
Classes/PHPWord/Style/ListItem.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
62
Classes/PHPWord/Style/Paragraph.php
Normal file → Executable file
62
Classes/PHPWord/Style/Paragraph.php
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPWord
|
* PHPWord
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 PHPWord
|
* Copyright (c) 2013 PHPWord
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,20 +20,16 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 010 PHPWord
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version Beta 0.6.3, 08.07.2011
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPWord_Style_Paragraph
|
* PHPWord_Style_Paragraph
|
||||||
*
|
|
||||||
* @category PHPWord
|
|
||||||
* @package PHPWord_Style
|
|
||||||
* @copyright Copyright (c) 2011 PHPWord
|
|
||||||
*/
|
*/
|
||||||
class PHPWord_Style_Paragraph {
|
class PHPWord_Style_Paragraph
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paragraph alignment
|
* Paragraph alignment
|
||||||
@ -81,7 +77,8 @@ class PHPWord_Style_Paragraph {
|
|||||||
/**
|
/**
|
||||||
* New Paragraph Style
|
* New Paragraph Style
|
||||||
*/
|
*/
|
||||||
public function __construct() {
|
public function __construct()
|
||||||
|
{
|
||||||
$this->_align = null;
|
$this->_align = null;
|
||||||
$this->_spaceBefore = null;
|
$this->_spaceBefore = null;
|
||||||
$this->_spaceAfter = null;
|
$this->_spaceAfter = null;
|
||||||
@ -96,14 +93,15 @@ class PHPWord_Style_Paragraph {
|
|||||||
* @param string $key
|
* @param string $key
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
*/
|
*/
|
||||||
public function setStyleValue($key, $value) {
|
public function setStyleValue($key, $value)
|
||||||
if($key == '_indent') {
|
{
|
||||||
|
if ($key == '_indent') {
|
||||||
$value = (int)$value * 720; // 720 twips per indent
|
$value = (int)$value * 720; // 720 twips per indent
|
||||||
}
|
}
|
||||||
if($key == '_spacing') {
|
if ($key == '_spacing') {
|
||||||
$value += 240; // because line height of 1 matches 240 twips
|
$value += 240; // because line height of 1 matches 240 twips
|
||||||
}
|
}
|
||||||
if($key === '_tabs') {
|
if ($key === '_tabs') {
|
||||||
$value = new PHPWord_Style_Tabs($value);
|
$value = new PHPWord_Style_Tabs($value);
|
||||||
}
|
}
|
||||||
$this->$key = $value;
|
$this->$key = $value;
|
||||||
@ -114,7 +112,8 @@ class PHPWord_Style_Paragraph {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getAlign() {
|
public function getAlign()
|
||||||
|
{
|
||||||
return $this->_align;
|
return $this->_align;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,8 +123,9 @@ class PHPWord_Style_Paragraph {
|
|||||||
* @param string $pValue
|
* @param string $pValue
|
||||||
* @return PHPWord_Style_Paragraph
|
* @return PHPWord_Style_Paragraph
|
||||||
*/
|
*/
|
||||||
public function setAlign($pValue = null) {
|
public function setAlign($pValue = null)
|
||||||
if(strtolower($pValue) == 'justify') {
|
{
|
||||||
|
if (strtolower($pValue) == 'justify') {
|
||||||
// justify becames both
|
// justify becames both
|
||||||
$pValue = 'both';
|
$pValue = 'both';
|
||||||
}
|
}
|
||||||
@ -138,7 +138,8 @@ class PHPWord_Style_Paragraph {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSpaceBefore() {
|
public function getSpaceBefore()
|
||||||
|
{
|
||||||
return $this->_spaceBefore;
|
return $this->_spaceBefore;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +149,8 @@ class PHPWord_Style_Paragraph {
|
|||||||
* @param int $pValue
|
* @param int $pValue
|
||||||
* @return PHPWord_Style_Paragraph
|
* @return PHPWord_Style_Paragraph
|
||||||
*/
|
*/
|
||||||
public function setSpaceBefore($pValue = null) {
|
public function setSpaceBefore($pValue = null)
|
||||||
|
{
|
||||||
$this->_spaceBefore = $pValue;
|
$this->_spaceBefore = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -158,7 +160,8 @@ class PHPWord_Style_Paragraph {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getSpaceAfter() {
|
public function getSpaceAfter()
|
||||||
|
{
|
||||||
return $this->_spaceAfter;
|
return $this->_spaceAfter;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +171,8 @@ class PHPWord_Style_Paragraph {
|
|||||||
* @param int $pValue
|
* @param int $pValue
|
||||||
* @return PHPWord_Style_Paragraph
|
* @return PHPWord_Style_Paragraph
|
||||||
*/
|
*/
|
||||||
public function setSpaceAfter($pValue = null) {
|
public function setSpaceAfter($pValue = null)
|
||||||
|
{
|
||||||
$this->_spaceAfter = $pValue;
|
$this->_spaceAfter = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -178,7 +182,8 @@ class PHPWord_Style_Paragraph {
|
|||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getSpacing() {
|
public function getSpacing()
|
||||||
|
{
|
||||||
return $this->_spacing;
|
return $this->_spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +193,8 @@ class PHPWord_Style_Paragraph {
|
|||||||
* @param int $pValue
|
* @param int $pValue
|
||||||
* @return PHPWord_Style_Paragraph
|
* @return PHPWord_Style_Paragraph
|
||||||
*/
|
*/
|
||||||
public function setSpacing($pValue = null) {
|
public function setSpacing($pValue = null)
|
||||||
|
{
|
||||||
$this->_spacing = $pValue;
|
$this->_spacing = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -198,7 +204,8 @@ class PHPWord_Style_Paragraph {
|
|||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
public function getIndent() {
|
public function getIndent()
|
||||||
|
{
|
||||||
return $this->_indent;
|
return $this->_indent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +215,8 @@ class PHPWord_Style_Paragraph {
|
|||||||
* @param int $pValue
|
* @param int $pValue
|
||||||
* @return PHPWord_Style_Paragraph
|
* @return PHPWord_Style_Paragraph
|
||||||
*/
|
*/
|
||||||
public function setIndent($pValue = null) {
|
public function setIndent($pValue = null)
|
||||||
|
{
|
||||||
$this->_indent = $pValue;
|
$this->_indent = $pValue;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@ -218,8 +226,8 @@ class PHPWord_Style_Paragraph {
|
|||||||
*
|
*
|
||||||
* @return PHPWord_Style_Tabs
|
* @return PHPWord_Style_Tabs
|
||||||
*/
|
*/
|
||||||
public function getTabs() {
|
public function getTabs()
|
||||||
|
{
|
||||||
return $this->_tabs;
|
return $this->_tabs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
2
Classes/PHPWord/Style/TOC.php
Normal file → Executable file
2
Classes/PHPWord/Style/TOC.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
31
Classes/PHPWord/Style/Tab.php
Normal file → Executable file
31
Classes/PHPWord/Style/Tab.php
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPWord
|
* PHPWord
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 PHPWord
|
* Copyright (c) 2013 PHPWord
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,20 +20,16 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 010 PHPWord
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version {something}
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPWord_Style_Tabs
|
* PHPWord_Style_Tabs
|
||||||
*
|
|
||||||
* @category PHPWord
|
|
||||||
* @package PHPWord_Style_Paragraph
|
|
||||||
* @copyright Copyright (c) 2011 PHPWord
|
|
||||||
* @link http://www.schemacentral.com/sc/ooxml/e-w_tab-1.html w:tab
|
|
||||||
*/
|
*/
|
||||||
class PHPWord_Style_Tab {
|
class PHPWord_Style_Tab
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tab Stop Type
|
* Tab Stop Type
|
||||||
@ -96,7 +92,8 @@ class PHPWord_Style_Tab {
|
|||||||
* @param int $position Must be an integer; otherwise defaults to 0.
|
* @param int $position Must be an integer; otherwise defaults to 0.
|
||||||
* @param string $leader Defaults to NULL if value is not possible.
|
* @param string $leader Defaults to NULL if value is not possible.
|
||||||
*/
|
*/
|
||||||
public function __construct($val = NULL, $position = 0, $leader = NULL) {
|
public function __construct($val = NULL, $position = 0, $leader = NULL)
|
||||||
|
{
|
||||||
// Default to clear if the stop type is not matched
|
// Default to clear if the stop type is not matched
|
||||||
$this->_val = (self::isStopType($val)) ? $val : 'clear';
|
$this->_val = (self::isStopType($val)) ? $val : 'clear';
|
||||||
|
|
||||||
@ -112,11 +109,12 @@ class PHPWord_Style_Tab {
|
|||||||
*
|
*
|
||||||
* @param PHPWord_Shared_XMLWriter $objWriter
|
* @param PHPWord_Shared_XMLWriter $objWriter
|
||||||
*/
|
*/
|
||||||
public function toXml(PHPWord_Shared_XMLWriter &$objWriter = NULL) {
|
public function toXml(PHPWord_Shared_XMLWriter &$objWriter = NULL)
|
||||||
if(isset($objWriter)) {
|
{
|
||||||
|
if (isset($objWriter)) {
|
||||||
$objWriter->startElement("w:tab");
|
$objWriter->startElement("w:tab");
|
||||||
$objWriter->writeAttribute("w:val", $this->_val);
|
$objWriter->writeAttribute("w:val", $this->_val);
|
||||||
if(!is_null($this->_leader)) {
|
if (!is_null($this->_leader)) {
|
||||||
$objWriter->writeAttribute("w:leader", $this->_leader);
|
$objWriter->writeAttribute("w:leader", $this->_leader);
|
||||||
}
|
}
|
||||||
$objWriter->writeAttribute("w:pos", $this->_position);
|
$objWriter->writeAttribute("w:pos", $this->_position);
|
||||||
@ -130,7 +128,8 @@ class PHPWord_Style_Tab {
|
|||||||
* @param string $attribute
|
* @param string $attribute
|
||||||
* @return bool True if it is; false otherwise.
|
* @return bool True if it is; false otherwise.
|
||||||
*/
|
*/
|
||||||
private static function isStopType($attribute) {
|
private static function isStopType($attribute)
|
||||||
|
{
|
||||||
return in_array($attribute, self::$_possibleStopTypes);
|
return in_array($attribute, self::$_possibleStopTypes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -140,8 +139,8 @@ class PHPWord_Style_Tab {
|
|||||||
* @param string $attribute
|
* @param string $attribute
|
||||||
* @return bool True if it is; false otherwise.
|
* @return bool True if it is; false otherwise.
|
||||||
*/
|
*/
|
||||||
private static function isLeaderType($attribute) {
|
private static function isLeaderType($attribute)
|
||||||
|
{
|
||||||
return in_array($attribute, self::$_possibleLeaders);
|
return in_array($attribute, self::$_possibleLeaders);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
2
Classes/PHPWord/Style/Table.php
Normal file → Executable file
2
Classes/PHPWord/Style/Table.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Style/TableFull.php
Normal file → Executable file
2
Classes/PHPWord/Style/TableFull.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
23
Classes/PHPWord/Style/Tabs.php
Normal file → Executable file
23
Classes/PHPWord/Style/Tabs.php
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPWord
|
* PHPWord
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 PHPWord
|
* Copyright (c) 2013 PHPWord
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,20 +20,16 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 010 PHPWord
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version {something}
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPWord_Style_Tabs
|
* PHPWord_Style_Tabs
|
||||||
*
|
|
||||||
* @category PHPWord
|
|
||||||
* @package PHPWord_Style_Paragraph
|
|
||||||
* @copyright Copyright (c) 2011 PHPWord
|
|
||||||
* @link http://www.schemacentral.com/sc/ooxml/e-w_tabs-1.html w:tabs
|
|
||||||
*/
|
*/
|
||||||
class PHPWord_Style_Tabs {
|
class PHPWord_Style_Tabs
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tabs
|
* Tabs
|
||||||
@ -46,7 +42,8 @@ class PHPWord_Style_Tabs {
|
|||||||
*
|
*
|
||||||
* @param array $tabs
|
* @param array $tabs
|
||||||
*/
|
*/
|
||||||
public function __construct(array $tabs) {
|
public function __construct(array $tabs)
|
||||||
|
{
|
||||||
$this->_tabs = $tabs;
|
$this->_tabs = $tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,8 +51,9 @@ class PHPWord_Style_Tabs {
|
|||||||
*
|
*
|
||||||
* @param PHPWord_Shared_XMLWriter $objWriter
|
* @param PHPWord_Shared_XMLWriter $objWriter
|
||||||
*/
|
*/
|
||||||
public function toXml(PHPWord_Shared_XMLWriter &$objWriter = NULL) {
|
public function toXml(PHPWord_Shared_XMLWriter &$objWriter = NULL)
|
||||||
if(isset($objWriter)) {
|
{
|
||||||
|
if (isset($objWriter)) {
|
||||||
$objWriter->startElement("w:tabs");
|
$objWriter->startElement("w:tabs");
|
||||||
foreach ($this->_tabs as &$tab) {
|
foreach ($this->_tabs as &$tab) {
|
||||||
$tab->toXml($objWriter);
|
$tab->toXml($objWriter);
|
||||||
@ -64,4 +62,3 @@ class PHPWord_Style_Tabs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
2
Classes/PHPWord/TOC.php
Normal file → Executable file
2
Classes/PHPWord/TOC.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
40
Classes/PHPWord/Template.php
Normal file → Executable file
40
Classes/PHPWord/Template.php
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPWord
|
* PHPWord
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 PHPWord
|
* Copyright (c) 2013 PHPWord
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,20 +20,16 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 010 PHPWord
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version Beta 0.6.3, 08.07.2011
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PHPWord_DocumentProperties
|
* PHPWord_DocumentProperties
|
||||||
*
|
|
||||||
* @category PHPWord
|
|
||||||
* @package PHPWord
|
|
||||||
* @copyright Copyright (c) 2009 - 2011 PHPWord (http://www.codeplex.com/PHPWord)
|
|
||||||
*/
|
*/
|
||||||
class PHPWord_Template {
|
class PHPWord_Template
|
||||||
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ZipArchive
|
* ZipArchive
|
||||||
@ -62,12 +58,13 @@ class PHPWord_Template {
|
|||||||
*
|
*
|
||||||
* @param string $strFilename
|
* @param string $strFilename
|
||||||
*/
|
*/
|
||||||
public function __construct($strFilename) {
|
public function __construct($strFilename)
|
||||||
|
{
|
||||||
$this->_tempFileName = tempnam(sys_get_temp_dir(), '');
|
$this->_tempFileName = tempnam(sys_get_temp_dir(), '');
|
||||||
if ($this->_tempFileName !== false) {
|
if ($this->_tempFileName !== false) {
|
||||||
// Copy the source File to the temp File
|
// Copy the source File to the temp File
|
||||||
if(!copy($strFilename, $this->_tempFileName)){
|
if (!copy($strFilename, $this->_tempFileName)) {
|
||||||
throw new PHPWord_Exception('Could not copy the template from '.$strFilename.' to '.$this->_tempFileName.'.');
|
throw new PHPWord_Exception('Could not copy the template from ' . $strFilename . ' to ' . $this->_tempFileName . '.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_objZip = new ZipArchive();
|
$this->_objZip = new ZipArchive();
|
||||||
@ -85,7 +82,8 @@ class PHPWord_Template {
|
|||||||
* @param mixed $search
|
* @param mixed $search
|
||||||
* @param mixed $replace
|
* @param mixed $replace
|
||||||
*/
|
*/
|
||||||
public function setValue($search, $replace) {
|
public function setValue($search, $replace)
|
||||||
|
{
|
||||||
$pattern = '|\$\{([^\}]+)\}|U';
|
$pattern = '|\$\{([^\}]+)\}|U';
|
||||||
preg_match_all($pattern, $this->_documentXML, $matches);
|
preg_match_all($pattern, $this->_documentXML, $matches);
|
||||||
foreach ($matches[0] as $value) {
|
foreach ($matches[0] as $value) {
|
||||||
@ -94,12 +92,12 @@ class PHPWord_Template {
|
|||||||
$this->_documentXML = str_replace($value, $valueCleaned, $this->_documentXML);
|
$this->_documentXML = str_replace($value, $valueCleaned, $this->_documentXML);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(substr($search, 0, 2) !== '${' && substr($search, -1) !== '}') {
|
if (substr($search, 0, 2) !== '${' && substr($search, -1) !== '}') {
|
||||||
$search = '${'.$search.'}';
|
$search = '${' . $search . '}';
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_array($replace)) {
|
if (!is_array($replace)) {
|
||||||
if(!PHPWord_Shared_String::IsUTF8($replace)){
|
if (!PHPWord_Shared_String::IsUTF8($replace)) {
|
||||||
$replace = utf8_encode($replace);
|
$replace = utf8_encode($replace);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,19 +119,19 @@ class PHPWord_Template {
|
|||||||
*
|
*
|
||||||
* @param string $strFilename
|
* @param string $strFilename
|
||||||
*/
|
*/
|
||||||
public function save($strFilename) {
|
public function save($strFilename)
|
||||||
if(file_exists($strFilename)) {
|
{
|
||||||
|
if (file_exists($strFilename)) {
|
||||||
unlink($strFilename);
|
unlink($strFilename);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_objZip->addFromString('word/document.xml', $this->_documentXML);
|
$this->_objZip->addFromString('word/document.xml', $this->_documentXML);
|
||||||
|
|
||||||
// Close zip file
|
// Close zip file
|
||||||
if($this->_objZip->close() === false) {
|
if ($this->_objZip->close() === false) {
|
||||||
throw new Exception('Could not close zip file.');
|
throw new Exception('Could not close zip file.');
|
||||||
}
|
}
|
||||||
|
|
||||||
rename($this->_tempFileName, $strFilename);
|
rename($this->_tempFileName, $strFilename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
2
Classes/PHPWord/Writer/IWriter.php
Normal file → Executable file
2
Classes/PHPWord/Writer/IWriter.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
4
Classes/PHPWord/Writer/ODText.php
Normal file → Executable file
4
Classes/PHPWord/Writer/ODText.php
Normal file → Executable file
@ -19,8 +19,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord_Writer_PowerPoint2007
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Writer/ODText/Content.php
Normal file → Executable file
2
Classes/PHPWord/Writer/ODText/Content.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Writer/ODText/Manifest.php
Normal file → Executable file
2
Classes/PHPWord/Writer/ODText/Manifest.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Writer/ODText/Meta.php
Normal file → Executable file
2
Classes/PHPWord/Writer/ODText/Meta.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Writer/ODText/Mimetype.php
Normal file → Executable file
2
Classes/PHPWord/Writer/ODText/Mimetype.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Writer/ODText/Styles.php
Normal file → Executable file
2
Classes/PHPWord/Writer/ODText/Styles.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Writer/ODText/WriterPart.php
Normal file → Executable file
2
Classes/PHPWord/Writer/ODText/WriterPart.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
4
Classes/PHPWord/Writer/RTF.php
Normal file → Executable file
4
Classes/PHPWord/Writer/RTF.php
Normal file → Executable file
@ -19,8 +19,8 @@
|
|||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord_Writer_RTF
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
104
Classes/PHPWord/Writer/Word2007.php
Normal file → Executable file
104
Classes/PHPWord/Writer/Word2007.php
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPWord
|
* PHPWord
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 PHPWord
|
* Copyright (c) 2013 PHPWord
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,13 +20,16 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 010 PHPWord
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version Beta 0.6.3, 08.07.2011
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
class PHPWord_Writer_Word2007 implements PHPWord_Writer_IWriter {
|
* Class PHPWord_Writer_Word2007
|
||||||
|
*/
|
||||||
|
class PHPWord_Writer_Word2007 implements PHPWord_Writer_IWriter
|
||||||
|
{
|
||||||
|
|
||||||
private $_document;
|
private $_document;
|
||||||
private $_writerParts;
|
private $_writerParts;
|
||||||
@ -35,7 +38,8 @@ class PHPWord_Writer_Word2007 implements PHPWord_Writer_IWriter {
|
|||||||
private $_imageTypes = array();
|
private $_imageTypes = array();
|
||||||
private $_objectTypes = array();
|
private $_objectTypes = array();
|
||||||
|
|
||||||
public function __construct(PHPWord $PHPWord = null) {
|
public function __construct(PHPWord $PHPWord = null)
|
||||||
|
{
|
||||||
$this->_document = $PHPWord;
|
$this->_document = $PHPWord;
|
||||||
|
|
||||||
$this->_diskCachingDirectory = './';
|
$this->_diskCachingDirectory = './';
|
||||||
@ -49,19 +53,20 @@ class PHPWord_Writer_Word2007 implements PHPWord_Writer_IWriter {
|
|||||||
$this->_writerParts['header'] = new PHPWord_Writer_Word2007_Header();
|
$this->_writerParts['header'] = new PHPWord_Writer_Word2007_Header();
|
||||||
$this->_writerParts['footer'] = new PHPWord_Writer_Word2007_Footer();
|
$this->_writerParts['footer'] = new PHPWord_Writer_Word2007_Footer();
|
||||||
|
|
||||||
foreach($this->_writerParts as $writer) {
|
foreach ($this->_writerParts as $writer) {
|
||||||
$writer->setParentWriter($this);
|
$writer->setParentWriter($this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save($pFilename = null) {
|
public function save($pFilename = null)
|
||||||
if(!is_null($this->_document)) {
|
{
|
||||||
|
if (!is_null($this->_document)) {
|
||||||
|
|
||||||
// If $pFilename is php://output or php://stdout, make it a temporary file...
|
// If $pFilename is php://output or php://stdout, make it a temporary file...
|
||||||
$originalFilename = $pFilename;
|
$originalFilename = $pFilename;
|
||||||
if(strtolower($pFilename) == 'php://output' || strtolower($pFilename) == 'php://stdout') {
|
if (strtolower($pFilename) == 'php://output' || strtolower($pFilename) == 'php://stdout') {
|
||||||
$pFilename = @tempnam('./', 'phppttmp');
|
$pFilename = @tempnam('./', 'phppttmp');
|
||||||
if($pFilename == '') {
|
if ($pFilename == '') {
|
||||||
$pFilename = $originalFilename;
|
$pFilename = $originalFilename;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -70,8 +75,8 @@ class PHPWord_Writer_Word2007 implements PHPWord_Writer_IWriter {
|
|||||||
$objZip = new ZipArchive();
|
$objZip = new ZipArchive();
|
||||||
|
|
||||||
// Try opening the ZIP file
|
// Try opening the ZIP file
|
||||||
if($objZip->open($pFilename, ZIPARCHIVE::OVERWRITE) !== true) {
|
if ($objZip->open($pFilename, ZIPARCHIVE::OVERWRITE) !== true) {
|
||||||
if($objZip->open($pFilename, ZIPARCHIVE::CREATE) !== true) {
|
if ($objZip->open($pFilename, ZIPARCHIVE::CREATE) !== true) {
|
||||||
throw new Exception("Could not open " . $pFilename . " for writing.");
|
throw new Exception("Could not open " . $pFilename . " for writing.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,58 +84,57 @@ class PHPWord_Writer_Word2007 implements PHPWord_Writer_IWriter {
|
|||||||
|
|
||||||
$sectionElements = array();
|
$sectionElements = array();
|
||||||
$_secElements = PHPWord_Media::getSectionMediaElements();
|
$_secElements = PHPWord_Media::getSectionMediaElements();
|
||||||
foreach($_secElements as $element) { // loop through section media elements
|
foreach ($_secElements as $element) { // loop through section media elements
|
||||||
if($element['type'] != 'hyperlink') {
|
if ($element['type'] != 'hyperlink') {
|
||||||
$this->_addFileToPackage($objZip, $element);
|
$this->_addFileToPackage($objZip, $element);
|
||||||
}
|
}
|
||||||
$sectionElements[] = $element;
|
$sectionElements[] = $element;
|
||||||
}
|
}
|
||||||
|
|
||||||
$_hdrElements = PHPWord_Media::getHeaderMediaElements();
|
$_hdrElements = PHPWord_Media::getHeaderMediaElements();
|
||||||
foreach($_hdrElements as $_headerFile => $_hdrMedia) { // loop through headers
|
foreach ($_hdrElements as $_headerFile => $_hdrMedia) { // loop through headers
|
||||||
if(count($_hdrMedia) > 0) {
|
if (count($_hdrMedia) > 0) {
|
||||||
$objZip->addFromString('word/_rels/'.$_headerFile.'.xml.rels', $this->getWriterPart('documentrels')->writeHeaderFooterRels($_hdrMedia));
|
$objZip->addFromString('word/_rels/' . $_headerFile . '.xml.rels', $this->getWriterPart('documentrels')->writeHeaderFooterRels($_hdrMedia));
|
||||||
foreach($_hdrMedia as $element) { // loop through header media elements
|
foreach ($_hdrMedia as $element) { // loop through header media elements
|
||||||
$this->_addFileToPackage($objZip, $element);
|
$this->_addFileToPackage($objZip, $element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$_ftrElements = PHPWord_Media::getFooterMediaElements();
|
$_ftrElements = PHPWord_Media::getFooterMediaElements();
|
||||||
foreach($_ftrElements as $_footerFile => $_ftrMedia) { // loop through footers
|
foreach ($_ftrElements as $_footerFile => $_ftrMedia) { // loop through footers
|
||||||
if(count($_ftrMedia) > 0) {
|
if (count($_ftrMedia) > 0) {
|
||||||
$objZip->addFromString('word/_rels/'.$_footerFile.'.xml.rels', $this->getWriterPart('documentrels')->writeHeaderFooterRels($_ftrMedia));
|
$objZip->addFromString('word/_rels/' . $_footerFile . '.xml.rels', $this->getWriterPart('documentrels')->writeHeaderFooterRels($_ftrMedia));
|
||||||
foreach($_ftrMedia as $element) { // loop through footers media elements
|
foreach ($_ftrMedia as $element) { // loop through footers media elements
|
||||||
$this->_addFileToPackage($objZip, $element);
|
$this->_addFileToPackage($objZip, $element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$_cHdrs = 0;
|
$_cHdrs = 0;
|
||||||
$_cFtrs = 0;
|
$_cFtrs = 0;
|
||||||
$rID = PHPWord_Media::countSectionMediaElements() + 6;
|
$rID = PHPWord_Media::countSectionMediaElements() + 6;
|
||||||
$_sections = $this->_document->getSections();
|
$_sections = $this->_document->getSections();
|
||||||
|
|
||||||
foreach($_sections as $section) {
|
foreach ($_sections as $section) {
|
||||||
$_headers = $section->getHeaders();
|
$_headers = $section->getHeaders();
|
||||||
foreach ($_headers as $index => &$_header) {
|
foreach ($_headers as $index => &$_header) {
|
||||||
$_cHdrs++;
|
$_cHdrs++;
|
||||||
$_header->setRelationId(++$rID);
|
$_header->setRelationId(++$rID);
|
||||||
$_headerFile = 'header'.$_cHdrs.'.xml';
|
$_headerFile = 'header' . $_cHdrs . '.xml';
|
||||||
$sectionElements[] = array('target'=>$_headerFile, 'type'=>'header', 'rID'=>$rID);
|
$sectionElements[] = array('target' => $_headerFile, 'type' => 'header', 'rID' => $rID);
|
||||||
$objZip->addFromString('word/'.$_headerFile, $this->getWriterPart('header')->writeHeader($_header));
|
$objZip->addFromString('word/' . $_headerFile, $this->getWriterPart('header')->writeHeader($_header));
|
||||||
}
|
}
|
||||||
|
|
||||||
$_footer = $section->getFooter();
|
$_footer = $section->getFooter();
|
||||||
if(!is_null($_footer)) {
|
if (!is_null($_footer)) {
|
||||||
$_cFtrs++;
|
$_cFtrs++;
|
||||||
$_footer->setRelationId(++$rID);
|
$_footer->setRelationId(++$rID);
|
||||||
$_footerCount = $_footer->getFooterCount();
|
$_footerCount = $_footer->getFooterCount();
|
||||||
$_footerFile = 'footer'.$_footerCount.'.xml';
|
$_footerFile = 'footer' . $_footerCount . '.xml';
|
||||||
$sectionElements[] = array('target'=>$_footerFile, 'type'=>'footer', 'rID'=>$rID);
|
$sectionElements[] = array('target' => $_footerFile, 'type' => 'footer', 'rID' => $rID);
|
||||||
$objZip->addFromString('word/'.$_footerFile, $this->getWriterPart('footer')->writeFooter($_footer));
|
$objZip->addFromString('word/' . $_footerFile, $this->getWriterPart('footer')->writeFooter($_footer));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,12 +157,12 @@ class PHPWord_Writer_Word2007 implements PHPWord_Writer_IWriter {
|
|||||||
|
|
||||||
|
|
||||||
// Close file
|
// Close file
|
||||||
if($objZip->close() === false) {
|
if ($objZip->close() === false) {
|
||||||
throw new Exception("Could not close zip file $pFilename.");
|
throw new Exception("Could not close zip file $pFilename.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a temporary file was used, copy it to the correct file stream
|
// If a temporary file was used, copy it to the correct file stream
|
||||||
if($originalFilename != $pFilename) {
|
if ($originalFilename != $pFilename) {
|
||||||
if (copy($pFilename, $originalFilename) === false) {
|
if (copy($pFilename, $originalFilename) === false) {
|
||||||
throw new Exception("Could not copy temporary zip file $pFilename to $originalFilename.");
|
throw new Exception("Could not copy temporary zip file $pFilename to $originalFilename.");
|
||||||
}
|
}
|
||||||
@ -169,32 +173,34 @@ class PHPWord_Writer_Word2007 implements PHPWord_Writer_IWriter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _chkContentTypes($src) {
|
private function _chkContentTypes($src)
|
||||||
|
{
|
||||||
$srcInfo = pathinfo($src);
|
$srcInfo = pathinfo($src);
|
||||||
$extension = strtolower($srcInfo['extension']);
|
$extension = strtolower($srcInfo['extension']);
|
||||||
if(substr($extension, 0, 3) == 'php') {
|
if (substr($extension, 0, 3) == 'php') {
|
||||||
$extension = 'php';
|
$extension = 'php';
|
||||||
}
|
}
|
||||||
$_supportedImageTypes = array('jpg', 'jpeg', 'gif', 'png', 'bmp', 'tif', 'tiff', 'php');
|
$_supportedImageTypes = array('jpg', 'jpeg', 'gif', 'png', 'bmp', 'tif', 'tiff', 'php');
|
||||||
|
|
||||||
if(in_array($extension, $_supportedImageTypes)) {
|
if (in_array($extension, $_supportedImageTypes)) {
|
||||||
$imagedata = getimagesize($src);
|
$imagedata = getimagesize($src);
|
||||||
$imagetype = image_type_to_mime_type($imagedata[2]);
|
$imagetype = image_type_to_mime_type($imagedata[2]);
|
||||||
$imageext = image_type_to_extension($imagedata[2]);
|
$imageext = image_type_to_extension($imagedata[2]);
|
||||||
$imageext = str_replace('.', '', $imageext);
|
$imageext = str_replace('.', '', $imageext);
|
||||||
if($imageext == 'jpeg') $imageext = 'jpg';
|
if ($imageext == 'jpeg') $imageext = 'jpg';
|
||||||
|
|
||||||
if(!in_array($imagetype, $this->_imageTypes)) {
|
if (!in_array($imagetype, $this->_imageTypes)) {
|
||||||
$this->_imageTypes[$imageext] = $imagetype;
|
$this->_imageTypes[$imageext] = $imagetype;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(!in_array($extension, $this->_objectTypes)) {
|
if (!in_array($extension, $this->_objectTypes)) {
|
||||||
$this->_objectTypes[] = $extension;
|
$this->_objectTypes[] = $extension;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getWriterPart($pPartName = '') {
|
public function getWriterPart($pPartName = '')
|
||||||
|
{
|
||||||
if ($pPartName != '' && isset($this->_writerParts[strtolower($pPartName)])) {
|
if ($pPartName != '' && isset($this->_writerParts[strtolower($pPartName)])) {
|
||||||
return $this->_writerParts[strtolower($pPartName)];
|
return $this->_writerParts[strtolower($pPartName)];
|
||||||
} else {
|
} else {
|
||||||
@ -202,11 +208,13 @@ class PHPWord_Writer_Word2007 implements PHPWord_Writer_IWriter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getUseDiskCaching() {
|
public function getUseDiskCaching()
|
||||||
|
{
|
||||||
return $this->_useDiskCaching;
|
return $this->_useDiskCaching;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setUseDiskCaching($pValue = false, $pDirectory = null) {
|
public function setUseDiskCaching($pValue = false, $pDirectory = null)
|
||||||
|
{
|
||||||
$this->_useDiskCaching = $pValue;
|
$this->_useDiskCaching = $pValue;
|
||||||
|
|
||||||
if (!is_null($pDirectory)) {
|
if (!is_null($pDirectory)) {
|
||||||
@ -220,21 +228,21 @@ class PHPWord_Writer_Word2007 implements PHPWord_Writer_IWriter {
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _addFileToPackage($objZip, $element) {
|
private function _addFileToPackage($objZip, $element)
|
||||||
if(isset($element['isMemImage']) && $element['isMemImage']) {
|
{
|
||||||
|
if (isset($element['isMemImage']) && $element['isMemImage']) {
|
||||||
$image = call_user_func($element['createfunction'], $element['source']);
|
$image = call_user_func($element['createfunction'], $element['source']);
|
||||||
ob_start();
|
ob_start();
|
||||||
call_user_func($element['imagefunction'], $image);
|
call_user_func($element['imagefunction'], $image);
|
||||||
$imageContents = ob_get_contents();
|
$imageContents = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$objZip->addFromString('word/'.$element['target'], $imageContents);
|
$objZip->addFromString('word/' . $element['target'], $imageContents);
|
||||||
imagedestroy($image);
|
imagedestroy($image);
|
||||||
|
|
||||||
$this->_chkContentTypes($element['source']);
|
$this->_chkContentTypes($element['source']);
|
||||||
} else {
|
} else {
|
||||||
$objZip->addFile($element['source'], 'word/'.$element['target']);
|
$objZip->addFile($element['source'], 'word/' . $element['target']);
|
||||||
$this->_chkContentTypes($element['source']);
|
$this->_chkContentTypes($element['source']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
289
Classes/PHPWord/Writer/Word2007/Base.php
Normal file → Executable file
289
Classes/PHPWord/Writer/Word2007/Base.php
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPWord
|
* PHPWord
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 PHPWord
|
* Copyright (c) 2013 PHPWord
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,28 +20,32 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 010 PHPWord
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version Beta 0.6.3, 08.07.2011
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class PHPWord_Writer_Word2007_Base
|
||||||
|
*/
|
||||||
|
class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart
|
||||||
|
{
|
||||||
|
|
||||||
class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
protected function _writeText(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_Text $text, $withoutP = false)
|
||||||
|
{
|
||||||
protected function _writeText(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_Text $text, $withoutP = false) {
|
|
||||||
$styleFont = $text->getFontStyle();
|
$styleFont = $text->getFontStyle();
|
||||||
|
|
||||||
$SfIsObject = ($styleFont instanceof PHPWord_Style_Font) ? true : false;
|
$SfIsObject = ($styleFont instanceof PHPWord_Style_Font) ? true : false;
|
||||||
|
|
||||||
if(!$withoutP) {
|
if (!$withoutP) {
|
||||||
$objWriter->startElement('w:p');
|
$objWriter->startElement('w:p');
|
||||||
|
|
||||||
$styleParagraph = $text->getParagraphStyle();
|
$styleParagraph = $text->getParagraphStyle();
|
||||||
$SpIsObject = ($styleParagraph instanceof PHPWord_Style_Paragraph) ? true : false;
|
$SpIsObject = ($styleParagraph instanceof PHPWord_Style_Paragraph) ? true : false;
|
||||||
|
|
||||||
if($SpIsObject) {
|
if ($SpIsObject) {
|
||||||
$this->_writeParagraphStyle($objWriter, $styleParagraph);
|
$this->_writeParagraphStyle($objWriter, $styleParagraph);
|
||||||
} elseif(!$SpIsObject && !is_null($styleParagraph)) {
|
} elseif (!$SpIsObject && !is_null($styleParagraph)) {
|
||||||
$objWriter->startElement('w:pPr');
|
$objWriter->startElement('w:pPr');
|
||||||
$objWriter->startElement('w:pStyle');
|
$objWriter->startElement('w:pStyle');
|
||||||
$objWriter->writeAttribute('w:val', $styleParagraph);
|
$objWriter->writeAttribute('w:val', $styleParagraph);
|
||||||
@ -55,9 +59,9 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
|
|
||||||
$objWriter->startElement('w:r');
|
$objWriter->startElement('w:r');
|
||||||
|
|
||||||
if($SfIsObject) {
|
if ($SfIsObject) {
|
||||||
$this->_writeTextStyle($objWriter, $styleFont);
|
$this->_writeTextStyle($objWriter, $styleFont);
|
||||||
} elseif(!$SfIsObject && !is_null($styleFont)) {
|
} elseif (!$SfIsObject && !is_null($styleFont)) {
|
||||||
$objWriter->startElement('w:rPr');
|
$objWriter->startElement('w:rPr');
|
||||||
$objWriter->startElement('w:rStyle');
|
$objWriter->startElement('w:rStyle');
|
||||||
$objWriter->writeAttribute('w:val', $styleFont);
|
$objWriter->writeAttribute('w:val', $styleFont);
|
||||||
@ -72,12 +76,13 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
|
|
||||||
$objWriter->endElement(); // w:r
|
$objWriter->endElement(); // w:r
|
||||||
|
|
||||||
if(!$withoutP) {
|
if (!$withoutP) {
|
||||||
$objWriter->endElement(); // w:p
|
$objWriter->endElement(); // w:p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _writeTextRun(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_TextRun $textrun) {
|
protected function _writeTextRun(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_TextRun $textrun)
|
||||||
|
{
|
||||||
$elements = $textrun->getElements();
|
$elements = $textrun->getElements();
|
||||||
$styleParagraph = $textrun->getParagraphStyle();
|
$styleParagraph = $textrun->getParagraphStyle();
|
||||||
|
|
||||||
@ -85,9 +90,9 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
|
|
||||||
$objWriter->startElement('w:p');
|
$objWriter->startElement('w:p');
|
||||||
|
|
||||||
if($SpIsObject) {
|
if ($SpIsObject) {
|
||||||
$this->_writeParagraphStyle($objWriter, $styleParagraph);
|
$this->_writeParagraphStyle($objWriter, $styleParagraph);
|
||||||
} elseif(!$SpIsObject && !is_null($styleParagraph)) {
|
} elseif (!$SpIsObject && !is_null($styleParagraph)) {
|
||||||
$objWriter->startElement('w:pPr');
|
$objWriter->startElement('w:pPr');
|
||||||
$objWriter->startElement('w:pStyle');
|
$objWriter->startElement('w:pStyle');
|
||||||
$objWriter->writeAttribute('w:val', $styleParagraph);
|
$objWriter->writeAttribute('w:val', $styleParagraph);
|
||||||
@ -95,11 +100,11 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($elements) > 0) {
|
if (count($elements) > 0) {
|
||||||
foreach($elements as $element) {
|
foreach ($elements as $element) {
|
||||||
if($element instanceof PHPWord_Section_Text) {
|
if ($element instanceof PHPWord_Section_Text) {
|
||||||
$this->_writeText($objWriter, $element, true);
|
$this->_writeText($objWriter, $element, true);
|
||||||
} elseif($element instanceof PHPWord_Section_Link) {
|
} elseif ($element instanceof PHPWord_Section_Link) {
|
||||||
$this->_writeLink($objWriter, $element, true);
|
$this->_writeLink($objWriter, $element, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,7 +113,8 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _writeParagraphStyle(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Style_Paragraph $style, $withoutPPR = false) {
|
protected function _writeParagraphStyle(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Style_Paragraph $style, $withoutPPR = false)
|
||||||
|
{
|
||||||
$align = $style->getAlign();
|
$align = $style->getAlign();
|
||||||
$spaceBefore = $style->getSpaceBefore();
|
$spaceBefore = $style->getSpaceBefore();
|
||||||
$spaceAfter = $style->getSpaceAfter();
|
$spaceAfter = $style->getSpaceAfter();
|
||||||
@ -116,68 +122,69 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
$indent = $style->getIndent();
|
$indent = $style->getIndent();
|
||||||
$tabs = $style->getTabs();
|
$tabs = $style->getTabs();
|
||||||
|
|
||||||
if(!is_null($align) || !is_null($spacing) || !is_null($spaceBefore) || !is_null($spaceAfter) || !is_null($indent) || !is_null($tabs)) {
|
if (!is_null($align) || !is_null($spacing) || !is_null($spaceBefore) || !is_null($spaceAfter) || !is_null($indent) || !is_null($tabs)) {
|
||||||
if(!$withoutPPR) {
|
if (!$withoutPPR) {
|
||||||
$objWriter->startElement('w:pPr');
|
$objWriter->startElement('w:pPr');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_null($align)) {
|
if (!is_null($align)) {
|
||||||
$objWriter->startElement('w:jc');
|
$objWriter->startElement('w:jc');
|
||||||
$objWriter->writeAttribute('w:val', $align);
|
$objWriter->writeAttribute('w:val', $align);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_null($indent)) {
|
if (!is_null($indent)) {
|
||||||
$objWriter->startElement('w:ind');
|
$objWriter->startElement('w:ind');
|
||||||
$objWriter->writeAttribute('w:firstLine', 0);
|
$objWriter->writeAttribute('w:firstLine', 0);
|
||||||
$objWriter->writeAttribute('w:left', $indent);
|
$objWriter->writeAttribute('w:left', $indent);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_null($spaceBefore) || !is_null($spaceAfter) || !is_null($spacing)) {
|
if (!is_null($spaceBefore) || !is_null($spaceAfter) || !is_null($spacing)) {
|
||||||
$objWriter->startElement('w:spacing');
|
$objWriter->startElement('w:spacing');
|
||||||
if(!is_null($spaceBefore)) {
|
if (!is_null($spaceBefore)) {
|
||||||
$objWriter->writeAttribute('w:before', $spaceBefore);
|
$objWriter->writeAttribute('w:before', $spaceBefore);
|
||||||
}
|
}
|
||||||
if(!is_null($spaceAfter)) {
|
if (!is_null($spaceAfter)) {
|
||||||
$objWriter->writeAttribute('w:after', $spaceAfter);
|
$objWriter->writeAttribute('w:after', $spaceAfter);
|
||||||
}
|
}
|
||||||
if(!is_null($spacing)) {
|
if (!is_null($spacing)) {
|
||||||
$objWriter->writeAttribute('w:line', $spacing);
|
$objWriter->writeAttribute('w:line', $spacing);
|
||||||
$objWriter->writeAttribute('w:lineRule', 'auto');
|
$objWriter->writeAttribute('w:lineRule', 'auto');
|
||||||
}
|
}
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_null($tabs)) {
|
if (!is_null($tabs)) {
|
||||||
$tabs->toXml($objWriter);
|
$tabs->toXml($objWriter);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$withoutPPR) {
|
if (!$withoutPPR) {
|
||||||
$objWriter->endElement(); // w:pPr
|
$objWriter->endElement(); // w:pPr
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _writeLink(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_Link $link, $withoutP = false) {
|
protected function _writeLink(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_Link $link, $withoutP = false)
|
||||||
|
{
|
||||||
$rID = $link->getRelationId();
|
$rID = $link->getRelationId();
|
||||||
$linkName = $link->getLinkName();
|
$linkName = $link->getLinkName();
|
||||||
if(is_null($linkName)) {
|
if (is_null($linkName)) {
|
||||||
$linkName = $link->getLinkSrc();
|
$linkName = $link->getLinkSrc();
|
||||||
}
|
}
|
||||||
|
|
||||||
$styleFont = $link->getFontStyle();
|
$styleFont = $link->getFontStyle();
|
||||||
$SfIsObject = ($styleFont instanceof PHPWord_Style_Font) ? true : false;
|
$SfIsObject = ($styleFont instanceof PHPWord_Style_Font) ? true : false;
|
||||||
|
|
||||||
if(!$withoutP) {
|
if (!$withoutP) {
|
||||||
$objWriter->startElement('w:p');
|
$objWriter->startElement('w:p');
|
||||||
|
|
||||||
$styleParagraph = $link->getParagraphStyle();
|
$styleParagraph = $link->getParagraphStyle();
|
||||||
$SpIsObject = ($styleParagraph instanceof PHPWord_Style_Paragraph) ? true : false;
|
$SpIsObject = ($styleParagraph instanceof PHPWord_Style_Paragraph) ? true : false;
|
||||||
|
|
||||||
if($SpIsObject) {
|
if ($SpIsObject) {
|
||||||
$this->_writeParagraphStyle($objWriter, $styleParagraph);
|
$this->_writeParagraphStyle($objWriter, $styleParagraph);
|
||||||
} elseif(!$SpIsObject && !is_null($styleParagraph)) {
|
} elseif (!$SpIsObject && !is_null($styleParagraph)) {
|
||||||
$objWriter->startElement('w:pPr');
|
$objWriter->startElement('w:pPr');
|
||||||
$objWriter->startElement('w:pStyle');
|
$objWriter->startElement('w:pStyle');
|
||||||
$objWriter->writeAttribute('w:val', $styleParagraph);
|
$objWriter->writeAttribute('w:val', $styleParagraph);
|
||||||
@ -187,13 +194,13 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$objWriter->startElement('w:hyperlink');
|
$objWriter->startElement('w:hyperlink');
|
||||||
$objWriter->writeAttribute('r:id', 'rId'.$rID);
|
$objWriter->writeAttribute('r:id', 'rId' . $rID);
|
||||||
$objWriter->writeAttribute('w:history', '1');
|
$objWriter->writeAttribute('w:history', '1');
|
||||||
|
|
||||||
$objWriter->startElement('w:r');
|
$objWriter->startElement('w:r');
|
||||||
if($SfIsObject) {
|
if ($SfIsObject) {
|
||||||
$this->_writeTextStyle($objWriter, $styleFont);
|
$this->_writeTextStyle($objWriter, $styleFont);
|
||||||
} elseif(!$SfIsObject && !is_null($styleFont)) {
|
} elseif (!$SfIsObject && !is_null($styleFont)) {
|
||||||
$objWriter->startElement('w:rPr');
|
$objWriter->startElement('w:rPr');
|
||||||
$objWriter->startElement('w:rStyle');
|
$objWriter->startElement('w:rStyle');
|
||||||
$objWriter->writeAttribute('w:val', $styleFont);
|
$objWriter->writeAttribute('w:val', $styleFont);
|
||||||
@ -209,12 +216,13 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
|
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
if(!$withoutP) {
|
if (!$withoutP) {
|
||||||
$objWriter->endElement(); // w:p
|
$objWriter->endElement(); // w:p
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _writePreserveText(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_Footer_PreserveText $textrun) {
|
protected function _writePreserveText(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_Footer_PreserveText $textrun)
|
||||||
|
{
|
||||||
$styleFont = $textrun->getFontStyle();
|
$styleFont = $textrun->getFontStyle();
|
||||||
$styleParagraph = $textrun->getParagraphStyle();
|
$styleParagraph = $textrun->getParagraphStyle();
|
||||||
|
|
||||||
@ -225,9 +233,9 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
|
|
||||||
$objWriter->startElement('w:p');
|
$objWriter->startElement('w:p');
|
||||||
|
|
||||||
if($SpIsObject) {
|
if ($SpIsObject) {
|
||||||
$this->_writeParagraphStyle($objWriter, $styleParagraph);
|
$this->_writeParagraphStyle($objWriter, $styleParagraph);
|
||||||
} elseif(!$SpIsObject && !is_null($styleParagraph)) {
|
} elseif (!$SpIsObject && !is_null($styleParagraph)) {
|
||||||
$objWriter->startElement('w:pPr');
|
$objWriter->startElement('w:pPr');
|
||||||
$objWriter->startElement('w:pStyle');
|
$objWriter->startElement('w:pStyle');
|
||||||
$objWriter->writeAttribute('w:val', $styleParagraph);
|
$objWriter->writeAttribute('w:val', $styleParagraph);
|
||||||
@ -235,9 +243,9 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($arrText as $text) {
|
foreach ($arrText as $text) {
|
||||||
|
|
||||||
if(substr($text, 0, 1) == '{') {
|
if (substr($text, 0, 1) == '{') {
|
||||||
$text = substr($text, 1, -1);
|
$text = substr($text, 1, -1);
|
||||||
|
|
||||||
$objWriter->startElement('w:r');
|
$objWriter->startElement('w:r');
|
||||||
@ -248,9 +256,9 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
|
|
||||||
$objWriter->startElement('w:r');
|
$objWriter->startElement('w:r');
|
||||||
|
|
||||||
if($SfIsObject) {
|
if ($SfIsObject) {
|
||||||
$this->_writeTextStyle($objWriter, $styleFont);
|
$this->_writeTextStyle($objWriter, $styleFont);
|
||||||
} elseif(!$SfIsObject && !is_null($styleFont)) {
|
} elseif (!$SfIsObject && !is_null($styleFont)) {
|
||||||
$objWriter->startElement('w:rPr');
|
$objWriter->startElement('w:rPr');
|
||||||
$objWriter->startElement('w:rStyle');
|
$objWriter->startElement('w:rStyle');
|
||||||
$objWriter->writeAttribute('w:val', $styleFont);
|
$objWriter->writeAttribute('w:val', $styleFont);
|
||||||
@ -281,9 +289,9 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
|
|
||||||
$objWriter->startElement('w:r');
|
$objWriter->startElement('w:r');
|
||||||
|
|
||||||
if($SfIsObject) {
|
if ($SfIsObject) {
|
||||||
$this->_writeTextStyle($objWriter, $styleFont);
|
$this->_writeTextStyle($objWriter, $styleFont);
|
||||||
} elseif(!$SfIsObject && !is_null($styleFont)) {
|
} elseif (!$SfIsObject && !is_null($styleFont)) {
|
||||||
$objWriter->startElement('w:rPr');
|
$objWriter->startElement('w:rPr');
|
||||||
$objWriter->startElement('w:rStyle');
|
$objWriter->startElement('w:rStyle');
|
||||||
$objWriter->writeAttribute('w:val', $styleFont);
|
$objWriter->writeAttribute('w:val', $styleFont);
|
||||||
@ -302,7 +310,8 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
$objWriter->endElement(); // p
|
$objWriter->endElement(); // p
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _writeTextStyle(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Style_Font $style) {
|
protected function _writeTextStyle(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Style_Font $style)
|
||||||
|
{
|
||||||
$font = $style->getName();
|
$font = $style->getName();
|
||||||
$bold = $style->getBold();
|
$bold = $style->getBold();
|
||||||
$italic = $style->getItalic();
|
$italic = $style->getItalic();
|
||||||
@ -315,7 +324,7 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
$objWriter->startElement('w:rPr');
|
$objWriter->startElement('w:rPr');
|
||||||
|
|
||||||
// Font
|
// Font
|
||||||
if($font != 'Arial') {
|
if ($font != 'Arial') {
|
||||||
$objWriter->startElement('w:rFonts');
|
$objWriter->startElement('w:rFonts');
|
||||||
$objWriter->writeAttribute('w:ascii', $font);
|
$objWriter->writeAttribute('w:ascii', $font);
|
||||||
$objWriter->writeAttribute('w:hAnsi', $font);
|
$objWriter->writeAttribute('w:hAnsi', $font);
|
||||||
@ -324,14 +333,14 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Color
|
// Color
|
||||||
if($color != '000000') {
|
if ($color != '000000') {
|
||||||
$objWriter->startElement('w:color');
|
$objWriter->startElement('w:color');
|
||||||
$objWriter->writeAttribute('w:val', $color);
|
$objWriter->writeAttribute('w:val', $color);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Size
|
// Size
|
||||||
if($size != 20) {
|
if ($size != 20) {
|
||||||
$objWriter->startElement('w:sz');
|
$objWriter->startElement('w:sz');
|
||||||
$objWriter->writeAttribute('w:val', $size);
|
$objWriter->writeAttribute('w:val', $size);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
@ -341,30 +350,30 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Bold
|
// Bold
|
||||||
if($bold) {
|
if ($bold) {
|
||||||
$objWriter->writeElement('w:b', null);
|
$objWriter->writeElement('w:b', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Italic
|
// Italic
|
||||||
if($italic) {
|
if ($italic) {
|
||||||
$objWriter->writeElement('w:i', null);
|
$objWriter->writeElement('w:i', null);
|
||||||
$objWriter->writeElement('w:iCs', null);
|
$objWriter->writeElement('w:iCs', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Underline
|
// Underline
|
||||||
if(!is_null($underline) && $underline != 'none') {
|
if (!is_null($underline) && $underline != 'none') {
|
||||||
$objWriter->startElement('w:u');
|
$objWriter->startElement('w:u');
|
||||||
$objWriter->writeAttribute('w:val', $underline);
|
$objWriter->writeAttribute('w:val', $underline);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Striketrough
|
// Striketrough
|
||||||
if($striketrough) {
|
if ($striketrough) {
|
||||||
$objWriter->writeElement('w:strike', null);
|
$objWriter->writeElement('w:strike', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Foreground-Color
|
// Foreground-Color
|
||||||
if(!is_null($fgColor)) {
|
if (!is_null($fgColor)) {
|
||||||
$objWriter->startElement('w:highlight');
|
$objWriter->startElement('w:highlight');
|
||||||
$objWriter->writeAttribute('w:val', $fgColor);
|
$objWriter->writeAttribute('w:val', $fgColor);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
@ -373,21 +382,23 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _writeTextBreak(PHPWord_Shared_XMLWriter $objWriter = null) {
|
protected function _writeTextBreak(PHPWord_Shared_XMLWriter $objWriter = null)
|
||||||
|
{
|
||||||
$objWriter->writeElement('w:p', null);
|
$objWriter->writeElement('w:p', null);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _writeTable(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_Table $table) {
|
protected function _writeTable(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_Table $table)
|
||||||
|
{
|
||||||
$_rows = $table->getRows();
|
$_rows = $table->getRows();
|
||||||
$_cRows = count($_rows);
|
$_cRows = count($_rows);
|
||||||
|
|
||||||
if($_cRows > 0) {
|
if ($_cRows > 0) {
|
||||||
$objWriter->startElement('w:tbl');
|
$objWriter->startElement('w:tbl');
|
||||||
$tblStyle = $table->getStyle();
|
$tblStyle = $table->getStyle();
|
||||||
if($tblStyle instanceof PHPWord_Style_Table) {
|
if ($tblStyle instanceof PHPWord_Style_Table) {
|
||||||
$this->_writeTableStyle($objWriter, $tblStyle);
|
$this->_writeTableStyle($objWriter, $tblStyle);
|
||||||
} else {
|
} else {
|
||||||
if(!empty($tblStyle)) {
|
if (!empty($tblStyle)) {
|
||||||
$objWriter->startElement('w:tblPr');
|
$objWriter->startElement('w:tblPr');
|
||||||
$objWriter->startElement('w:tblStyle');
|
$objWriter->startElement('w:tblStyle');
|
||||||
$objWriter->writeAttribute('w:val', $tblStyle);
|
$objWriter->writeAttribute('w:val', $tblStyle);
|
||||||
@ -397,13 +408,13 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$_heights = $table->getRowHeights();
|
$_heights = $table->getRowHeights();
|
||||||
for($i=0; $i<$_cRows; $i++) {
|
for ($i = 0; $i < $_cRows; $i++) {
|
||||||
$row = $_rows[$i];
|
$row = $_rows[$i];
|
||||||
$height = $_heights[$i];
|
$height = $_heights[$i];
|
||||||
|
|
||||||
$objWriter->startElement('w:tr');
|
$objWriter->startElement('w:tr');
|
||||||
|
|
||||||
if(!is_null($height)) {
|
if (!is_null($height)) {
|
||||||
$objWriter->startElement('w:trPr');
|
$objWriter->startElement('w:trPr');
|
||||||
$objWriter->startElement('w:trHeight');
|
$objWriter->startElement('w:trHeight');
|
||||||
$objWriter->writeAttribute('w:val', $height);
|
$objWriter->writeAttribute('w:val', $height);
|
||||||
@ -411,7 +422,7 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($row as $cell) {
|
foreach ($row as $cell) {
|
||||||
$objWriter->startElement('w:tc');
|
$objWriter->startElement('w:tc');
|
||||||
|
|
||||||
$cellStyle = $cell->getStyle();
|
$cellStyle = $cell->getStyle();
|
||||||
@ -423,31 +434,32 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
$objWriter->writeAttribute('w:type', 'dxa');
|
$objWriter->writeAttribute('w:type', 'dxa');
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
if($cellStyle instanceof PHPWord_Style_Cell) {
|
if ($cellStyle instanceof PHPWord_Style_Cell) {
|
||||||
$this->_writeCellStyle($objWriter, $cellStyle);
|
$this->_writeCellStyle($objWriter, $cellStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
$_elements = $cell->getElements();
|
$_elements = $cell->getElements();
|
||||||
if(count($_elements) > 0) {
|
if (count($_elements) > 0) {
|
||||||
foreach($_elements as $element) {
|
foreach ($_elements as $element) {
|
||||||
if($element instanceof PHPWord_Section_Text) {
|
if ($element instanceof PHPWord_Section_Text) {
|
||||||
$this->_writeText($objWriter, $element);
|
$this->_writeText($objWriter, $element);
|
||||||
} elseif($element instanceof PHPWord_Section_TextRun) {
|
} elseif ($element instanceof PHPWord_Section_TextRun) {
|
||||||
$this->_writeTextRun($objWriter, $element);
|
$this->_writeTextRun($objWriter, $element);
|
||||||
} elseif($element instanceof PHPWord_Section_Link) {
|
} elseif ($element instanceof PHPWord_Section_Link) {
|
||||||
$this->_writeLink($objWriter, $element);
|
$this->_writeLink($objWriter, $element);
|
||||||
} elseif($element instanceof PHPWord_Section_TextBreak) {
|
} elseif ($element instanceof PHPWord_Section_TextBreak) {
|
||||||
$this->_writeTextBreak($objWriter);
|
$this->_writeTextBreak($objWriter);
|
||||||
} elseif($element instanceof PHPWord_Section_ListItem) {
|
} elseif ($element instanceof PHPWord_Section_ListItem) {
|
||||||
$this->_writeListItem($objWriter, $element);
|
$this->_writeListItem($objWriter, $element);
|
||||||
} elseif($element instanceof PHPWord_Section_Image ||
|
} elseif ($element instanceof PHPWord_Section_Image ||
|
||||||
$element instanceof PHPWord_Section_MemoryImage) {
|
$element instanceof PHPWord_Section_MemoryImage
|
||||||
|
) {
|
||||||
$this->_writeImage($objWriter, $element);
|
$this->_writeImage($objWriter, $element);
|
||||||
} elseif($element instanceof PHPWord_Section_Object) {
|
} elseif ($element instanceof PHPWord_Section_Object) {
|
||||||
$this->_writeObject($objWriter, $element);
|
$this->_writeObject($objWriter, $element);
|
||||||
} elseif($element instanceof PHPWord_Section_Footer_PreserveText) {
|
} elseif ($element instanceof PHPWord_Section_Footer_PreserveText) {
|
||||||
$this->_writePreserveText($objWriter, $element);
|
$this->_writePreserveText($objWriter, $element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -463,39 +475,40 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _writeTableStyle(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Style_Table $style = null) {
|
protected function _writeTableStyle(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Style_Table $style = null)
|
||||||
|
{
|
||||||
$margins = $style->getCellMargin();
|
$margins = $style->getCellMargin();
|
||||||
$mTop = (!is_null($margins[0])) ? true : false;
|
$mTop = (!is_null($margins[0])) ? true : false;
|
||||||
$mLeft = (!is_null($margins[1])) ? true : false;
|
$mLeft = (!is_null($margins[1])) ? true : false;
|
||||||
$mRight = (!is_null($margins[2])) ? true : false;
|
$mRight = (!is_null($margins[2])) ? true : false;
|
||||||
$mBottom = (!is_null($margins[3])) ? true : false;
|
$mBottom = (!is_null($margins[3])) ? true : false;
|
||||||
|
|
||||||
if($mTop || $mLeft || $mRight || $mBottom) {
|
if ($mTop || $mLeft || $mRight || $mBottom) {
|
||||||
$objWriter->startElement('w:tblPr');
|
$objWriter->startElement('w:tblPr');
|
||||||
$objWriter->startElement('w:tblCellMar');
|
$objWriter->startElement('w:tblCellMar');
|
||||||
|
|
||||||
if($mTop) {
|
if ($mTop) {
|
||||||
$objWriter->startElement('w:top');
|
$objWriter->startElement('w:top');
|
||||||
$objWriter->writeAttribute('w:w', $margins[0]);
|
$objWriter->writeAttribute('w:w', $margins[0]);
|
||||||
$objWriter->writeAttribute('w:type', 'dxa');
|
$objWriter->writeAttribute('w:type', 'dxa');
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($mLeft) {
|
if ($mLeft) {
|
||||||
$objWriter->startElement('w:left');
|
$objWriter->startElement('w:left');
|
||||||
$objWriter->writeAttribute('w:w', $margins[1]);
|
$objWriter->writeAttribute('w:w', $margins[1]);
|
||||||
$objWriter->writeAttribute('w:type', 'dxa');
|
$objWriter->writeAttribute('w:type', 'dxa');
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($mRight) {
|
if ($mRight) {
|
||||||
$objWriter->startElement('w:right');
|
$objWriter->startElement('w:right');
|
||||||
$objWriter->writeAttribute('w:w', $margins[2]);
|
$objWriter->writeAttribute('w:w', $margins[2]);
|
||||||
$objWriter->writeAttribute('w:type', 'dxa');
|
$objWriter->writeAttribute('w:type', 'dxa');
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($mBottom) {
|
if ($mBottom) {
|
||||||
$objWriter->startElement('w:bottom');
|
$objWriter->startElement('w:bottom');
|
||||||
$objWriter->writeAttribute('w:w', $margins[3]);
|
$objWriter->writeAttribute('w:w', $margins[3]);
|
||||||
$objWriter->writeAttribute('w:type', 'dxa');
|
$objWriter->writeAttribute('w:type', 'dxa');
|
||||||
@ -507,7 +520,8 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _writeCellStyle(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Style_Cell $style = null) {
|
protected function _writeCellStyle(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Style_Cell $style = null)
|
||||||
|
{
|
||||||
$bgColor = $style->getBgColor();
|
$bgColor = $style->getBgColor();
|
||||||
$valign = $style->getVAlign();
|
$valign = $style->getVAlign();
|
||||||
$textDir = $style->getTextDirection();
|
$textDir = $style->getTextDirection();
|
||||||
@ -522,14 +536,14 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
|
|
||||||
$styles = (!is_null($bgColor) || !is_null($valign) || !is_null($textDir) || $borders) ? true : false;
|
$styles = (!is_null($bgColor) || !is_null($valign) || !is_null($textDir) || $borders) ? true : false;
|
||||||
|
|
||||||
if($styles) {
|
if ($styles) {
|
||||||
if(!is_null($textDir)) {
|
if (!is_null($textDir)) {
|
||||||
$objWriter->startElement('w:textDirection');
|
$objWriter->startElement('w:textDirection');
|
||||||
$objWriter->writeAttribute('w:val', $textDir);
|
$objWriter->writeAttribute('w:val', $textDir);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_null($bgColor)) {
|
if (!is_null($bgColor)) {
|
||||||
$objWriter->startElement('w:shd');
|
$objWriter->startElement('w:shd');
|
||||||
$objWriter->writeAttribute('w:val', 'clear');
|
$objWriter->writeAttribute('w:val', 'clear');
|
||||||
$objWriter->writeAttribute('w:color', 'auto');
|
$objWriter->writeAttribute('w:color', 'auto');
|
||||||
@ -537,18 +551,20 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_null($valign)) {
|
if (!is_null($valign)) {
|
||||||
$objWriter->startElement('w:vAlign');
|
$objWriter->startElement('w:vAlign');
|
||||||
$objWriter->writeAttribute('w:val', $valign);
|
$objWriter->writeAttribute('w:val', $valign);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($borders) {
|
if ($borders) {
|
||||||
$_defaultColor = $style->getDefaultBorderColor();
|
$_defaultColor = $style->getDefaultBorderColor();
|
||||||
|
|
||||||
$objWriter->startElement('w:tcBorders');
|
$objWriter->startElement('w:tcBorders');
|
||||||
if($bTop) {
|
if ($bTop) {
|
||||||
if(is_null($brdCol[0])) { $brdCol[0] = $_defaultColor; }
|
if (is_null($brdCol[0])) {
|
||||||
|
$brdCol[0] = $_defaultColor;
|
||||||
|
}
|
||||||
$objWriter->startElement('w:top');
|
$objWriter->startElement('w:top');
|
||||||
$objWriter->writeAttribute('w:val', 'single');
|
$objWriter->writeAttribute('w:val', 'single');
|
||||||
$objWriter->writeAttribute('w:sz', $brdSz[0]);
|
$objWriter->writeAttribute('w:sz', $brdSz[0]);
|
||||||
@ -556,8 +572,10 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($bLeft) {
|
if ($bLeft) {
|
||||||
if(is_null($brdCol[1])) { $brdCol[1] = $_defaultColor; }
|
if (is_null($brdCol[1])) {
|
||||||
|
$brdCol[1] = $_defaultColor;
|
||||||
|
}
|
||||||
$objWriter->startElement('w:left');
|
$objWriter->startElement('w:left');
|
||||||
$objWriter->writeAttribute('w:val', 'single');
|
$objWriter->writeAttribute('w:val', 'single');
|
||||||
$objWriter->writeAttribute('w:sz', $brdSz[1]);
|
$objWriter->writeAttribute('w:sz', $brdSz[1]);
|
||||||
@ -565,8 +583,10 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($bRight) {
|
if ($bRight) {
|
||||||
if(is_null($brdCol[2])) { $brdCol[2] = $_defaultColor; }
|
if (is_null($brdCol[2])) {
|
||||||
|
$brdCol[2] = $_defaultColor;
|
||||||
|
}
|
||||||
$objWriter->startElement('w:right');
|
$objWriter->startElement('w:right');
|
||||||
$objWriter->writeAttribute('w:val', 'single');
|
$objWriter->writeAttribute('w:val', 'single');
|
||||||
$objWriter->writeAttribute('w:sz', $brdSz[2]);
|
$objWriter->writeAttribute('w:sz', $brdSz[2]);
|
||||||
@ -574,8 +594,10 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($bBottom) {
|
if ($bBottom) {
|
||||||
if(is_null($brdCol[3])) { $brdCol[3] = $_defaultColor; }
|
if (is_null($brdCol[3])) {
|
||||||
|
$brdCol[3] = $_defaultColor;
|
||||||
|
}
|
||||||
$objWriter->startElement('w:bottom');
|
$objWriter->startElement('w:bottom');
|
||||||
$objWriter->writeAttribute('w:val', 'single');
|
$objWriter->writeAttribute('w:val', 'single');
|
||||||
$objWriter->writeAttribute('w:sz', $brdSz[3]);
|
$objWriter->writeAttribute('w:sz', $brdSz[3]);
|
||||||
@ -587,31 +609,39 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$gridSpan = $style->getGridSpan();
|
$gridSpan = $style->getGridSpan();
|
||||||
if(!is_null($gridSpan)) {
|
if (!is_null($gridSpan)) {
|
||||||
$objWriter->startElement('w:gridSpan');
|
$objWriter->startElement('w:gridSpan');
|
||||||
$objWriter->writeAttribute('w:val', $gridSpan);
|
$objWriter->writeAttribute('w:val', $gridSpan);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
$vMerge = $style->getVMerge();
|
$vMerge = $style->getVMerge();
|
||||||
if(!is_null($vMerge)) {
|
if (!is_null($vMerge)) {
|
||||||
$objWriter->startElement('w:vMerge');
|
$objWriter->startElement('w:vMerge');
|
||||||
$objWriter->writeAttribute('w:val', $vMerge);
|
$objWriter->writeAttribute('w:val', $vMerge);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _writeImage(PHPWord_Shared_XMLWriter $objWriter = null, $image) {
|
/**
|
||||||
|
* @param \PHPWord_Shared_XMLWriter $objWriter
|
||||||
|
* @param \PHPWord_Section_Image $image
|
||||||
|
*/
|
||||||
|
protected function _writeImage(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_Image $image)
|
||||||
|
{
|
||||||
$rId = $image->getRelationId();
|
$rId = $image->getRelationId();
|
||||||
|
|
||||||
$style = $image->getStyle();
|
$style = $image->getStyle();
|
||||||
$width = $style->getWidth();
|
$width = $style->getWidth();
|
||||||
$height = $style->getHeight();
|
$height = $style->getHeight();
|
||||||
$align = $style->getAlign();
|
$align = $style->getAlign();
|
||||||
|
$marginTop = $style->getMarginTop();
|
||||||
|
$marginLeft = $style->getMarginLeft();
|
||||||
|
$wrappingStyle = $style->getWrappingStyle();
|
||||||
|
|
||||||
$objWriter->startElement('w:p');
|
$objWriter->startElement('w:p');
|
||||||
|
|
||||||
if(!is_null($align)) {
|
if (!is_null($align)) {
|
||||||
$objWriter->startElement('w:pPr');
|
$objWriter->startElement('w:pPr');
|
||||||
$objWriter->startElement('w:jc');
|
$objWriter->startElement('w:jc');
|
||||||
$objWriter->writeAttribute('w:val', $align);
|
$objWriter->writeAttribute('w:val', $align);
|
||||||
@ -625,10 +655,40 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
|
|
||||||
$objWriter->startElement('v:shape');
|
$objWriter->startElement('v:shape');
|
||||||
$objWriter->writeAttribute('type', '#_x0000_t75');
|
$objWriter->writeAttribute('type', '#_x0000_t75');
|
||||||
$objWriter->writeAttribute('style', 'width:'.$width.'px;height:'.$height.'px');
|
|
||||||
|
$imgStyle = '';
|
||||||
|
if (null !== $width) {
|
||||||
|
$imgStyle .= 'width:' . $width . 'px;';
|
||||||
|
}
|
||||||
|
if (null !== $height) {
|
||||||
|
$imgStyle .= 'height:' . $height . 'px;';
|
||||||
|
}
|
||||||
|
if (null !== $marginTop) {
|
||||||
|
$imgStyle .= 'margin-top:' . $marginTop . 'in;';
|
||||||
|
}
|
||||||
|
if (null !== $marginLeft) {
|
||||||
|
$imgStyle .= 'margin-left:' . $marginLeft . 'in;';
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($wrappingStyle) {
|
||||||
|
case PHPWord_Style_Image::WRAPPING_STYLE_BEHIND:
|
||||||
|
$imgStyle .= 'position:absolute;z-index:-251658752;';
|
||||||
|
break;
|
||||||
|
case PHPWord_Style_Image::WRAPPING_STYLE_SQUARE:
|
||||||
|
$imgStyle .= 'position:absolute;z-index:251659264;mso-position-horizontal:absolute;mso-position-vertical:absolute;';
|
||||||
|
break;
|
||||||
|
case PHPWord_Style_Image::WRAPPING_STYLE_TIGHT:
|
||||||
|
$imgStyle .= 'position:absolute;z-index:251659264;mso-wrap-edited:f;mso-position-horizontal:absolute;mso-position-vertical:absolute';
|
||||||
|
break;
|
||||||
|
case PHPWord_Style_Image::WRAPPING_STYLE_INFRONT:
|
||||||
|
$imgStyle .= 'position:absolute;zz-index:251659264;mso-position-horizontal:absolute;mso-position-vertical:absolute;';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
$objWriter->writeAttribute('style', $imgStyle);
|
||||||
|
|
||||||
$objWriter->startElement('v:imagedata');
|
$objWriter->startElement('v:imagedata');
|
||||||
$objWriter->writeAttribute('r:id', 'rId'.$rId);
|
$objWriter->writeAttribute('r:id', 'rId' . $rId);
|
||||||
$objWriter->writeAttribute('o:title', '');
|
$objWriter->writeAttribute('o:title', '');
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
@ -640,7 +700,8 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _writeWatermark(PHPWord_Shared_XMLWriter $objWriter = null, $image) {
|
protected function _writeWatermark(PHPWord_Shared_XMLWriter $objWriter = null, $image)
|
||||||
|
{
|
||||||
$rId = $image->getRelationId();
|
$rId = $image->getRelationId();
|
||||||
|
|
||||||
$style = $image->getStyle();
|
$style = $image->getStyle();
|
||||||
@ -659,19 +720,19 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
$objWriter->writeAttribute('type', '#_x0000_t75');
|
$objWriter->writeAttribute('type', '#_x0000_t75');
|
||||||
|
|
||||||
$strStyle = 'position:absolute;';
|
$strStyle = 'position:absolute;';
|
||||||
$strStyle .= ' width:'.$width.'px;';
|
$strStyle .= ' width:' . $width . 'px;';
|
||||||
$strStyle .= ' height:'.$height.'px;';
|
$strStyle .= ' height:' . $height . 'px;';
|
||||||
if(!is_null($marginTop)) {
|
if (!is_null($marginTop)) {
|
||||||
$strStyle .= ' margin-top:'.$marginTop.'px;';
|
$strStyle .= ' margin-top:' . $marginTop . 'px;';
|
||||||
}
|
}
|
||||||
if(!is_null($marginLeft)) {
|
if (!is_null($marginLeft)) {
|
||||||
$strStyle .= ' margin-left:'.$marginLeft.'px;';
|
$strStyle .= ' margin-left:' . $marginLeft . 'px;';
|
||||||
}
|
}
|
||||||
|
|
||||||
$objWriter->writeAttribute('style', $strStyle);
|
$objWriter->writeAttribute('style', $strStyle);
|
||||||
|
|
||||||
$objWriter->startElement('v:imagedata');
|
$objWriter->startElement('v:imagedata');
|
||||||
$objWriter->writeAttribute('r:id', 'rId'.$rId);
|
$objWriter->writeAttribute('r:id', 'rId' . $rId);
|
||||||
$objWriter->writeAttribute('o:title', '');
|
$objWriter->writeAttribute('o:title', '');
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
@ -683,7 +744,8 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _writeTitle(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_Title $title) {
|
protected function _writeTitle(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_Title $title)
|
||||||
|
{
|
||||||
$text = htmlspecialchars($title->getText());
|
$text = htmlspecialchars($title->getText());
|
||||||
$text = PHPWord_Shared_String::ControlCharacterPHP2OOXML($text);
|
$text = PHPWord_Shared_String::ControlCharacterPHP2OOXML($text);
|
||||||
$anchor = $title->getAnchor();
|
$anchor = $title->getAnchor();
|
||||||
@ -692,7 +754,7 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
|
|
||||||
$objWriter->startElement('w:p');
|
$objWriter->startElement('w:p');
|
||||||
|
|
||||||
if(!empty($style)) {
|
if (!empty($style)) {
|
||||||
$objWriter->startElement('w:pPr');
|
$objWriter->startElement('w:pPr');
|
||||||
$objWriter->startElement('w:pStyle');
|
$objWriter->startElement('w:pStyle');
|
||||||
$objWriter->writeAttribute('w:val', $style);
|
$objWriter->writeAttribute('w:val', $style);
|
||||||
@ -724,4 +786,3 @@ class PHPWord_Writer_Word2007_Base extends PHPWord_Writer_Word2007_WriterPart {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
2
Classes/PHPWord/Writer/Word2007/ContentTypes.php
Normal file → Executable file
2
Classes/PHPWord/Writer/Word2007/ContentTypes.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Writer/Word2007/DocProps.php
Normal file → Executable file
2
Classes/PHPWord/Writer/Word2007/DocProps.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
121
Classes/PHPWord/Writer/Word2007/Document.php
Normal file → Executable file
121
Classes/PHPWord/Writer/Word2007/Document.php
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* PHPWord
|
* PHPWord
|
||||||
*
|
*
|
||||||
* Copyright (c) 2011 PHPWord
|
* Copyright (c) 2013 PHPWord
|
||||||
*
|
*
|
||||||
* This library is free software; you can redistribute it and/or
|
* This library is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU Lesser General Public
|
* modify it under the terms of the GNU Lesser General Public
|
||||||
@ -20,25 +20,29 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 010 PHPWord
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version Beta 0.6.3, 08.07.2011
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class PHPWord_Writer_Word2007_Document
|
||||||
|
*/
|
||||||
|
class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base
|
||||||
|
{
|
||||||
|
|
||||||
class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
public function writeDocument(PHPWord $pPHPWord = null)
|
||||||
|
{
|
||||||
public function writeDocument(PHPWord $pPHPWord = null) {
|
|
||||||
// Create XML writer
|
// Create XML writer
|
||||||
|
|
||||||
if($this->getParentWriter()->getUseDiskCaching()) {
|
if ($this->getParentWriter()->getUseDiskCaching()) {
|
||||||
$objWriter = new PHPWord_Shared_XMLWriter(PHPWord_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
|
$objWriter = new PHPWord_Shared_XMLWriter(PHPWord_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
|
||||||
} else {
|
} else {
|
||||||
$objWriter = new PHPWord_Shared_XMLWriter(PHPWord_Shared_XMLWriter::STORAGE_MEMORY);
|
$objWriter = new PHPWord_Shared_XMLWriter(PHPWord_Shared_XMLWriter::STORAGE_MEMORY);
|
||||||
}
|
}
|
||||||
|
|
||||||
// XML header
|
// XML header
|
||||||
$objWriter->startDocument('1.0','UTF-8','yes');
|
$objWriter->startDocument('1.0', 'UTF-8', 'yes');
|
||||||
|
|
||||||
// w:document
|
// w:document
|
||||||
$objWriter->startElement('w:document');
|
$objWriter->startElement('w:document');
|
||||||
@ -59,40 +63,41 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$countSections = count($_sections);
|
$countSections = count($_sections);
|
||||||
$pSection = 0;
|
$pSection = 0;
|
||||||
|
|
||||||
if($countSections > 0) {
|
if ($countSections > 0) {
|
||||||
foreach($_sections as $section) {
|
foreach ($_sections as $section) {
|
||||||
$pSection++;
|
$pSection++;
|
||||||
|
|
||||||
$_elements = $section->getElements();
|
$_elements = $section->getElements();
|
||||||
|
|
||||||
foreach($_elements as $element) {
|
foreach ($_elements as $element) {
|
||||||
if($element instanceof PHPWord_Section_Text) {
|
if ($element instanceof PHPWord_Section_Text) {
|
||||||
$this->_writeText($objWriter, $element);
|
$this->_writeText($objWriter, $element);
|
||||||
} elseif($element instanceof PHPWord_Section_TextRun) {
|
} elseif ($element instanceof PHPWord_Section_TextRun) {
|
||||||
$this->_writeTextRun($objWriter, $element);
|
$this->_writeTextRun($objWriter, $element);
|
||||||
} elseif($element instanceof PHPWord_Section_Link) {
|
} elseif ($element instanceof PHPWord_Section_Link) {
|
||||||
$this->_writeLink($objWriter, $element);
|
$this->_writeLink($objWriter, $element);
|
||||||
} elseif($element instanceof PHPWord_Section_Title) {
|
} elseif ($element instanceof PHPWord_Section_Title) {
|
||||||
$this->_writeTitle($objWriter, $element);
|
$this->_writeTitle($objWriter, $element);
|
||||||
} elseif($element instanceof PHPWord_Section_TextBreak) {
|
} elseif ($element instanceof PHPWord_Section_TextBreak) {
|
||||||
$this->_writeTextBreak($objWriter);
|
$this->_writeTextBreak($objWriter);
|
||||||
} elseif($element instanceof PHPWord_Section_PageBreak) {
|
} elseif ($element instanceof PHPWord_Section_PageBreak) {
|
||||||
$this->_writePageBreak($objWriter);
|
$this->_writePageBreak($objWriter);
|
||||||
} elseif($element instanceof PHPWord_Section_Table) {
|
} elseif ($element instanceof PHPWord_Section_Table) {
|
||||||
$this->_writeTable($objWriter, $element);
|
$this->_writeTable($objWriter, $element);
|
||||||
} elseif($element instanceof PHPWord_Section_ListItem) {
|
} elseif ($element instanceof PHPWord_Section_ListItem) {
|
||||||
$this->_writeListItem($objWriter, $element);
|
$this->_writeListItem($objWriter, $element);
|
||||||
} elseif($element instanceof PHPWord_Section_Image ||
|
} elseif ($element instanceof PHPWord_Section_Image ||
|
||||||
$element instanceof PHPWord_Section_MemoryImage) {
|
$element instanceof PHPWord_Section_MemoryImage
|
||||||
|
) {
|
||||||
$this->_writeImage($objWriter, $element);
|
$this->_writeImage($objWriter, $element);
|
||||||
} elseif($element instanceof PHPWord_Section_Object) {
|
} elseif ($element instanceof PHPWord_Section_Object) {
|
||||||
$this->_writeObject($objWriter, $element);
|
$this->_writeObject($objWriter, $element);
|
||||||
} elseif($element instanceof PHPWord_TOC) {
|
} elseif ($element instanceof PHPWord_TOC) {
|
||||||
$this->_writeTOC($objWriter);
|
$this->_writeTOC($objWriter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($pSection == $countSections) {
|
if ($pSection == $countSections) {
|
||||||
$this->_writeEndSection($objWriter, $section);
|
$this->_writeEndSection($objWriter, $section);
|
||||||
} else {
|
} else {
|
||||||
$this->_writeSection($objWriter, $section);
|
$this->_writeSection($objWriter, $section);
|
||||||
@ -107,7 +112,8 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
return $objWriter->getData();
|
return $objWriter->getData();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _writeSection(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section $section) {
|
private function _writeSection(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section $section)
|
||||||
|
{
|
||||||
$objWriter->startElement('w:p');
|
$objWriter->startElement('w:p');
|
||||||
$objWriter->startElement('w:pPr');
|
$objWriter->startElement('w:pPr');
|
||||||
$this->_writeEndSection($objWriter, $section, 3);
|
$this->_writeEndSection($objWriter, $section, 3);
|
||||||
@ -115,7 +121,8 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _writeEndSection(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section $section) {
|
private function _writeEndSection(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section $section)
|
||||||
|
{
|
||||||
$_settings = $section->getSettings();
|
$_settings = $section->getSettings();
|
||||||
$_headers = $section->getHeaders();
|
$_headers = $section->getHeaders();
|
||||||
$_footer = $section->getFooter();
|
$_footer = $section->getFooter();
|
||||||
@ -136,20 +143,20 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$rId = $_header->getRelationId();
|
$rId = $_header->getRelationId();
|
||||||
$objWriter->startElement('w:headerReference');
|
$objWriter->startElement('w:headerReference');
|
||||||
$objWriter->writeAttribute('w:type', $_header->getType());
|
$objWriter->writeAttribute('w:type', $_header->getType());
|
||||||
$objWriter->writeAttribute('r:id', 'rId'.$rId);
|
$objWriter->writeAttribute('r:id', 'rId' . $rId);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if($section->hasDifferentFirstPage()) {
|
if ($section->hasDifferentFirstPage()) {
|
||||||
$objWriter->startElement('w:titlePg');
|
$objWriter->startElement('w:titlePg');
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_null($_footer)) {
|
if (!is_null($_footer)) {
|
||||||
$rId = $_footer->getRelationId();
|
$rId = $_footer->getRelationId();
|
||||||
$objWriter->startElement('w:footerReference');
|
$objWriter->startElement('w:footerReference');
|
||||||
$objWriter->writeAttribute('w:type', 'default');
|
$objWriter->writeAttribute('w:type', 'default');
|
||||||
$objWriter->writeAttribute('r:id', 'rId'.$rId);
|
$objWriter->writeAttribute('r:id', 'rId' . $rId);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +164,7 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$objWriter->writeAttribute('w:w', $pgSzW);
|
$objWriter->writeAttribute('w:w', $pgSzW);
|
||||||
$objWriter->writeAttribute('w:h', $pgSzH);
|
$objWriter->writeAttribute('w:h', $pgSzH);
|
||||||
|
|
||||||
if(!is_null($orientation) && strtolower($orientation) != 'portrait') {
|
if (!is_null($orientation) && strtolower($orientation) != 'portrait') {
|
||||||
$objWriter->writeAttribute('w:orient', $orientation);
|
$objWriter->writeAttribute('w:orient', $orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,13 +181,13 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
|
|
||||||
if(!is_null($borders[0]) || !is_null($borders[1]) || !is_null($borders[2]) || !is_null($borders[3])) {
|
if (!is_null($borders[0]) || !is_null($borders[1]) || !is_null($borders[2]) || !is_null($borders[3])) {
|
||||||
$borderColor = $_settings->getBorderColor();
|
$borderColor = $_settings->getBorderColor();
|
||||||
|
|
||||||
$objWriter->startElement('w:pgBorders');
|
$objWriter->startElement('w:pgBorders');
|
||||||
$objWriter->writeAttribute('w:offsetFrom', 'page');
|
$objWriter->writeAttribute('w:offsetFrom', 'page');
|
||||||
|
|
||||||
if(!is_null($borders[0])) {
|
if (!is_null($borders[0])) {
|
||||||
$objWriter->startElement('w:top');
|
$objWriter->startElement('w:top');
|
||||||
$objWriter->writeAttribute('w:val', 'single');
|
$objWriter->writeAttribute('w:val', 'single');
|
||||||
$objWriter->writeAttribute('w:sz', $borders[0]);
|
$objWriter->writeAttribute('w:sz', $borders[0]);
|
||||||
@ -189,7 +196,7 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_null($borders[1])) {
|
if (!is_null($borders[1])) {
|
||||||
$objWriter->startElement('w:left');
|
$objWriter->startElement('w:left');
|
||||||
$objWriter->writeAttribute('w:val', 'single');
|
$objWriter->writeAttribute('w:val', 'single');
|
||||||
$objWriter->writeAttribute('w:sz', $borders[1]);
|
$objWriter->writeAttribute('w:sz', $borders[1]);
|
||||||
@ -198,7 +205,7 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_null($borders[2])) {
|
if (!is_null($borders[2])) {
|
||||||
$objWriter->startElement('w:right');
|
$objWriter->startElement('w:right');
|
||||||
$objWriter->writeAttribute('w:val', 'single');
|
$objWriter->writeAttribute('w:val', 'single');
|
||||||
$objWriter->writeAttribute('w:sz', $borders[2]);
|
$objWriter->writeAttribute('w:sz', $borders[2]);
|
||||||
@ -207,7 +214,7 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_null($borders[3])) {
|
if (!is_null($borders[3])) {
|
||||||
$objWriter->startElement('w:bottom');
|
$objWriter->startElement('w:bottom');
|
||||||
$objWriter->writeAttribute('w:val', 'single');
|
$objWriter->writeAttribute('w:val', 'single');
|
||||||
$objWriter->writeAttribute('w:sz', $borders[3]);
|
$objWriter->writeAttribute('w:sz', $borders[3]);
|
||||||
@ -227,7 +234,8 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _writePageBreak(PHPWord_Shared_XMLWriter $objWriter = null) {
|
private function _writePageBreak(PHPWord_Shared_XMLWriter $objWriter = null)
|
||||||
|
{
|
||||||
$objWriter->startElement('w:p');
|
$objWriter->startElement('w:p');
|
||||||
$objWriter->startElement('w:r');
|
$objWriter->startElement('w:r');
|
||||||
$objWriter->startElement('w:br');
|
$objWriter->startElement('w:br');
|
||||||
@ -237,7 +245,8 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _writeListItem(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_ListItem $listItem) {
|
private function _writeListItem(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_ListItem $listItem)
|
||||||
|
{
|
||||||
$textObject = $listItem->getTextObject();
|
$textObject = $listItem->getTextObject();
|
||||||
$text = $textObject->getText();
|
$text = $textObject->getText();
|
||||||
$styleParagraph = $textObject->getParagraphStyle();
|
$styleParagraph = $textObject->getParagraphStyle();
|
||||||
@ -249,9 +258,9 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$objWriter->startElement('w:p');
|
$objWriter->startElement('w:p');
|
||||||
$objWriter->startElement('w:pPr');
|
$objWriter->startElement('w:pPr');
|
||||||
|
|
||||||
if($SpIsObject) {
|
if ($SpIsObject) {
|
||||||
$this->_writeParagraphStyle($objWriter, $styleParagraph, true);
|
$this->_writeParagraphStyle($objWriter, $styleParagraph, true);
|
||||||
} elseif(!$SpIsObject && !is_null($styleParagraph)) {
|
} elseif (!$SpIsObject && !is_null($styleParagraph)) {
|
||||||
$objWriter->startElement('w:pStyle');
|
$objWriter->startElement('w:pStyle');
|
||||||
$objWriter->writeAttribute('w:val', $styleParagraph);
|
$objWriter->writeAttribute('w:val', $styleParagraph);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
@ -275,10 +284,11 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _writeObject(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_Object $object) {
|
protected function _writeObject(PHPWord_Shared_XMLWriter $objWriter = null, PHPWord_Section_Object $object)
|
||||||
|
{
|
||||||
$rIdObject = $object->getRelationId();
|
$rIdObject = $object->getRelationId();
|
||||||
$rIdImage = $object->getImageRelationId();
|
$rIdImage = $object->getImageRelationId();
|
||||||
$shapeId = md5($rIdObject.'_'.$rIdImage);
|
$shapeId = md5($rIdObject . '_' . $rIdImage);
|
||||||
|
|
||||||
$objectId = $object->getObjectId();
|
$objectId = $object->getObjectId();
|
||||||
|
|
||||||
@ -290,7 +300,7 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
|
|
||||||
$objWriter->startElement('w:p');
|
$objWriter->startElement('w:p');
|
||||||
|
|
||||||
if(!is_null($align)) {
|
if (!is_null($align)) {
|
||||||
$objWriter->startElement('w:pPr');
|
$objWriter->startElement('w:pPr');
|
||||||
$objWriter->startElement('w:jc');
|
$objWriter->startElement('w:jc');
|
||||||
$objWriter->writeAttribute('w:val', $align);
|
$objWriter->writeAttribute('w:val', $align);
|
||||||
@ -311,7 +321,7 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$objWriter->writeAttribute('o:ole', '');
|
$objWriter->writeAttribute('o:ole', '');
|
||||||
|
|
||||||
$objWriter->startElement('v:imagedata');
|
$objWriter->startElement('v:imagedata');
|
||||||
$objWriter->writeAttribute('r:id', 'rId'.$rIdImage);
|
$objWriter->writeAttribute('r:id', 'rId' . $rIdImage);
|
||||||
$objWriter->writeAttribute('o:title', '');
|
$objWriter->writeAttribute('o:title', '');
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
@ -322,8 +332,8 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$objWriter->writeAttribute('ProgID', 'Package');
|
$objWriter->writeAttribute('ProgID', 'Package');
|
||||||
$objWriter->writeAttribute('ShapeID', $shapeId);
|
$objWriter->writeAttribute('ShapeID', $shapeId);
|
||||||
$objWriter->writeAttribute('DrawAspect', 'Icon');
|
$objWriter->writeAttribute('DrawAspect', 'Icon');
|
||||||
$objWriter->writeAttribute('ObjectID', '_'.$objectId);
|
$objWriter->writeAttribute('ObjectID', '_' . $objectId);
|
||||||
$objWriter->writeAttribute('r:id', 'rId'.$rIdObject);
|
$objWriter->writeAttribute('r:id', 'rId' . $rIdObject);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
@ -333,7 +343,8 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$objWriter->endElement(); // w:p
|
$objWriter->endElement(); // w:p
|
||||||
}
|
}
|
||||||
|
|
||||||
private function _writeTOC(PHPWord_Shared_XMLWriter $objWriter = null) {
|
private function _writeTOC(PHPWord_Shared_XMLWriter $objWriter = null)
|
||||||
|
{
|
||||||
$titles = PHPWord_TOC::getTitles();
|
$titles = PHPWord_TOC::getTitles();
|
||||||
$styleFont = PHPWord_TOC::getStyleFont();
|
$styleFont = PHPWord_TOC::getStyleFont();
|
||||||
|
|
||||||
@ -344,7 +355,7 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
|
|
||||||
$isObject = ($styleFont instanceof PHPWord_Style_Font) ? true : false;
|
$isObject = ($styleFont instanceof PHPWord_Style_Font) ? true : false;
|
||||||
|
|
||||||
for($i=0; $i<count($titles); $i++) {
|
for ($i = 0; $i < count($titles); $i++) {
|
||||||
$title = $titles[$i];
|
$title = $titles[$i];
|
||||||
$indent = ($title['depth'] - 1) * $fIndent;
|
$indent = ($title['depth'] - 1) * $fIndent;
|
||||||
|
|
||||||
@ -352,17 +363,17 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
|
|
||||||
$objWriter->startElement('w:pPr');
|
$objWriter->startElement('w:pPr');
|
||||||
|
|
||||||
if($isObject && !is_null($styleFont->getParagraphStyle())) {
|
if ($isObject && !is_null($styleFont->getParagraphStyle())) {
|
||||||
$this->_writeParagraphStyle($objWriter, $styleFont->getParagraphStyle());
|
$this->_writeParagraphStyle($objWriter, $styleFont->getParagraphStyle());
|
||||||
}
|
}
|
||||||
|
|
||||||
if($indent > 0) {
|
if ($indent > 0) {
|
||||||
$objWriter->startElement('w:ind');
|
$objWriter->startElement('w:ind');
|
||||||
$objWriter->writeAttribute('w:left', $indent);
|
$objWriter->writeAttribute('w:left', $indent);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!empty($styleFont) && !$isObject) {
|
if (!empty($styleFont) && !$isObject) {
|
||||||
$objWriter->startElement('w:pPr');
|
$objWriter->startElement('w:pPr');
|
||||||
$objWriter->startElement('w:pStyle');
|
$objWriter->startElement('w:pStyle');
|
||||||
$objWriter->writeAttribute('w:val', $styleFont);
|
$objWriter->writeAttribute('w:val', $styleFont);
|
||||||
@ -373,7 +384,7 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$objWriter->startElement('w:tabs');
|
$objWriter->startElement('w:tabs');
|
||||||
$objWriter->startElement('w:tab');
|
$objWriter->startElement('w:tab');
|
||||||
$objWriter->writeAttribute('w:val', 'right');
|
$objWriter->writeAttribute('w:val', 'right');
|
||||||
if(!empty($tabLeader)) {
|
if (!empty($tabLeader)) {
|
||||||
$objWriter->writeAttribute('w:leader', $tabLeader);
|
$objWriter->writeAttribute('w:leader', $tabLeader);
|
||||||
}
|
}
|
||||||
$objWriter->writeAttribute('w:pos', $tabPos);
|
$objWriter->writeAttribute('w:pos', $tabPos);
|
||||||
@ -383,7 +394,7 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$objWriter->endElement(); // w:pPr
|
$objWriter->endElement(); // w:pPr
|
||||||
|
|
||||||
|
|
||||||
if($i == 0) {
|
if ($i == 0) {
|
||||||
$objWriter->startElement('w:r');
|
$objWriter->startElement('w:r');
|
||||||
$objWriter->startElement('w:fldChar');
|
$objWriter->startElement('w:fldChar');
|
||||||
$objWriter->writeAttribute('w:fldCharType', 'begin');
|
$objWriter->writeAttribute('w:fldCharType', 'begin');
|
||||||
@ -410,7 +421,7 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
|
|
||||||
$objWriter->startElement('w:r');
|
$objWriter->startElement('w:r');
|
||||||
|
|
||||||
if($isObject) {
|
if ($isObject) {
|
||||||
$this->_writeTextStyle($objWriter, $styleFont);
|
$this->_writeTextStyle($objWriter, $styleFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,7 +443,7 @@ class PHPWord_Writer_Word2007_Document extends PHPWord_Writer_Word2007_Base {
|
|||||||
$objWriter->startElement('w:r');
|
$objWriter->startElement('w:r');
|
||||||
$objWriter->startElement('w:instrText');
|
$objWriter->startElement('w:instrText');
|
||||||
$objWriter->writeAttribute('xml:space', 'preserve');
|
$objWriter->writeAttribute('xml:space', 'preserve');
|
||||||
$objWriter->writeRaw('PAGEREF '.$title['anchor'].' \h');
|
$objWriter->writeRaw('PAGEREF ' . $title['anchor'] . ' \h');
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
|
||||||
|
|||||||
2
Classes/PHPWord/Writer/Word2007/DocumentRels.php
Normal file → Executable file
2
Classes/PHPWord/Writer/Word2007/DocumentRels.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Writer/Word2007/Footer.php
Normal file → Executable file
2
Classes/PHPWord/Writer/Word2007/Footer.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Writer/Word2007/Header.php
Normal file → Executable file
2
Classes/PHPWord/Writer/Word2007/Header.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Writer/Word2007/Rels.php
Normal file → Executable file
2
Classes/PHPWord/Writer/Word2007/Rels.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Writer/Word2007/Styles.php
Normal file → Executable file
2
Classes/PHPWord/Writer/Word2007/Styles.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
Classes/PHPWord/Writer/Word2007/WriterPart.php
Normal file → Executable file
2
Classes/PHPWord/Writer/Word2007/WriterPart.php
Normal file → Executable file
@ -20,7 +20,7 @@
|
|||||||
*
|
*
|
||||||
* @category PHPWord
|
* @category PHPWord
|
||||||
* @package PHPWord
|
* @package PHPWord
|
||||||
* @copyright Copyright (c) 2013 PHPWord (http://www.codeplex.com/PHPWord)
|
* @copyright Copyright (c) 2013 PHPWord
|
||||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||||
* @version 0.7.0
|
* @version 0.7.0
|
||||||
*/
|
*/
|
||||||
|
|||||||
2
README.md
Normal file → Executable file
2
README.md
Normal file → Executable file
@ -59,7 +59,7 @@ $objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
|||||||
$objWriter->save('helloWorld.docx');
|
$objWriter->save('helloWorld.docx');
|
||||||
```
|
```
|
||||||
|
|
||||||
## Image
|
## Images
|
||||||
|
|
||||||
You can add images easily using the following example.
|
You can add images easily using the following example.
|
||||||
|
|
||||||
|
|||||||
5
changelog.txt
Normal file → Executable file
5
changelog.txt
Normal file → Executable file
@ -22,7 +22,7 @@
|
|||||||
* @version ##VERSION##, ##DATE##
|
* @version ##VERSION##, ##DATE##
|
||||||
**************************************************************************************
|
**************************************************************************************
|
||||||
|
|
||||||
Fixed in branch for release 0.7 :
|
Fixed in branch for release 0.7.0 :
|
||||||
- Bugfix: (RomanSyroeshko) GH-32 - "Warning: Invalid error type specified in ...\PHPWord.php on line 226" is thrown when the specified template file is not found
|
- Bugfix: (RomanSyroeshko) GH-32 - "Warning: Invalid error type specified in ...\PHPWord.php on line 226" is thrown when the specified template file is not found
|
||||||
- Bugfix: (RomanSyroeshko) GH-34 - PHPWord_Shared_String.IsUTF8 returns FALSE for Cyrillic UTF-8 input
|
- Bugfix: (RomanSyroeshko) GH-34 - PHPWord_Shared_String.IsUTF8 returns FALSE for Cyrillic UTF-8 input
|
||||||
- Bugfix: (RomanSyroeshko) GH-38 - Temporary files naming logic in PHPWord_Template can lead to a collision
|
- Bugfix: (RomanSyroeshko) GH-38 - Temporary files naming logic in PHPWord_Template can lead to a collision
|
||||||
@ -38,5 +38,4 @@ Fixed in branch for release 0.7 :
|
|||||||
- General: (Progi1984) - Added PHPWord_Exception and exception when could not copy the template
|
- General: (Progi1984) - Added PHPWord_Exception and exception when could not copy the template
|
||||||
- General: (Progi1984) - IMPROVED : Moved examples out of Classes directory
|
- General: (Progi1984) - IMPROVED : Moved examples out of Classes directory
|
||||||
- General: (Esmeraldo) CP-49 - IMPROVED : Advanced string replace in setValue for Template
|
- General: (Esmeraldo) CP-49 - IMPROVED : Advanced string replace in setValue for Template
|
||||||
- Feature: (gavroche) Added composer file
|
- Feature: (gavroche) - Added support for image wrapping style
|
||||||
- Feature: (gavroche) Added support for image wrapping style
|
|
||||||
|
|||||||
1
samples/Sample_01_SimpleText.php
Normal file → Executable file
1
samples/Sample_01_SimpleText.php
Normal file → Executable file
@ -49,4 +49,3 @@ echo date('H:i:s') , " Peak memory usage: " , (memory_get_peak_usage(true) / 102
|
|||||||
|
|
||||||
// Echo done
|
// Echo done
|
||||||
echo date('H:i:s') , " Done writing file" , EOL;
|
echo date('H:i:s') , " Done writing file" , EOL;
|
||||||
?>
|
|
||||||
1
samples/Sample_02_TabStops.php
Normal file → Executable file
1
samples/Sample_02_TabStops.php
Normal file → Executable file
@ -61,4 +61,3 @@ echo date('H:i:s') , ' Peak memory usage: ' , (memory_get_peak_usage(true) / 102
|
|||||||
|
|
||||||
// Echo done
|
// Echo done
|
||||||
echo date('H:i:s') , ' Done writing file' , EOL;
|
echo date('H:i:s') , ' Done writing file' , EOL;
|
||||||
?>
|
|
||||||
1
samples/old/AdvancedTable.php
Normal file → Executable file
1
samples/old/AdvancedTable.php
Normal file → Executable file
@ -50,4 +50,3 @@ for($i = 1; $i <= 10; $i++) {
|
|||||||
// Save File
|
// Save File
|
||||||
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
||||||
$objWriter->save('AdvancedTable.docx');
|
$objWriter->save('AdvancedTable.docx');
|
||||||
?>
|
|
||||||
1
samples/old/BasicTable.php
Normal file → Executable file
1
samples/old/BasicTable.php
Normal file → Executable file
@ -23,4 +23,3 @@ for($r = 1; $r <= 10; $r++) { // Loop through rows
|
|||||||
// Save File
|
// Save File
|
||||||
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
||||||
$objWriter->save('BasicTable.docx');
|
$objWriter->save('BasicTable.docx');
|
||||||
?>
|
|
||||||
1
samples/old/HeaderFooter.php
Normal file → Executable file
1
samples/old/HeaderFooter.php
Normal file → Executable file
@ -54,4 +54,3 @@ $section2->addText('Some text...');
|
|||||||
// Save File
|
// Save File
|
||||||
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
||||||
$objWriter->save('HeaderFooter.docx');
|
$objWriter->save('HeaderFooter.docx');
|
||||||
?>
|
|
||||||
1
samples/old/Image.php
Normal file → Executable file
1
samples/old/Image.php
Normal file → Executable file
@ -21,4 +21,3 @@ $section->addImage('_mars.jpg', array('width'=>100, 'height'=>100, 'align'=>'rig
|
|||||||
// Save File
|
// Save File
|
||||||
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
||||||
$objWriter->save('Image.docx');
|
$objWriter->save('Image.docx');
|
||||||
?>
|
|
||||||
1
samples/old/Link.php
Normal file → Executable file
1
samples/old/Link.php
Normal file → Executable file
@ -21,4 +21,3 @@ $section->addLink('http://www.yahoo.com', null, 'myOwnLinkStyle');
|
|||||||
// Save File
|
// Save File
|
||||||
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
||||||
$objWriter->save('Link.docx');
|
$objWriter->save('Link.docx');
|
||||||
?>
|
|
||||||
1
samples/old/ListItem.php
Normal file → Executable file
1
samples/old/ListItem.php
Normal file → Executable file
@ -44,4 +44,3 @@ $section->addListItem('List Item 7', 0, 'myOwnStyle', $listStyle, 'P-Style');
|
|||||||
// Save File
|
// Save File
|
||||||
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
||||||
$objWriter->save('ListItem.docx');
|
$objWriter->save('ListItem.docx');
|
||||||
?>
|
|
||||||
1
samples/old/Object.php
Normal file → Executable file
1
samples/old/Object.php
Normal file → Executable file
@ -17,4 +17,3 @@ $section->addObject('_sheet.xls');
|
|||||||
// Save File
|
// Save File
|
||||||
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
||||||
$objWriter->save('Object.docx');
|
$objWriter->save('Object.docx');
|
||||||
?>
|
|
||||||
|
|||||||
1
samples/old/Section.php
Normal file → Executable file
1
samples/old/Section.php
Normal file → Executable file
@ -23,4 +23,3 @@ $section->addText('This section uses other margins.');
|
|||||||
// Save File
|
// Save File
|
||||||
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
||||||
$objWriter->save('Section.docx');
|
$objWriter->save('Section.docx');
|
||||||
?>
|
|
||||||
1
samples/old/Template.php
Normal file → Executable file
1
samples/old/Template.php
Normal file → Executable file
@ -20,4 +20,3 @@ $document->setValue('weekday', date('l'));
|
|||||||
$document->setValue('time', date('H:i'));
|
$document->setValue('time', date('H:i'));
|
||||||
|
|
||||||
$document->save('Solarsystem.docx');
|
$document->save('Solarsystem.docx');
|
||||||
?>
|
|
||||||
1
samples/old/Textrun.php
Normal file → Executable file
1
samples/old/Textrun.php
Normal file → Executable file
@ -29,4 +29,3 @@ $textrun->addLink('http://www.bing.com', null, 'NLink');
|
|||||||
// Save File
|
// Save File
|
||||||
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
||||||
$objWriter->save('Textrun.docx');
|
$objWriter->save('Textrun.docx');
|
||||||
?>
|
|
||||||
1
samples/old/TitleTOC.php
Normal file → Executable file
1
samples/old/TitleTOC.php
Normal file → Executable file
@ -46,4 +46,3 @@ echo 'Note: The pagenumbers in the TOC doesnt refresh automatically.';
|
|||||||
// Save File
|
// Save File
|
||||||
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
||||||
$objWriter->save('TitleTOC.docx');
|
$objWriter->save('TitleTOC.docx');
|
||||||
?>
|
|
||||||
|
|||||||
1
samples/old/Watermark.php
Normal file → Executable file
1
samples/old/Watermark.php
Normal file → Executable file
@ -18,4 +18,3 @@ $section->addText('The header reference to the current section includes a waterm
|
|||||||
// Save File
|
// Save File
|
||||||
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
|
||||||
$objWriter->save('Watermark.docx');
|
$objWriter->save('Watermark.docx');
|
||||||
?>
|
|
||||||
2
test/PHPWord/Tests/ImageTest.php
Normal file → Executable file
2
test/PHPWord/Tests/ImageTest.php
Normal file → Executable file
@ -4,8 +4,6 @@ namespace PHPWord\Tests;
|
|||||||
use PHPUnit_Framework_TestCase;
|
use PHPUnit_Framework_TestCase;
|
||||||
use PHPWord;
|
use PHPWord;
|
||||||
|
|
||||||
require_once __DIR__ . '/../../../src/PHPWord.php';
|
|
||||||
|
|
||||||
class ImageTest extends PHPUnit_Framework_TestCase
|
class ImageTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
public function tearDown()
|
public function tearDown()
|
||||||
|
|||||||
2
test/bootstrap.php
Normal file → Executable file
2
test/bootstrap.php
Normal file → Executable file
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
date_default_timezone_set('UTC');
|
date_default_timezone_set('UTC');
|
||||||
|
|
||||||
require_once __DIR__ . "/../src/PHPWord/Autoloader.php";
|
require_once __DIR__ . "/../Classes/PHPWord/Autoloader.php";
|
||||||
PHPWord_Autoloader::Register();
|
PHPWord_Autoloader::Register();
|
||||||
|
|
||||||
require_once __DIR__ . "/PHPWord/TestHelper.php";
|
require_once __DIR__ . "/PHPWord/TestHelper.php";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user