parent
f4d7fa427d
commit
510f9cdf79
|
|
@ -25,6 +25,13 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice;
|
||||
|
||||
use PhpOffice\PhpWord\DocumentProperties;
|
||||
use PhpOffice\PhpWord\Section;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
use PhpOffice\PhpWord\Template;
|
||||
|
||||
/** PHPWORD_BASE_PATH */
|
||||
// @codeCoverageIgnoreStart
|
||||
if (!defined('PHPWORD_BASE_PATH')) {
|
||||
|
|
@ -36,12 +43,8 @@ if (!defined('PHPWORD_BASE_PATH')) {
|
|||
|
||||
use PhpOffice\PhpWord\Exceptions\Exception;
|
||||
|
||||
/**
|
||||
* PHPWord
|
||||
*/
|
||||
class PHPWord
|
||||
class PhpWord
|
||||
{
|
||||
|
||||
/**
|
||||
* Default font name (Arial)
|
||||
*/
|
||||
|
|
@ -67,7 +70,7 @@ class PHPWord
|
|||
/**
|
||||
* Document properties
|
||||
*
|
||||
* @var PHPWord_DocumentProperties
|
||||
* @var PhpOffice\PhpWord\DocumentProperties
|
||||
*/
|
||||
private $_properties;
|
||||
|
||||
|
|
@ -98,14 +101,14 @@ class PHPWord
|
|||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->_properties = new PHPWord_DocumentProperties();
|
||||
$this->_properties = new DocumentProperties();
|
||||
$this->_defaultFontName = PHPWord::DEFAULT_FONT_NAME;
|
||||
$this->_defaultFontSize = PHPWord::DEFAULT_FONT_SIZE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get properties
|
||||
* @return PHPWord_DocumentProperties
|
||||
* @return PhpOffice\PhpWord\DocumentProperties
|
||||
*/
|
||||
public function getProperties()
|
||||
{
|
||||
|
|
@ -115,10 +118,10 @@ class PHPWord
|
|||
/**
|
||||
* Set properties
|
||||
*
|
||||
* @param PHPWord_DocumentProperties $value
|
||||
* @return PHPWord
|
||||
* @param PhpOffice\PhpWord\DocumentProperties $value
|
||||
* @return PhpOffice\PHPWord
|
||||
*/
|
||||
public function setProperties(PHPWord_DocumentProperties $value)
|
||||
public function setProperties(DocumentProperties $value)
|
||||
{
|
||||
$this->_properties = $value;
|
||||
return $this;
|
||||
|
|
@ -127,14 +130,14 @@ class PHPWord
|
|||
/**
|
||||
* Create a new Section
|
||||
*
|
||||
* @param PHPWord_Section_Settings $settings
|
||||
* @return PHPWord_Section
|
||||
* @param PhpOffice\PhpWord\Section\Settings $settings
|
||||
* @return PhpOffice\PhpWord\Section
|
||||
*/
|
||||
public function createSection($settings = null)
|
||||
{
|
||||
$sectionCount = $this->_countSections() + 1;
|
||||
|
||||
$section = new PHPWord_Section($sectionCount, $settings);
|
||||
$section = new Section($sectionCount, $settings);
|
||||
$this->_sectionCollection[] = $section;
|
||||
return $section;
|
||||
}
|
||||
|
|
@ -182,7 +185,7 @@ class PHPWord
|
|||
*/
|
||||
public function setDefaultParagraphStyle($styles)
|
||||
{
|
||||
PHPWord_Style::setDefaultParagraphStyle($styles);
|
||||
Style::setDefaultParagraphStyle($styles);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -193,7 +196,7 @@ class PHPWord
|
|||
*/
|
||||
public function addParagraphStyle($styleName, $styles)
|
||||
{
|
||||
PHPWord_Style::addParagraphStyle($styleName, $styles);
|
||||
Style::addParagraphStyle($styleName, $styles);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -204,7 +207,7 @@ class PHPWord
|
|||
*/
|
||||
public function addFontStyle($styleName, $styleFont, $styleParagraph = null)
|
||||
{
|
||||
PHPWord_Style::addFontStyle($styleName, $styleFont, $styleParagraph);
|
||||
Style::addFontStyle($styleName, $styleFont, $styleParagraph);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -215,7 +218,7 @@ class PHPWord
|
|||
*/
|
||||
public function addTableStyle($styleName, $styleTable, $styleFirstRow = null)
|
||||
{
|
||||
PHPWord_Style::addTableStyle($styleName, $styleTable, $styleFirstRow);
|
||||
Style::addTableStyle($styleName, $styleTable, $styleFirstRow);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -226,7 +229,7 @@ class PHPWord
|
|||
*/
|
||||
public function addTitleStyle($titleCount, $styleFont, $styleParagraph = null)
|
||||
{
|
||||
PHPWord_Style::addTitleStyle($titleCount, $styleFont, $styleParagraph);
|
||||
Style::addTitleStyle($titleCount, $styleFont, $styleParagraph);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -237,12 +240,12 @@ class PHPWord
|
|||
*/
|
||||
public function addLinkStyle($styleName, $styles)
|
||||
{
|
||||
PHPWord_Style::addLinkStyle($styleName, $styles);
|
||||
Style::addLinkStyle($styleName, $styles);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get sections
|
||||
* @return PHPWord_Section[]
|
||||
* @return PhpOffice\PhpWord\Section[]
|
||||
*/
|
||||
public function getSections()
|
||||
{
|
||||
|
|
@ -253,14 +256,13 @@ class PHPWord
|
|||
* Load a Template File
|
||||
*
|
||||
* @param string $strFilename
|
||||
* @return PHPWord_Template
|
||||
* @return PhpOffice\PhpWord\Template
|
||||
* @throws Exception
|
||||
*/
|
||||
public function loadTemplate($strFilename)
|
||||
{
|
||||
if (file_exists($strFilename)) {
|
||||
$template = new PHPWord_Template($strFilename);
|
||||
return $template;
|
||||
return new Template($strFilename);
|
||||
}
|
||||
throw new Exception("Template file {$strFilename} not found.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,10 +25,9 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_DocumentProperties
|
||||
*/
|
||||
class PHPWord_DocumentProperties
|
||||
namespace PhpOffice\PhpWord;
|
||||
|
||||
class DocumentProperties
|
||||
{
|
||||
/** Constants */
|
||||
const PROPERTY_TYPE_BOOLEAN = 'b';
|
||||
|
|
@ -123,7 +122,7 @@ class PHPWord_DocumentProperties
|
|||
private $_customProperties = array();
|
||||
|
||||
/**
|
||||
* Create new PHPWord_DocumentProperties
|
||||
* Create new DocumentProperties
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
|
|
@ -154,7 +153,7 @@ class PHPWord_DocumentProperties
|
|||
* Set Creator
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPWord_DocumentProperties
|
||||
* @return PhpOffice\PhpWord\DocumentProperties
|
||||
*/
|
||||
public function setCreator($pValue = '')
|
||||
{
|
||||
|
|
@ -176,7 +175,7 @@ class PHPWord_DocumentProperties
|
|||
* Set Last Modified By
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPWord_DocumentProperties
|
||||
* @return PhpOffice\PhpWord\DocumentProperties
|
||||
*/
|
||||
public function setLastModifiedBy($pValue = '')
|
||||
{
|
||||
|
|
@ -198,7 +197,7 @@ class PHPWord_DocumentProperties
|
|||
* Set Created
|
||||
*
|
||||
* @param datetime $pValue
|
||||
* @return PHPWord_DocumentProperties
|
||||
* @return PhpOffice\PhpWord\DocumentProperties
|
||||
*/
|
||||
public function setCreated($pValue = null)
|
||||
{
|
||||
|
|
@ -223,7 +222,7 @@ class PHPWord_DocumentProperties
|
|||
* Set Modified
|
||||
*
|
||||
* @param datetime $pValue
|
||||
* @return PHPWord_DocumentProperties
|
||||
* @return PhpOffice\PhpWord\DocumentProperties
|
||||
*/
|
||||
public function setModified($pValue = null)
|
||||
{
|
||||
|
|
@ -248,7 +247,7 @@ class PHPWord_DocumentProperties
|
|||
* Set Title
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPWord_DocumentProperties
|
||||
* @return PhpOffice\PhpWord\DocumentProperties
|
||||
*/
|
||||
public function setTitle($pValue = '')
|
||||
{
|
||||
|
|
@ -270,7 +269,7 @@ class PHPWord_DocumentProperties
|
|||
* Set Description
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPWord_DocumentProperties
|
||||
* @return PhpOffice\PhpWord\DocumentProperties
|
||||
*/
|
||||
public function setDescription($pValue = '')
|
||||
{
|
||||
|
|
@ -292,7 +291,7 @@ class PHPWord_DocumentProperties
|
|||
* Set Subject
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPWord_DocumentProperties
|
||||
* @return PhpOffice\PhpWord\DocumentProperties
|
||||
*/
|
||||
public function setSubject($pValue = '')
|
||||
{
|
||||
|
|
@ -314,7 +313,7 @@ class PHPWord_DocumentProperties
|
|||
* Set Keywords
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPWord_DocumentProperties
|
||||
* @return PhpOffice\PhpWord\DocumentProperties
|
||||
*/
|
||||
public function setKeywords($pValue = '')
|
||||
{
|
||||
|
|
@ -336,7 +335,7 @@ class PHPWord_DocumentProperties
|
|||
* Set Category
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPWord_DocumentProperties
|
||||
* @return PhpOffice\PhpWord\DocumentProperties
|
||||
*/
|
||||
public function setCategory($pValue = '')
|
||||
{
|
||||
|
|
@ -358,7 +357,7 @@ class PHPWord_DocumentProperties
|
|||
* Set Company
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPWord_DocumentProperties
|
||||
* @return PhpOffice\PhpWord\DocumentProperties
|
||||
*/
|
||||
public function setCompany($pValue = '')
|
||||
{
|
||||
|
|
@ -380,7 +379,7 @@ class PHPWord_DocumentProperties
|
|||
* Set Manager
|
||||
*
|
||||
* @param string $pValue
|
||||
* @return PHPExcel_DocumentProperties
|
||||
* @return PhpOffice\PhpWord\DocumentProperties
|
||||
*/
|
||||
public function setManager($pValue = '')
|
||||
{
|
||||
|
|
@ -448,7 +447,7 @@ class PHPWord_DocumentProperties
|
|||
* 's': String
|
||||
* 'd': Date/Time
|
||||
* 'b': Boolean
|
||||
* @return PHPExcel_DocumentProperties
|
||||
* @return PhpOffice\PhpWord\DocumentProperties
|
||||
*/
|
||||
public function setCustomProperty($propertyName, $propertyValue = '', $propertyType = null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,9 +1,6 @@
|
|||
<?php
|
||||
namespace PhpOffice\PhpWord\Exceptions;
|
||||
|
||||
/**
|
||||
* Class Exception
|
||||
*/
|
||||
class Exception extends \Exception
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,4 +10,4 @@ namespace PhpOffice\PhpWord\Exceptions;
|
|||
*/
|
||||
class InvalidImageException extends Exception
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -10,4 +10,4 @@ namespace PhpOffice\PhpWord\Exceptions;
|
|||
*/
|
||||
class UnsupportedImageTypeException extends Exception
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
@ -25,13 +25,10 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord;
|
||||
|
||||
/**
|
||||
* PHPWord_Footnote
|
||||
*/
|
||||
class PHPWord_Footnote
|
||||
class Footnote
|
||||
{
|
||||
|
||||
/**
|
||||
* Footnote Elements
|
||||
*
|
||||
|
|
@ -54,7 +51,7 @@ class PHPWord_Footnote
|
|||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public static function addFootnoteElement(PHPWord_Section_Footnote $footnote)
|
||||
public static function addFootnoteElement(PhpOffice\PhpWord\Section\Footnote $footnote)
|
||||
{
|
||||
$refID = self::countFootnoteElements() + 2;
|
||||
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord;
|
||||
|
||||
/**
|
||||
* PHPWord_HashTable
|
||||
*
|
||||
* @codeCoverageIgnore Legacy from PHPExcel
|
||||
* @codeCoverageIgnore Legacy from PHPExcel
|
||||
*/
|
||||
class PHPWord_HashTable
|
||||
class HashTable
|
||||
{
|
||||
/**
|
||||
* HashTable elements
|
||||
|
|
@ -47,15 +47,12 @@ class PHPWord_HashTable
|
|||
public $_keyMap = array();
|
||||
|
||||
/**
|
||||
* Create a new PHPWord_HashTable
|
||||
*
|
||||
* @param PHPWord_IComparable[] $pSource Optional source array to create HashTable from
|
||||
* @throws Exception
|
||||
* @param PhpOffice\PhpWord\IComparable[] $pSource Optional source array to create HashTable from
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct($pSource = null)
|
||||
{
|
||||
if (!is_null($pSource)) {
|
||||
// Create HashTable
|
||||
$this->addFromSource($pSource);
|
||||
}
|
||||
}
|
||||
|
|
@ -63,8 +60,8 @@ class PHPWord_HashTable
|
|||
/**
|
||||
* Add HashTable items from source
|
||||
*
|
||||
* @param PHPWord_IComparable[] $pSource Source array to create HashTable from
|
||||
* @throws Exception
|
||||
* @param PhpOffice\PhpWord\IComparable[] $pSource Source array to create HashTable from
|
||||
* @throws Exception
|
||||
*/
|
||||
public function addFromSource($pSource = null)
|
||||
{
|
||||
|
|
@ -83,10 +80,10 @@ class PHPWord_HashTable
|
|||
/**
|
||||
* Add HashTable item
|
||||
*
|
||||
* @param PHPWord_IComparable $pSource Item to add
|
||||
* @throws Exception
|
||||
* @param PhpOffice\PhpWord\IComparable $pSource Item to add
|
||||
* @throws Exception
|
||||
*/
|
||||
public function add(PHPWord_IComparable $pSource = null)
|
||||
public function add(IComparable $pSource = null)
|
||||
{
|
||||
// Determine hashcode
|
||||
$hashCode = null;
|
||||
|
|
@ -113,10 +110,10 @@ class PHPWord_HashTable
|
|||
/**
|
||||
* Remove HashTable item
|
||||
*
|
||||
* @param PHPWord_IComparable $pSource Item to remove
|
||||
* @throws Exception
|
||||
* @param PhpOffice\PhpWord\IComparable $pSource Item to remove
|
||||
* @throws Exception
|
||||
*/
|
||||
public function remove(PHPWord_IComparable $pSource = null)
|
||||
public function remove(IComparable $pSource = null)
|
||||
{
|
||||
if (isset($this->_items[$pSource->getHashCode()])) {
|
||||
unset($this->_items[$pSource->getHashCode()]);
|
||||
|
|
@ -146,8 +143,6 @@ class PHPWord_HashTable
|
|||
}
|
||||
|
||||
/**
|
||||
* Count
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count()
|
||||
|
|
@ -156,10 +151,8 @@ class PHPWord_HashTable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get index for hash code
|
||||
*
|
||||
* @param string $pHashCode
|
||||
* @return int Index
|
||||
* @param string $pHashCode
|
||||
* @return int Index
|
||||
*/
|
||||
public function getIndexForHashCode($pHashCode = '')
|
||||
{
|
||||
|
|
@ -167,11 +160,8 @@ class PHPWord_HashTable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get by index
|
||||
*
|
||||
* @param int $pIndex
|
||||
* @return PHPWord_IComparable
|
||||
*
|
||||
* @param int $pIndex
|
||||
* @return PhpOffice\PhpWord\IComparable
|
||||
*/
|
||||
public function getByIndex($pIndex = 0)
|
||||
{
|
||||
|
|
@ -183,10 +173,8 @@ class PHPWord_HashTable
|
|||
}
|
||||
|
||||
/**
|
||||
* Get by hashcode
|
||||
*
|
||||
* @param string $pHashCode
|
||||
* @return PHPWord_IComparable
|
||||
* @param string $pHashCode
|
||||
* @return PhpOffice\PhpWord\IComparable
|
||||
*
|
||||
*/
|
||||
public function getByHashCode($pHashCode = '')
|
||||
|
|
@ -199,9 +187,7 @@ class PHPWord_HashTable
|
|||
}
|
||||
|
||||
/**
|
||||
* HashTable to array
|
||||
*
|
||||
* @return PHPWord_IComparable[]
|
||||
* @return PhpOffice\PhpWord\IComparable[]
|
||||
*/
|
||||
public function toArray()
|
||||
{
|
||||
|
|
@ -220,4 +206,4 @@ class PHPWord_HashTable
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -25,10 +25,11 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_Media
|
||||
*/
|
||||
class PHPWord_Media
|
||||
namespace PhpOffice\PhpWord;
|
||||
|
||||
use PhpOffice\PhpWord\Section\MemoryImage;
|
||||
|
||||
class Media
|
||||
{
|
||||
/**
|
||||
* Section Media Elements
|
||||
|
|
@ -67,10 +68,10 @@ class PHPWord_Media
|
|||
*
|
||||
* @param string $src
|
||||
* @param string $type
|
||||
* @param PHPWord_Section_MemoryImage|null $memoryImage
|
||||
* @param PhpOffice\PhpWord\Section\MemoryImage|null $memoryImage
|
||||
* @return mixed
|
||||
*/
|
||||
public static function addSectionMediaElement($src, $type, PHPWord_Section_MemoryImage $memoryImage = null)
|
||||
public static function addSectionMediaElement($src, $type, MemoryImage $memoryImage = null)
|
||||
{
|
||||
$mediaId = md5($src);
|
||||
$key = ($type === 'image') ? 'images' : 'embeddings';
|
||||
|
|
@ -205,10 +206,10 @@ class PHPWord_Media
|
|||
*
|
||||
* @param int $headerCount
|
||||
* @param string $src
|
||||
* @param PHPWord_Section_MemoryImage|null $memoryImage
|
||||
* @param PhpOffice\PhpWord\Section\MemoryImage|null $memoryImage
|
||||
* @return int
|
||||
*/
|
||||
public static function addHeaderMediaElement($headerCount, $src, PHPWord_Section_MemoryImage $memoryImage = null)
|
||||
public static function addHeaderMediaElement($headerCount, $src, MemoryImage $memoryImage = null)
|
||||
{
|
||||
$mediaId = md5($src);
|
||||
$key = 'header' . $headerCount;
|
||||
|
|
@ -277,10 +278,10 @@ class PHPWord_Media
|
|||
*
|
||||
* @param int $footerCount
|
||||
* @param string $src
|
||||
* @param PHPWord_Section_MemoryImage|null $memoryImage
|
||||
* @param PhpOffice\PhpWord\Section\MemoryImage|null $memoryImage
|
||||
* @return int
|
||||
*/
|
||||
public static function addFooterMediaElement($footerCount, $src, PHPWord_Section_MemoryImage $memoryImage = null)
|
||||
public static function addFooterMediaElement($footerCount, $src, MemoryImage $memoryImage = null)
|
||||
{
|
||||
$mediaId = md5($src);
|
||||
$key = 'footer' . $footerCount;
|
||||
|
|
|
|||
|
|
@ -25,13 +25,12 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPWord_Reader_IReader
|
||||
*/
|
||||
interface PHPWord_Reader_IReader
|
||||
namespace PhpOffice\PhpWord\Reader;
|
||||
|
||||
interface IReader
|
||||
{
|
||||
/**
|
||||
* Can the current PHPWord_Reader_IReader read the file?
|
||||
* Can the current IReader read the file?
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @return boolean
|
||||
|
|
|
|||
|
|
@ -25,21 +25,22 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Reader;
|
||||
|
||||
use PhpOffice\PhpWord\DocumentProperties;
|
||||
use PhpOffice\PhpWord\Exceptions\Exception;
|
||||
use PhpOffice\PhpWord\Shared\File;
|
||||
|
||||
/** PHPWord root directory */
|
||||
if (!defined('PHPWORD_BASE_PATH')) {
|
||||
define('PHPWORD_BASE_PATH', dirname(__FILE__) . '/../../');
|
||||
require(PHPWORD_BASE_PATH . 'PHPWord/Autoloader.php');
|
||||
}
|
||||
|
||||
use PhpOffice\PhpWord\Exceptions\Exception;
|
||||
|
||||
/**
|
||||
* PHPWord_Reader_Word2007
|
||||
*/
|
||||
class PHPWord_Reader_Word2007 extends PHPWord_Reader_Abstract implements PHPWord_Reader_IReader
|
||||
class Word2007 extends AbstractReader implements IReader
|
||||
{
|
||||
/**
|
||||
* Can the current PHPWord_Reader_IReader read the file?
|
||||
* Can the current IReader read the file?
|
||||
*
|
||||
* @param string $pFilename
|
||||
* @return bool
|
||||
|
|
@ -90,7 +91,7 @@ class PHPWord_Reader_Word2007 extends PHPWord_Reader_Abstract implements PHPWord
|
|||
if (strpos($fileName, '//') !== false) {
|
||||
$fileName = substr($fileName, strpos($fileName, '//') + 1);
|
||||
}
|
||||
$fileName = PHPWord_Shared_File::realpath($fileName);
|
||||
$fileName = File::realpath($fileName);
|
||||
|
||||
// Apache POI fixes
|
||||
$contents = $archive->getFromName($fileName);
|
||||
|
|
@ -172,8 +173,8 @@ class PHPWord_Reader_Word2007 extends PHPWord_Reader_Abstract implements PHPWord
|
|||
$cellDataOfficeChildren = $xmlProperty->children("http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes");
|
||||
$attributeType = $cellDataOfficeChildren->getName();
|
||||
$attributeValue = (string)$cellDataOfficeChildren->{$attributeType};
|
||||
$attributeValue = PHPWord_DocumentProperties::convertProperty($attributeValue, $attributeType);
|
||||
$attributeType = PHPWord_DocumentProperties::convertPropertyType($attributeType);
|
||||
$attributeValue = DocumentProperties::convertProperty($attributeValue, $attributeType);
|
||||
$attributeType = DocumentProperties::convertPropertyType($attributeType);
|
||||
$docProps->setCustomProperty($propertyName, $attributeValue, $attributeType);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,12 +25,26 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
use PhpOffice\PhpWord\Exceptions\Exception;
|
||||
namespace PhpOffice\PhpWord;
|
||||
|
||||
/**
|
||||
* Class PHPWord_Section
|
||||
*/
|
||||
class PHPWord_Section
|
||||
use PhpOffice\PhpWord\Exceptions\Exception;
|
||||
use PhpOffice\PhpWord\Section\Footer;
|
||||
use PhpOffice\PhpWord\Section\Footnote;
|
||||
use PhpOffice\PhpWord\Section\Image;
|
||||
use PhpOffice\PhpWord\Section\Link;
|
||||
use PhpOffice\PhpWord\Section\ListItem;
|
||||
use PhpOffice\PhpWord\Section\MemoryImage;
|
||||
use PhpOffice\PhpWord\Section\Object;
|
||||
use PhpOffice\PhpWord\Section\PageBreak;
|
||||
use PhpOffice\PhpWord\Section\Settings;
|
||||
use PhpOffice\PhpWord\Section\Table;
|
||||
use PhpOffice\PhpWord\Section\Text;
|
||||
use PhpOffice\PhpWord\Section\TextBreak;
|
||||
use PhpOffice\PhpWord\Section\TextRun;
|
||||
use PhpOffice\PhpWord\Section\Title;
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
|
||||
class Section
|
||||
{
|
||||
/**
|
||||
* Section count
|
||||
|
|
@ -42,7 +56,7 @@ class PHPWord_Section
|
|||
/**
|
||||
* Section settings
|
||||
*
|
||||
* @var PHPWord_Section_Settings
|
||||
* @var PhpOffice\PhpWord\Section\Settings
|
||||
*/
|
||||
private $_settings;
|
||||
|
||||
|
|
@ -63,7 +77,7 @@ class PHPWord_Section
|
|||
/**
|
||||
* Section Footer
|
||||
*
|
||||
* @var PHPWord_Section_Footer
|
||||
* @var PhpOffice\PhpWord\Section\Footer
|
||||
*/
|
||||
private $_footer = null;
|
||||
|
||||
|
|
@ -77,7 +91,7 @@ class PHPWord_Section
|
|||
public function __construct($sectionCount, $settings = null)
|
||||
{
|
||||
$this->_sectionCount = $sectionCount;
|
||||
$this->_settings = new PHPWord_Section_Settings();
|
||||
$this->_settings = new Settings();
|
||||
$this->setSettings($settings);
|
||||
}
|
||||
|
||||
|
|
@ -101,7 +115,7 @@ class PHPWord_Section
|
|||
/**
|
||||
* Get Section Settings
|
||||
*
|
||||
* @return PHPWord_Section_Settings
|
||||
* @return PhpOffice\PhpWord\Section\Settings
|
||||
*/
|
||||
public function getSettings()
|
||||
{
|
||||
|
|
@ -114,14 +128,14 @@ class PHPWord_Section
|
|||
* @param string $text
|
||||
* @param mixed $styleFont
|
||||
* @param mixed $styleParagraph
|
||||
* @return PHPWord_Section_Text
|
||||
* @return PhpOffice\PhpWord\Section\Text
|
||||
*/
|
||||
public function addText($text, $styleFont = null, $styleParagraph = null)
|
||||
{
|
||||
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||
if (!String::IsUTF8($text)) {
|
||||
$text = utf8_encode($text);
|
||||
}
|
||||
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
|
||||
$text = new Text($text, $styleFont, $styleParagraph);
|
||||
$this->_elementCollection[] = $text;
|
||||
return $text;
|
||||
}
|
||||
|
|
@ -133,21 +147,21 @@ class PHPWord_Section
|
|||
* @param string $linkName
|
||||
* @param mixed $styleFont
|
||||
* @param mixed $styleParagraph
|
||||
* @return PHPWord_Section_Link
|
||||
* @return PhpOffice\PhpWord\Section\Link
|
||||
*/
|
||||
public function addLink($linkSrc, $linkName = null, $styleFont = null, $styleParagraph = null)
|
||||
{
|
||||
if (!PHPWord_Shared_String::IsUTF8($linkSrc)) {
|
||||
if (!String::IsUTF8($linkSrc)) {
|
||||
$linkSrc = utf8_encode($linkSrc);
|
||||
}
|
||||
if (!is_null($linkName)) {
|
||||
if (!PHPWord_Shared_String::IsUTF8($linkName)) {
|
||||
if (!String::IsUTF8($linkName)) {
|
||||
$linkName = utf8_encode($linkName);
|
||||
}
|
||||
}
|
||||
|
||||
$link = new PHPWord_Section_Link($linkSrc, $linkName, $styleFont, $styleParagraph);
|
||||
$rID = PHPWord_Media::addSectionLinkElement($linkSrc);
|
||||
$link = new Link($linkSrc, $linkName, $styleFont, $styleParagraph);
|
||||
$rID = Media::addSectionLinkElement($linkSrc);
|
||||
$link->setRelationId($rID);
|
||||
|
||||
$this->_elementCollection[] = $link;
|
||||
|
|
@ -157,14 +171,14 @@ class PHPWord_Section
|
|||
/**
|
||||
* Add a TextBreak Element
|
||||
*
|
||||
* @param int $count
|
||||
* @param null|string|array|PHPWord_Style_Font $fontStyle
|
||||
* @param null|string|array|PHPWord_Style_Paragraph $paragraphStyle
|
||||
* @param int $count
|
||||
* @param null|string|array|PhpOffice\PhpWord\Style\Font $fontStyle
|
||||
* @param null|string|array|PhpOffice\PhpWord\Style\Paragraph $paragraphStyle
|
||||
*/
|
||||
public function addTextBreak($count = 1, $fontStyle = null, $paragraphStyle = null)
|
||||
{
|
||||
for ($i = 1; $i <= $count; $i++) {
|
||||
$this->_elementCollection[] = new PHPWord_Section_TextBreak($fontStyle, $paragraphStyle);
|
||||
$this->_elementCollection[] = new TextBreak($fontStyle, $paragraphStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -173,18 +187,18 @@ class PHPWord_Section
|
|||
*/
|
||||
public function addPageBreak()
|
||||
{
|
||||
$this->_elementCollection[] = new PHPWord_Section_PageBreak();
|
||||
$this->_elementCollection[] = new PageBreak();
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Table Element
|
||||
*
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_Table
|
||||
* @return PhpOffice\PhpWord\Section\Table
|
||||
*/
|
||||
public function addTable($style = null)
|
||||
{
|
||||
$table = new PHPWord_Section_Table('section', $this->_sectionCount, $style);
|
||||
$table = new Table('section', $this->_sectionCount, $style);
|
||||
$this->_elementCollection[] = $table;
|
||||
return $table;
|
||||
}
|
||||
|
|
@ -197,14 +211,14 @@ class PHPWord_Section
|
|||
* @param mixed $styleFont
|
||||
* @param mixed $styleList
|
||||
* @param mixed $styleParagraph
|
||||
* @return PHPWord_Section_ListItem
|
||||
* @return PhpOffice\PhpWord\Section\ListItem
|
||||
*/
|
||||
public function addListItem($text, $depth = 0, $styleFont = null, $styleList = null, $styleParagraph = null)
|
||||
{
|
||||
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||
if (!String::IsUTF8($text)) {
|
||||
$text = utf8_encode($text);
|
||||
}
|
||||
$listItem = new PHPWord_Section_ListItem($text, $depth, $styleFont, $styleList, $styleParagraph);
|
||||
$listItem = new ListItem($text, $depth, $styleFont, $styleList, $styleParagraph);
|
||||
$this->_elementCollection[] = $listItem;
|
||||
return $listItem;
|
||||
}
|
||||
|
|
@ -214,12 +228,12 @@ class PHPWord_Section
|
|||
*
|
||||
* @param string $src
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_Object
|
||||
* @return PhpOffice\PhpWord\Section\Object
|
||||
* @throws Exception
|
||||
*/
|
||||
public function addObject($src, $style = null)
|
||||
{
|
||||
$object = new PHPWord_Section_Object($src, $style);
|
||||
$object = new Object($src, $style);
|
||||
|
||||
if (!is_null($object->getSource())) {
|
||||
$inf = pathinfo($src);
|
||||
|
|
@ -235,8 +249,8 @@ class PHPWord_Section
|
|||
$iconSrc .= '_' . $ext . '.png';
|
||||
}
|
||||
|
||||
$rIDimg = PHPWord_Media::addSectionMediaElement($iconSrc, 'image');
|
||||
$data = PHPWord_Media::addSectionMediaElement($src, 'oleObject');
|
||||
$rIDimg = Media::addSectionMediaElement($iconSrc, 'image');
|
||||
$data = Media::addSectionMediaElement($src, 'oleObject');
|
||||
$rID = $data[0];
|
||||
$objectId = $data[1];
|
||||
|
||||
|
|
@ -255,15 +269,15 @@ class PHPWord_Section
|
|||
*
|
||||
* @param string $src
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_Image
|
||||
* @return PhpOffice\PhpWord\Section\Image
|
||||
* @throws Exception
|
||||
*/
|
||||
public function addImage($src, $style = null)
|
||||
{
|
||||
$image = new PHPWord_Section_Image($src, $style);
|
||||
$image = new Image($src, $style);
|
||||
|
||||
if (!is_null($image->getSource())) {
|
||||
$rID = PHPWord_Media::addSectionMediaElement($src, 'image');
|
||||
$rID = Media::addSectionMediaElement($src, 'image');
|
||||
$image->setRelationId($rID);
|
||||
|
||||
$this->_elementCollection[] = $image;
|
||||
|
|
@ -277,14 +291,14 @@ class PHPWord_Section
|
|||
*
|
||||
* @param string $link
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_MemoryImage
|
||||
* @return PhpOffice\PhpWord\Section\MemoryImage
|
||||
* @throws Exception
|
||||
*/
|
||||
public function addMemoryImage($link, $style = null)
|
||||
{
|
||||
$memoryImage = new PHPWord_Section_MemoryImage($link, $style);
|
||||
$memoryImage = new MemoryImage($link, $style);
|
||||
if (!is_null($memoryImage->getSource())) {
|
||||
$rID = PHPWord_Media::addSectionMediaElement($link, 'image', $memoryImage);
|
||||
$rID = Media::addSectionMediaElement($link, 'image', $memoryImage);
|
||||
$memoryImage->setRelationId($rID);
|
||||
|
||||
$this->_elementCollection[] = $memoryImage;
|
||||
|
|
@ -298,11 +312,11 @@ class PHPWord_Section
|
|||
*
|
||||
* @param mixed $styleFont
|
||||
* @param mixed $styleTOC
|
||||
* @return PHPWord_TOC
|
||||
* @return PhpOffice\PhpWord\TOC
|
||||
*/
|
||||
public function addTOC($styleFont = null, $styleTOC = null)
|
||||
{
|
||||
$toc = new PHPWord_TOC($styleFont, $styleTOC);
|
||||
$toc = new TOC($styleFont, $styleTOC);
|
||||
$this->_elementCollection[] = $toc;
|
||||
return $toc;
|
||||
}
|
||||
|
|
@ -312,23 +326,23 @@ class PHPWord_Section
|
|||
*
|
||||
* @param string $text
|
||||
* @param int $depth
|
||||
* @return PHPWord_Section_Title
|
||||
* @return PhpOffice\PhpWord\Section\Title
|
||||
*/
|
||||
public function addTitle($text, $depth = 1)
|
||||
{
|
||||
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||
if (!String::IsUTF8($text)) {
|
||||
$text = utf8_encode($text);
|
||||
}
|
||||
$styles = PHPWord_Style::getStyles();
|
||||
$styles = Style::getStyles();
|
||||
if (array_key_exists('Heading_' . $depth, $styles)) {
|
||||
$style = 'Heading' . $depth;
|
||||
} else {
|
||||
$style = null;
|
||||
}
|
||||
|
||||
$title = new PHPWord_Section_Title($text, $depth, $style);
|
||||
$title = new Title($text, $depth, $style);
|
||||
|
||||
$data = PHPWord_TOC::addTitle($text, $depth);
|
||||
$data = TOC::addTitle($text, $depth);
|
||||
$anchor = $data[0];
|
||||
$bookmarkId = $data[1];
|
||||
|
||||
|
|
@ -343,11 +357,11 @@ class PHPWord_Section
|
|||
* Create a new TextRun
|
||||
*
|
||||
* @param mixed $styleParagraph
|
||||
* @return PHPWord_Section_TextRun
|
||||
* @return PhpOffice\PhpWord\Section\TextRun
|
||||
*/
|
||||
public function createTextRun($styleParagraph = null)
|
||||
{
|
||||
$textRun = new PHPWord_Section_TextRun($styleParagraph);
|
||||
$textRun = new TextRun($styleParagraph);
|
||||
$this->_elementCollection[] = $textRun;
|
||||
return $textRun;
|
||||
}
|
||||
|
|
@ -365,11 +379,11 @@ class PHPWord_Section
|
|||
/**
|
||||
* Create a new Header
|
||||
*
|
||||
* @return PHPWord_Section_Header
|
||||
* @return PhpOffice\PhpWord\Section\Header
|
||||
*/
|
||||
public function createHeader()
|
||||
{
|
||||
$header = new PHPWord_Section_Header($this->_sectionCount);
|
||||
$header = new Header($this->_sectionCount);
|
||||
$this->_headers[] = $header;
|
||||
return $header;
|
||||
}
|
||||
|
|
@ -387,16 +401,15 @@ class PHPWord_Section
|
|||
/**
|
||||
* Is there a header for this section that is for the first page only?
|
||||
*
|
||||
* If any of the PHPWord_Section_Header instances have a type of
|
||||
* PHPWord_Section_Header::FIRST then this method returns true. False
|
||||
* otherwise.
|
||||
* If any of the Header instances have a type of Header::FIRST then this method returns true.
|
||||
* False otherwise.
|
||||
*
|
||||
* @return Boolean
|
||||
*/
|
||||
public function hasDifferentFirstPage()
|
||||
{
|
||||
$value = array_filter($this->_headers, function (PHPWord_Section_Header &$header) {
|
||||
return $header->getType() == PHPWord_Section_Header::FIRST;
|
||||
$value = array_filter($this->_headers, function (Header &$header) {
|
||||
return $header->getType() == Header::FIRST;
|
||||
});
|
||||
return count($value) > 0;
|
||||
}
|
||||
|
|
@ -404,11 +417,11 @@ class PHPWord_Section
|
|||
/**
|
||||
* Create a new Footer
|
||||
*
|
||||
* @return PHPWord_Section_Footer
|
||||
* @return PhpOffice\PhpWord\Section\Footer
|
||||
*/
|
||||
public function createFooter()
|
||||
{
|
||||
$footer = new PHPWord_Section_Footer($this->_sectionCount);
|
||||
$footer = new Footer($this->_sectionCount);
|
||||
$this->_footer = $footer;
|
||||
return $footer;
|
||||
}
|
||||
|
|
@ -416,7 +429,7 @@ class PHPWord_Section
|
|||
/**
|
||||
* Get Footer
|
||||
*
|
||||
* @return PHPWord_Section_Footer
|
||||
* @return PhpOffice\PhpWord\Section\Footer
|
||||
*/
|
||||
public function getFooter()
|
||||
{
|
||||
|
|
@ -427,12 +440,12 @@ class PHPWord_Section
|
|||
* Create a new Footnote Element
|
||||
*
|
||||
* @param mixed $styleParagraph
|
||||
* @return PHPWord_Section_Footnote
|
||||
* @return PhpOffice\PhpWord\Section\Footnote
|
||||
*/
|
||||
public function createFootnote($styleParagraph = null)
|
||||
{
|
||||
$footnote = new PHPWord_Section_Footnote($styleParagraph);
|
||||
$refID = PHPWord_Footnote::addFootnoteElement($footnote);
|
||||
$footnote = new Footnote($styleParagraph);
|
||||
$refID = Footnote::addFootnoteElement($footnote);
|
||||
$footnote->setReferenceId($refID);
|
||||
$this->_elementCollection[] = $footnote;
|
||||
return $footnote;
|
||||
|
|
|
|||
|
|
@ -25,12 +25,14 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPWord_Section_Footer
|
||||
*/
|
||||
class PHPWord_Section_Footer
|
||||
{
|
||||
namespace PhpOffice\PhpWord\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Media;
|
||||
use PhpOffice\PhpWord\Section\Footer\PreserveText;
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
|
||||
class Footer
|
||||
{
|
||||
/**
|
||||
* Footer Count
|
||||
*
|
||||
|
|
@ -66,14 +68,14 @@ class PHPWord_Section_Footer
|
|||
* @param string $text
|
||||
* @param mixed $styleFont
|
||||
* @param mixed $styleParagraph
|
||||
* @return PHPWord_Section_Text
|
||||
* @return PhpOffice\PhpWord\Section\Text
|
||||
*/
|
||||
public function addText($text, $styleFont = null, $styleParagraph = null)
|
||||
{
|
||||
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||
if (!String::IsUTF8($text)) {
|
||||
$text = utf8_encode($text);
|
||||
}
|
||||
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
|
||||
$text = new Text($text, $styleFont, $styleParagraph);
|
||||
$this->_elementCollection[] = $text;
|
||||
return $text;
|
||||
}
|
||||
|
|
@ -81,25 +83,25 @@ class PHPWord_Section_Footer
|
|||
/**
|
||||
* Add TextBreak
|
||||
*
|
||||
* @param int $count
|
||||
* @param null|string|array|PHPWord_Style_Font $fontStyle
|
||||
* @param null|string|array|PHPWord_Style_Paragraph $paragraphStyle
|
||||
* @param int $count
|
||||
* @param null|string|array|PhpOffice\PhpWord\Style\Font $fontStyle
|
||||
* @param null|string|array|PhpOffice\PhpWord\Style\Paragraph $paragraphStyle
|
||||
*/
|
||||
public function addTextBreak($count = 1, $fontStyle = null, $paragraphStyle = null)
|
||||
{
|
||||
for ($i = 1; $i <= $count; $i++) {
|
||||
$this->_elementCollection[] = new PHPWord_Section_TextBreak($fontStyle, $paragraphStyle);
|
||||
$this->_elementCollection[] = new TextBreak($fontStyle, $paragraphStyle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new TextRun
|
||||
*
|
||||
* @return PHPWord_Section_TextRun
|
||||
* @return PhpOffice\PhpWord\Section\TextRun
|
||||
*/
|
||||
public function createTextRun($styleParagraph = null)
|
||||
{
|
||||
$textRun = new PHPWord_Section_TextRun($styleParagraph);
|
||||
$textRun = new TextRun($styleParagraph);
|
||||
$this->_elementCollection[] = $textRun;
|
||||
return $textRun;
|
||||
}
|
||||
|
|
@ -108,11 +110,11 @@ class PHPWord_Section_Footer
|
|||
* Add a Table Element
|
||||
*
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_Table
|
||||
* @return PhpOffice\PhpWord\Section\Table
|
||||
*/
|
||||
public function addTable($style = null)
|
||||
{
|
||||
$table = new PHPWord_Section_Table('footer', $this->_footerCount, $style);
|
||||
$table = new Table('footer', $this->_footerCount, $style);
|
||||
$this->_elementCollection[] = $table;
|
||||
return $table;
|
||||
}
|
||||
|
|
@ -122,14 +124,14 @@ class PHPWord_Section_Footer
|
|||
*
|
||||
* @param string $src
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_Image
|
||||
* @return Image
|
||||
*/
|
||||
public function addImage($src, $style = null)
|
||||
{
|
||||
$image = new PHPWord_Section_Image($src, $style);
|
||||
$image = new Image($src, $style);
|
||||
|
||||
if (!is_null($image->getSource())) {
|
||||
$rID = PHPWord_Media::addFooterMediaElement($this->_footerCount, $src);
|
||||
$rID = Media::addFooterMediaElement($this->_footerCount, $src);
|
||||
$image->setRelationId($rID);
|
||||
|
||||
$this->_elementCollection[] = $image;
|
||||
|
|
@ -144,13 +146,13 @@ class PHPWord_Section_Footer
|
|||
*
|
||||
* @param string $link
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_MemoryImage
|
||||
* @return PhpOffice\PhpWord\Section\MemoryImage
|
||||
*/
|
||||
public function addMemoryImage($link, $style = null)
|
||||
{
|
||||
$memoryImage = new PHPWord_Section_MemoryImage($link, $style);
|
||||
$memoryImage = new MemoryImage($link, $style);
|
||||
if (!is_null($memoryImage->getSource())) {
|
||||
$rID = PHPWord_Media::addFooterMediaElement($this->_footerCount, $link, $memoryImage);
|
||||
$rID = Media::addFooterMediaElement($this->_footerCount, $link, $memoryImage);
|
||||
$memoryImage->setRelationId($rID);
|
||||
|
||||
$this->_elementCollection[] = $memoryImage;
|
||||
|
|
@ -166,14 +168,14 @@ class PHPWord_Section_Footer
|
|||
* @param string $text
|
||||
* @param mixed $styleFont
|
||||
* @param mixed $styleParagraph
|
||||
* @return PHPWord_Section_Footer_PreserveText
|
||||
* @return PhpOffice\PhpWord\Section\Footer\PreserveText
|
||||
*/
|
||||
public function addPreserveText($text, $styleFont = null, $styleParagraph = null)
|
||||
{
|
||||
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||
if (!String::IsUTF8($text)) {
|
||||
$text = utf8_encode($text);
|
||||
}
|
||||
$ptext = new PHPWord_Section_Footer_PreserveText($text, $styleFont, $styleParagraph);
|
||||
$ptext = new PreserveText($text, $styleFont, $styleParagraph);
|
||||
$this->_elementCollection[] = $ptext;
|
||||
return $ptext;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,12 +25,13 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_Section_Footer_PreserveText
|
||||
*/
|
||||
class PHPWord_Section_Footer_PreserveText
|
||||
{
|
||||
namespace PhpOffice\PhpWord\Section\Footer;
|
||||
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
use PhpOffice\PhpWord\Style\Paragraph;
|
||||
|
||||
class PreserveText
|
||||
{
|
||||
/**
|
||||
* Text content
|
||||
*
|
||||
|
|
@ -41,14 +42,14 @@ class PHPWord_Section_Footer_PreserveText
|
|||
/**
|
||||
* Text style
|
||||
*
|
||||
* @var PHPWord_Style_Font
|
||||
* @var PhpOffice\PhpWord\Style\Font
|
||||
*/
|
||||
private $_styleFont;
|
||||
|
||||
/**
|
||||
* Paragraph style
|
||||
*
|
||||
* @var PHPWord_Style_Font
|
||||
* @var PhpOffice\PhpWord\Style\Paragraph
|
||||
*/
|
||||
private $_styleParagraph;
|
||||
|
||||
|
|
@ -63,7 +64,7 @@ class PHPWord_Section_Footer_PreserveText
|
|||
{
|
||||
// Set font style
|
||||
if (is_array($styleFont)) {
|
||||
$this->_styleFont = new PHPWord_Style_Font('text');
|
||||
$this->_styleFont = new Font('text');
|
||||
|
||||
foreach ($styleFont as $key => $value) {
|
||||
if (substr($key, 0, 1) != '_') {
|
||||
|
|
@ -77,7 +78,7 @@ class PHPWord_Section_Footer_PreserveText
|
|||
|
||||
// Set paragraph style
|
||||
if (is_array($styleParagraph)) {
|
||||
$this->_styleParagraph = new PHPWord_Style_Paragraph();
|
||||
$this->_styleParagraph = new Paragraph();
|
||||
|
||||
foreach ($styleParagraph as $key => $value) {
|
||||
if (substr($key, 0, 1) != '_') {
|
||||
|
|
@ -100,7 +101,7 @@ class PHPWord_Section_Footer_PreserveText
|
|||
/**
|
||||
* Get Text style
|
||||
*
|
||||
* @return PHPWord_Style_Font
|
||||
* @return PhpOffice\PhpWord\Style\Font
|
||||
*/
|
||||
public function getFontStyle()
|
||||
{
|
||||
|
|
@ -110,7 +111,7 @@ class PHPWord_Section_Footer_PreserveText
|
|||
/**
|
||||
* Get Paragraph style
|
||||
*
|
||||
* @return PHPWord_Style_Paragraph
|
||||
* @return PhpOffice\PhpWord\Style\Paragraph
|
||||
*/
|
||||
public function getParagraphStyle()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,16 +25,16 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPWord_Section_Footnote
|
||||
*/
|
||||
class PHPWord_Section_Footnote
|
||||
{
|
||||
namespace PhpOffice\PhpWord\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Style\Paragraph;
|
||||
|
||||
class Footnote
|
||||
{
|
||||
/**
|
||||
* Paragraph style
|
||||
*
|
||||
* @var PHPWord_Style_Font
|
||||
* @var PhpOffice\PhpWord\Style\Paragraph
|
||||
*/
|
||||
private $_styleParagraph;
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ class PHPWord_Section_Footnote
|
|||
|
||||
// Set paragraph style
|
||||
if (is_array($styleParagraph)) {
|
||||
$this->_styleParagraph = new PHPWord_Style_Paragraph();
|
||||
$this->_styleParagraph = new Paragraph();
|
||||
|
||||
foreach ($styleParagraph as $key => $value) {
|
||||
if (substr($key, 0, 1) != '_') {
|
||||
|
|
@ -80,12 +80,12 @@ class PHPWord_Section_Footnote
|
|||
*
|
||||
* @var string $text
|
||||
* @var mixed $styleFont
|
||||
* @return PHPWord_Section_Text
|
||||
* @return PhpOffice\PhpWord\Section\Text
|
||||
*/
|
||||
public function addText($text = null, $styleFont = null)
|
||||
{
|
||||
$givenText = $text;
|
||||
$text = new PHPWord_Section_Text($givenText, $styleFont);
|
||||
$text = new Text($givenText, $styleFont);
|
||||
$this->_elementCollection[] = $text;
|
||||
return $text;
|
||||
}
|
||||
|
|
@ -96,13 +96,13 @@ class PHPWord_Section_Footnote
|
|||
* @param string $linkSrc
|
||||
* @param string $linkName
|
||||
* @param mixed $styleFont
|
||||
* @return PHPWord_Section_Link
|
||||
* @return PhpOffice\PhpWord\Section\Link
|
||||
*/
|
||||
public function addLink($linkSrc, $linkName = null, $styleFont = null)
|
||||
{
|
||||
|
||||
$link = new PHPWord_Section_Link($linkSrc, $linkName, $styleFont);
|
||||
$rID = PHPWord_Footnote::addFootnoteLinkElement($linkSrc);
|
||||
$link = new Link($linkSrc, $linkName, $styleFont);
|
||||
$rID = PhpOffice\PhpWord\Footnote::addFootnoteLinkElement($linkSrc);
|
||||
$link->setRelationId($rID);
|
||||
|
||||
$this->_elementCollection[] = $link;
|
||||
|
|
@ -122,7 +122,7 @@ class PHPWord_Section_Footnote
|
|||
/**
|
||||
* Get Paragraph style
|
||||
*
|
||||
* @return PHPWord_Style_Paragraph
|
||||
* @return PhpOffice\PhpWord\Style\Paragraph
|
||||
*/
|
||||
public function getParagraphStyle()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,12 +25,14 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPWord_Section_Header
|
||||
*/
|
||||
class PHPWord_Section_Header
|
||||
{
|
||||
namespace PhpOffice\PhpWord\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Media;
|
||||
use PhpOffice\PhpWord\Section\Footer\PreserveText;
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
|
||||
class Header
|
||||
{
|
||||
/**
|
||||
* Header Count
|
||||
*
|
||||
|
|
@ -51,7 +53,7 @@ class PHPWord_Section_Header
|
|||
* @var string
|
||||
* @link http://www.schemacentral.com/sc/ooxml/a-w_type-4.html Header or Footer Type
|
||||
*/
|
||||
private $_type = PHPWord_Section_Header::AUTO;
|
||||
private $_type = self::AUTO;
|
||||
|
||||
/**
|
||||
* Even Numbered Pages Only
|
||||
|
|
@ -95,14 +97,14 @@ class PHPWord_Section_Header
|
|||
* @param string $text
|
||||
* @param mixed $styleFont
|
||||
* @param mixed $styleParagraph
|
||||
* @return PHPWord_Section_Text
|
||||
* @return PhpOffice\PhpWord\Section\Text
|
||||
*/
|
||||
public function addText($text, $styleFont = null, $styleParagraph = null)
|
||||
{
|
||||
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||
if (!String::IsUTF8($text)) {
|
||||
$text = utf8_encode($text);
|
||||
}
|
||||
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
|
||||
$text = new Text($text, $styleFont, $styleParagraph);
|
||||
$this->_elementCollection[] = $text;
|
||||
return $text;
|
||||
}
|
||||
|
|
@ -110,25 +112,25 @@ class PHPWord_Section_Header
|
|||
/**
|
||||
* Add TextBreak
|
||||
*
|
||||
* @param int $count
|
||||
* @param null|string|array|PHPWord_Style_Font $fontStyle
|
||||
* @param null|string|array|PHPWord_Style_Paragraph $paragraphStyle
|
||||
* @param int $count
|
||||
* @param null|string|array|PhpOffice\PhpWord\Style\Font $fontStyle
|
||||
* @param null|string|array|PhpOffice\PhpWord\Style\Paragraph $paragraphStyle
|
||||
*/
|
||||
public function addTextBreak($count = 1, $fontStyle = null, $paragraphStyle = null)
|
||||
{
|
||||
for ($i = 1; $i <= $count; $i++) {
|
||||
$this->_elementCollection[] = new PHPWord_Section_TextBreak($fontStyle, $paragraphStyle);
|
||||
$this->_elementCollection[] = new TextBreak($fontStyle, $paragraphStyle);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new TextRun
|
||||
*
|
||||
* @return PHPWord_Section_TextRun
|
||||
* @return PhpOffice\PhpWord\Section\TextRun
|
||||
*/
|
||||
public function createTextRun($styleParagraph = null)
|
||||
{
|
||||
$textRun = new PHPWord_Section_TextRun($styleParagraph);
|
||||
$textRun = new TextRun($styleParagraph);
|
||||
$this->_elementCollection[] = $textRun;
|
||||
return $textRun;
|
||||
}
|
||||
|
|
@ -137,11 +139,11 @@ class PHPWord_Section_Header
|
|||
* Add a Table Element
|
||||
*
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_Table
|
||||
* @return PhpOffice\PhpWord\Section\Table
|
||||
*/
|
||||
public function addTable($style = null)
|
||||
{
|
||||
$table = new PHPWord_Section_Table('header', $this->_headerCount, $style);
|
||||
$table = new Table('header', $this->_headerCount, $style);
|
||||
$this->_elementCollection[] = $table;
|
||||
return $table;
|
||||
}
|
||||
|
|
@ -151,14 +153,14 @@ class PHPWord_Section_Header
|
|||
*
|
||||
* @param string $src
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_Image
|
||||
* @return PhpOffice\PhpWord\Section\Image
|
||||
*/
|
||||
public function addImage($src, $style = null)
|
||||
{
|
||||
$image = new PHPWord_Section_Image($src, $style);
|
||||
$image = new Image($src, $style);
|
||||
|
||||
if (!is_null($image->getSource())) {
|
||||
$rID = PHPWord_Media::addHeaderMediaElement($this->_headerCount, $src);
|
||||
$rID = Media::addHeaderMediaElement($this->_headerCount, $src);
|
||||
$image->setRelationId($rID);
|
||||
|
||||
$this->_elementCollection[] = $image;
|
||||
|
|
@ -173,13 +175,13 @@ class PHPWord_Section_Header
|
|||
*
|
||||
* @param string $link
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_MemoryImage
|
||||
* @return PhpOffice\PhpWord\Section\MemoryImage
|
||||
*/
|
||||
public function addMemoryImage($link, $style = null)
|
||||
{
|
||||
$memoryImage = new PHPWord_Section_MemoryImage($link, $style);
|
||||
$memoryImage = new MemoryImage($link, $style);
|
||||
if (!is_null($memoryImage->getSource())) {
|
||||
$rID = PHPWord_Media::addHeaderMediaElement($this->_headerCount, $link, $memoryImage);
|
||||
$rID = Media::addHeaderMediaElement($this->_headerCount, $link, $memoryImage);
|
||||
$memoryImage->setRelationId($rID);
|
||||
|
||||
$this->_elementCollection[] = $memoryImage;
|
||||
|
|
@ -195,14 +197,14 @@ class PHPWord_Section_Header
|
|||
* @param string $text
|
||||
* @param mixed $styleFont
|
||||
* @param mixed $styleParagraph
|
||||
* @return PHPWord_Section_Footer_PreserveText
|
||||
* @return PhpOffice\PhpWord\Section\Footer\PreserveText
|
||||
*/
|
||||
public function addPreserveText($text, $styleFont = null, $styleParagraph = null)
|
||||
{
|
||||
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||
if (!String::IsUTF8($text)) {
|
||||
$text = utf8_encode($text);
|
||||
}
|
||||
$ptext = new PHPWord_Section_Footer_PreserveText($text, $styleFont, $styleParagraph);
|
||||
$ptext = new PreserveText($text, $styleFont, $styleParagraph);
|
||||
$this->_elementCollection[] = $ptext;
|
||||
return $ptext;
|
||||
}
|
||||
|
|
@ -212,14 +214,14 @@ class PHPWord_Section_Header
|
|||
*
|
||||
* @param string $src
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_Image
|
||||
* @return PhpOffice\PhpWord\Section\Image
|
||||
*/
|
||||
public function addWatermark($src, $style = null)
|
||||
{
|
||||
$image = new PHPWord_Section_Image($src, $style, true);
|
||||
$image = new Image($src, $style, true);
|
||||
|
||||
if (!is_null($image->getSource())) {
|
||||
$rID = PHPWord_Media::addHeaderMediaElement($this->_headerCount, $src);
|
||||
$rID = Media::addHeaderMediaElement($this->_headerCount, $src);
|
||||
$image->setRelationId($rID);
|
||||
|
||||
$this->_elementCollection[] = $image;
|
||||
|
|
@ -276,7 +278,7 @@ class PHPWord_Section_Header
|
|||
*/
|
||||
public function resetType()
|
||||
{
|
||||
return $this->_type = PHPWord_Section_Header::AUTO;
|
||||
return $this->_type = self::AUTO;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -284,7 +286,7 @@ class PHPWord_Section_Header
|
|||
*/
|
||||
public function firstPage()
|
||||
{
|
||||
return $this->_type = PHPWord_Section_Header::FIRST;
|
||||
return $this->_type = self::FIRST;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -292,6 +294,6 @@ class PHPWord_Section_Header
|
|||
*/
|
||||
public function evenPage()
|
||||
{
|
||||
return $this->_type = PHPWord_Section_Header::EVEN;
|
||||
return $this->_type = self::EVEN;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,13 +25,12 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Exceptions\InvalidImageException;
|
||||
use PhpOffice\PhpWord\Exceptions\UnsupportedImageTypeException;
|
||||
|
||||
/**
|
||||
* Class PHPWord_Section_Image
|
||||
*/
|
||||
class PHPWord_Section_Image
|
||||
class Image
|
||||
{
|
||||
/**
|
||||
* Image Src
|
||||
|
|
@ -43,7 +42,7 @@ class PHPWord_Section_Image
|
|||
/**
|
||||
* Image Style
|
||||
*
|
||||
* @var PHPWord_Style_Image
|
||||
* @var PhpOffice\PhpWord\Style\Image
|
||||
*/
|
||||
private $_style;
|
||||
|
||||
|
|
@ -84,7 +83,7 @@ class PHPWord_Section_Image
|
|||
|
||||
$this->_src = $src;
|
||||
$this->_isWatermark = $isWatermark;
|
||||
$this->_style = new PHPWord_Style_Image();
|
||||
$this->_style = new PhpOffice\PhpWord\Style\Image();
|
||||
|
||||
if (!is_null($style) && is_array($style)) {
|
||||
foreach ($style as $key => $value) {
|
||||
|
|
@ -109,7 +108,7 @@ class PHPWord_Section_Image
|
|||
/**
|
||||
* Get Image style
|
||||
*
|
||||
* @return PHPWord_Style_Image
|
||||
* @return PhpOffice\PhpWord\Style\Image
|
||||
*/
|
||||
public function getStyle()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,12 +25,13 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_Section_Link
|
||||
*/
|
||||
class PHPWord_Section_Link
|
||||
{
|
||||
namespace PhpOffice\PhpWord\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
use PhpOffice\PhpWord\Style\Paragraph;
|
||||
|
||||
class Link
|
||||
{
|
||||
/**
|
||||
* Link source
|
||||
*
|
||||
|
|
@ -55,14 +56,14 @@ class PHPWord_Section_Link
|
|||
/**
|
||||
* Link style
|
||||
*
|
||||
* @var PHPWord_Style_Font
|
||||
* @var PhpOffice\PhpWord\Style\Font
|
||||
*/
|
||||
private $_styleFont;
|
||||
|
||||
/**
|
||||
* Paragraph style
|
||||
*
|
||||
* @var PHPWord_Style_Font
|
||||
* @var PhpOffice\PhpWord\Style\Paragraph
|
||||
*/
|
||||
private $_styleParagraph;
|
||||
|
||||
|
|
@ -82,7 +83,7 @@ class PHPWord_Section_Link
|
|||
|
||||
// Set font style
|
||||
if (is_array($styleFont)) {
|
||||
$this->_styleFont = new PHPWord_Style_Font('text');
|
||||
$this->_styleFont = new Font('text');
|
||||
|
||||
foreach ($styleFont as $key => $value) {
|
||||
if (substr($key, 0, 1) != '_') {
|
||||
|
|
@ -96,7 +97,7 @@ class PHPWord_Section_Link
|
|||
|
||||
// Set paragraph style
|
||||
if (is_array($styleParagraph)) {
|
||||
$this->_styleParagraph = new PHPWord_Style_Paragraph();
|
||||
$this->_styleParagraph = new Paragraph();
|
||||
|
||||
foreach ($styleParagraph as $key => $value) {
|
||||
if (substr($key, 0, 1) != '_') {
|
||||
|
|
@ -154,7 +155,7 @@ class PHPWord_Section_Link
|
|||
/**
|
||||
* Get Text style
|
||||
*
|
||||
* @return PHPWord_Style_Font
|
||||
* @return PhpOffice\PhpWord\Style\Font
|
||||
*/
|
||||
public function getFontStyle()
|
||||
{
|
||||
|
|
@ -164,7 +165,7 @@ class PHPWord_Section_Link
|
|||
/**
|
||||
* Get Paragraph style
|
||||
*
|
||||
* @return PHPWord_Style_Paragraph
|
||||
* @return PhpOffice\PhpWord\Style\Paragraph
|
||||
*/
|
||||
public function getParagraphStyle()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,23 +25,21 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_Section_ListItem
|
||||
*/
|
||||
class PHPWord_Section_ListItem
|
||||
{
|
||||
namespace PhpOffice\PhpWord\Section;
|
||||
|
||||
class ListItem
|
||||
{
|
||||
/**
|
||||
* ListItem Style
|
||||
*
|
||||
* @var PHPWord_Style_ListItem
|
||||
* @var PhpOffice\PhpWord\Style\ListItem
|
||||
*/
|
||||
private $_style;
|
||||
|
||||
/**
|
||||
* Textrun
|
||||
*
|
||||
* @var PHPWord_Section_Text
|
||||
* @var PhpOffice\PhpWord\Section\Text
|
||||
*/
|
||||
private $_textObject;
|
||||
|
||||
|
|
@ -63,8 +61,8 @@ class PHPWord_Section_ListItem
|
|||
*/
|
||||
public function __construct($text, $depth = 0, $styleFont = null, $styleList = null, $styleParagraph = null)
|
||||
{
|
||||
$this->_style = new PHPWord_Style_ListItem();
|
||||
$this->_textObject = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
|
||||
$this->_style = new PhpOffice\PhpWord\Style\ListItem();
|
||||
$this->_textObject = new Text($text, $styleFont, $styleParagraph);
|
||||
$this->_depth = $depth;
|
||||
|
||||
if (!is_null($styleList) && is_array($styleList)) {
|
||||
|
|
|
|||
|
|
@ -25,10 +25,11 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_Section_MemoryImage
|
||||
*/
|
||||
class PHPWord_Section_MemoryImage
|
||||
namespace PhpOffice\PhpWord\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Style\Image;
|
||||
|
||||
class MemoryImage
|
||||
{
|
||||
/**
|
||||
* Image Src
|
||||
|
|
@ -40,7 +41,7 @@ class PHPWord_Section_MemoryImage
|
|||
/**
|
||||
* Image Style
|
||||
*
|
||||
* @var PHPWord_Style_Image
|
||||
* @var PhpOffice\PhpWord\Style\Image
|
||||
*/
|
||||
private $_style;
|
||||
|
||||
|
|
@ -95,7 +96,7 @@ class PHPWord_Section_MemoryImage
|
|||
|
||||
if (in_array($this->_imageType, $_supportedImageTypes)) {
|
||||
$this->_src = $src;
|
||||
$this->_style = new PHPWord_Style_Image();
|
||||
$this->_style = new Image();
|
||||
|
||||
if (!is_null($style) && is_array($style)) {
|
||||
foreach ($style as $key => $value) {
|
||||
|
|
@ -143,7 +144,7 @@ class PHPWord_Section_MemoryImage
|
|||
/**
|
||||
* Get Image style
|
||||
*
|
||||
* @return PHPWord_Style_Image
|
||||
* @return PhpOffice\PhpWord\Style\Image
|
||||
*/
|
||||
public function getStyle()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_Section_Object
|
||||
*/
|
||||
class PHPWord_Section_Object
|
||||
{
|
||||
namespace PhpOffice\PhpWord\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Style\Image;
|
||||
|
||||
class Object
|
||||
{
|
||||
/**
|
||||
* Ole-Object Src
|
||||
*
|
||||
|
|
@ -41,7 +41,7 @@ class PHPWord_Section_Object
|
|||
/**
|
||||
* Image Style
|
||||
*
|
||||
* @var PHPWord_Style_Image
|
||||
* @var PhpOffice\PhpWord\Style\Image
|
||||
*/
|
||||
private $_style;
|
||||
|
||||
|
|
@ -80,7 +80,7 @@ class PHPWord_Section_Object
|
|||
|
||||
if (file_exists($src) && in_array($inf['extension'], $_supportedObjectTypes)) {
|
||||
$this->_src = $src;
|
||||
$this->_style = new PHPWord_Style_Image();
|
||||
$this->_style = new Image();
|
||||
|
||||
if (!is_null($style) && is_array($style)) {
|
||||
foreach ($style as $key => $value) {
|
||||
|
|
@ -100,7 +100,7 @@ class PHPWord_Section_Object
|
|||
/**
|
||||
* Get Image style
|
||||
*
|
||||
* @return PHPWord_Style_Image
|
||||
* @return PhpOffice\PhpWord\Style\Image
|
||||
*/
|
||||
public function getStyle()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,16 +25,14 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_Section_PageBreak
|
||||
*/
|
||||
class PHPWord_Section_PageBreak
|
||||
{
|
||||
namespace PhpOffice\PhpWord\Section;
|
||||
|
||||
class PageBreak
|
||||
{
|
||||
/**
|
||||
* Create a new PageBreak Element
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -25,12 +25,10 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_Section_Settings
|
||||
*/
|
||||
class PHPWord_Section_Settings
|
||||
{
|
||||
namespace PhpOffice\PhpWord\Section;
|
||||
|
||||
class Settings
|
||||
{
|
||||
/**
|
||||
* Default Page Size Width
|
||||
*
|
||||
|
|
|
|||
|
|
@ -25,16 +25,16 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_Section_Table
|
||||
*/
|
||||
class PHPWord_Section_Table
|
||||
{
|
||||
namespace PhpOffice\PhpWord\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Section\Table\Row;
|
||||
|
||||
class Table
|
||||
{
|
||||
/**
|
||||
* Table style
|
||||
*
|
||||
* @var PHPWord_Style_Table
|
||||
* @var PhpOffice\PhpWord\Style\Table
|
||||
*/
|
||||
private $_style;
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ class PHPWord_Section_Table
|
|||
|
||||
if (!is_null($style)) {
|
||||
if (is_array($style)) {
|
||||
$this->_style = new PHPWord_Style_Table();
|
||||
$this->_style = new PhpOffice\PhpWord\Style\Table();
|
||||
|
||||
foreach ($style as $key => $value) {
|
||||
if (substr($key, 0, 1) != '_') {
|
||||
|
|
@ -102,7 +102,7 @@ class PHPWord_Section_Table
|
|||
*/
|
||||
public function addRow($height = null, $style = null)
|
||||
{
|
||||
$row = new PHPWord_Section_Table_Row($this->_insideOf, $this->_pCount, $height, $style);
|
||||
$row = new Row($this->_insideOf, $this->_pCount, $height, $style);
|
||||
$this->_rows[] = $row;
|
||||
return $row;
|
||||
}
|
||||
|
|
@ -112,7 +112,7 @@ class PHPWord_Section_Table
|
|||
*
|
||||
* @param int $width
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_Table_Cell
|
||||
* @return PhpOffice\PhpWord\Section\Table\Cell
|
||||
*/
|
||||
public function addCell($width = null, $style = null)
|
||||
{
|
||||
|
|
@ -134,7 +134,7 @@ class PHPWord_Section_Table
|
|||
/**
|
||||
* Get table style
|
||||
*
|
||||
* @return PHPWord_Style_Table
|
||||
* @return PhpOffice\PhpWord\Style\Table
|
||||
*/
|
||||
public function getStyle()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,12 +25,22 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPWord_Section_Table_Cell
|
||||
*/
|
||||
class PHPWord_Section_Table_Cell
|
||||
{
|
||||
namespace PhpOffice\PhpWord\Section\Table;
|
||||
|
||||
use PhpOffice\PhpWord\Media;
|
||||
use PhpOffice\PhpWord\Section\Footer\PreserveText;
|
||||
use PhpOffice\PhpWord\Section\Image;
|
||||
use PhpOffice\PhpWord\Section\Link;
|
||||
use PhpOffice\PhpWord\Section\ListItem;
|
||||
use PhpOffice\PhpWord\Section\MemoryImage;
|
||||
use PhpOffice\PhpWord\Section\Object;
|
||||
use PhpOffice\PhpWord\Section\Text;
|
||||
use PhpOffice\PhpWord\Section\TextBreak;
|
||||
use PhpOffice\PhpWord\Section\TextRun;
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
|
||||
class Cell
|
||||
{
|
||||
/**
|
||||
* Cell Width
|
||||
*
|
||||
|
|
@ -41,7 +51,7 @@ class PHPWord_Section_Table_Cell
|
|||
/**
|
||||
* Cell Style
|
||||
*
|
||||
* @var PHPWord_Style_Cell
|
||||
* @var PhpOffice\PhpWord\Style\Cell
|
||||
*/
|
||||
private $_style;
|
||||
|
||||
|
|
@ -80,7 +90,7 @@ class PHPWord_Section_Table_Cell
|
|||
$this->_insideOf = $insideOf;
|
||||
$this->_pCount = $pCount;
|
||||
$this->_width = $width;
|
||||
$this->_style = new PHPWord_Style_Cell;
|
||||
$this->_style = new PhpOffice\PhpWord\Style\Cell();
|
||||
|
||||
if (!is_null($style)) {
|
||||
if (is_array($style)) {
|
||||
|
|
@ -101,14 +111,14 @@ class PHPWord_Section_Table_Cell
|
|||
*
|
||||
* @param string $text
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_Text
|
||||
* @return PhpOffice\PhpWord\Section\Text
|
||||
*/
|
||||
public function addText($text, $styleFont = null, $styleParagraph = null)
|
||||
{
|
||||
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||
if (!String::IsUTF8($text)) {
|
||||
$text = utf8_encode($text);
|
||||
}
|
||||
$text = new PHPWord_Section_Text($text, $styleFont, $styleParagraph);
|
||||
$text = new Text($text, $styleFont, $styleParagraph);
|
||||
$this->_elementCollection[] = $text;
|
||||
return $text;
|
||||
}
|
||||
|
|
@ -119,22 +129,22 @@ class PHPWord_Section_Table_Cell
|
|||
* @param string $linkSrc
|
||||
* @param string $linkName
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_Link
|
||||
* @return PhpOffice\PhpWord\Section\Link
|
||||
*/
|
||||
public function addLink($linkSrc, $linkName = null, $style = null)
|
||||
{
|
||||
if ($this->_insideOf == 'section') {
|
||||
if (!PHPWord_Shared_String::IsUTF8($linkSrc)) {
|
||||
if (!String::IsUTF8($linkSrc)) {
|
||||
$linkSrc = utf8_encode($linkSrc);
|
||||
}
|
||||
if (!is_null($linkName)) {
|
||||
if (!PHPWord_Shared_String::IsUTF8($linkName)) {
|
||||
if (!String::IsUTF8($linkName)) {
|
||||
$linkName = utf8_encode($linkName);
|
||||
}
|
||||
}
|
||||
|
||||
$link = new PHPWord_Section_Link($linkSrc, $linkName, $style);
|
||||
$rID = PHPWord_Media::addSectionLinkElement($linkSrc);
|
||||
$link = new Link($linkSrc, $linkName, $style);
|
||||
$rID = Media::addSectionLinkElement($linkSrc);
|
||||
$link->setRelationId($rID);
|
||||
|
||||
$this->_elementCollection[] = $link;
|
||||
|
|
@ -148,14 +158,14 @@ class PHPWord_Section_Table_Cell
|
|||
/**
|
||||
* Add TextBreak
|
||||
*
|
||||
* @param int $count
|
||||
* @param null|string|array|PHPWord_Style_Font $fontStyle
|
||||
* @param null|string|array|PHPWord_Style_Paragraph $paragraphStyle
|
||||
* @param int $count
|
||||
* @param null|string|array|PhpOffice\PhpWord\Style\Font $fontStyle
|
||||
* @param null|string|array|PhpOffice\PhpWord\Style\Paragraph $paragraphStyle
|
||||
*/
|
||||
public function addTextBreak($count = 1, $fontStyle = null, $paragraphStyle = null)
|
||||
{
|
||||
for ($i = 1; $i <= $count; $i++) {
|
||||
$this->_elementCollection[] = new PHPWord_Section_TextBreak($fontStyle, $paragraphStyle);
|
||||
$this->_elementCollection[] = new TextBreak($fontStyle, $paragraphStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -166,14 +176,14 @@ class PHPWord_Section_Table_Cell
|
|||
* @param int $depth
|
||||
* @param mixed $styleText
|
||||
* @param mixed $styleList
|
||||
* @return PHPWord_Section_ListItem
|
||||
* @return PhpOffice\PhpWord\Section\ListItem
|
||||
*/
|
||||
public function addListItem($text, $depth = 0, $styleText = null, $styleList = null)
|
||||
{
|
||||
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||
if (!String::IsUTF8($text)) {
|
||||
$text = utf8_encode($text);
|
||||
}
|
||||
$listItem = new PHPWord_Section_ListItem($text, $depth, $styleText, $styleList);
|
||||
$listItem = new ListItem($text, $depth, $styleText, $styleList);
|
||||
$this->_elementCollection[] = $listItem;
|
||||
return $listItem;
|
||||
}
|
||||
|
|
@ -183,19 +193,19 @@ class PHPWord_Section_Table_Cell
|
|||
*
|
||||
* @param string $src
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_Image
|
||||
* @return PhpOffice\PhpWord\Section\Image
|
||||
*/
|
||||
public function addImage($src, $style = null)
|
||||
{
|
||||
$image = new PHPWord_Section_Image($src, $style);
|
||||
$image = new Image($src, $style);
|
||||
|
||||
if (!is_null($image->getSource())) {
|
||||
if ($this->_insideOf == 'section') {
|
||||
$rID = PHPWord_Media::addSectionMediaElement($src, 'image');
|
||||
$rID = Media::addSectionMediaElement($src, 'image');
|
||||
} elseif ($this->_insideOf == 'header') {
|
||||
$rID = PHPWord_Media::addHeaderMediaElement($this->_pCount, $src);
|
||||
$rID = Media::addHeaderMediaElement($this->_pCount, $src);
|
||||
} elseif ($this->_insideOf == 'footer') {
|
||||
$rID = PHPWord_Media::addFooterMediaElement($this->_pCount, $src);
|
||||
$rID = Media::addFooterMediaElement($this->_pCount, $src);
|
||||
}
|
||||
$image->setRelationId($rID);
|
||||
|
||||
|
|
@ -211,18 +221,18 @@ class PHPWord_Section_Table_Cell
|
|||
*
|
||||
* @param string $link
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_MemoryImage
|
||||
* @return PhpOffice\PhpWord\Section\MemoryImage
|
||||
*/
|
||||
public function addMemoryImage($link, $style = null)
|
||||
{
|
||||
$memoryImage = new PHPWord_Section_MemoryImage($link, $style);
|
||||
$memoryImage = new MemoryImage($link, $style);
|
||||
if (!is_null($memoryImage->getSource())) {
|
||||
if ($this->_insideOf == 'section') {
|
||||
$rID = PHPWord_Media::addSectionMediaElement($link, 'image', $memoryImage);
|
||||
$rID = Media::addSectionMediaElement($link, 'image', $memoryImage);
|
||||
} elseif ($this->_insideOf == 'header') {
|
||||
$rID = PHPWord_Media::addHeaderMediaElement($this->_pCount, $link, $memoryImage);
|
||||
$rID = Media::addHeaderMediaElement($this->_pCount, $link, $memoryImage);
|
||||
} elseif ($this->_insideOf == 'footer') {
|
||||
$rID = PHPWord_Media::addFooterMediaElement($this->_pCount, $link, $memoryImage);
|
||||
$rID = Media::addFooterMediaElement($this->_pCount, $link, $memoryImage);
|
||||
}
|
||||
$memoryImage->setRelationId($rID);
|
||||
|
||||
|
|
@ -238,11 +248,11 @@ class PHPWord_Section_Table_Cell
|
|||
*
|
||||
* @param string $src
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_Object
|
||||
* @return PhpOffice\PhpWord\Section\Object
|
||||
*/
|
||||
public function addObject($src, $style = null)
|
||||
{
|
||||
$object = new PHPWord_Section_Object($src, $style);
|
||||
$object = new Object($src, $style);
|
||||
|
||||
if (!is_null($object->getSource())) {
|
||||
$inf = pathinfo($src);
|
||||
|
|
@ -258,8 +268,8 @@ class PHPWord_Section_Table_Cell
|
|||
$iconSrc .= '_' . $ext . '.png';
|
||||
}
|
||||
|
||||
$rIDimg = PHPWord_Media::addSectionMediaElement($iconSrc, 'image');
|
||||
$data = PHPWord_Media::addSectionMediaElement($src, 'oleObject');
|
||||
$rIDimg = Media::addSectionMediaElement($iconSrc, 'image');
|
||||
$data = Media::addSectionMediaElement($src, 'oleObject');
|
||||
$rID = $data[0];
|
||||
$objectId = $data[1];
|
||||
|
||||
|
|
@ -280,15 +290,15 @@ class PHPWord_Section_Table_Cell
|
|||
* @param string $text
|
||||
* @param mixed $styleFont
|
||||
* @param mixed $styleParagraph
|
||||
* @return PHPWord_Section_Footer_PreserveText
|
||||
* @return PhpOffice\PhpWord\Section\Footer\PreserveText
|
||||
*/
|
||||
public function addPreserveText($text, $styleFont = null, $styleParagraph = null)
|
||||
{
|
||||
if ($this->_insideOf == 'footer' || $this->_insideOf == 'header') {
|
||||
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||
if (!String::IsUTF8($text)) {
|
||||
$text = utf8_encode($text);
|
||||
}
|
||||
$ptext = new PHPWord_Section_Footer_PreserveText($text, $styleFont, $styleParagraph);
|
||||
$ptext = new PreserveText($text, $styleFont, $styleParagraph);
|
||||
$this->_elementCollection[] = $ptext;
|
||||
return $ptext;
|
||||
} else {
|
||||
|
|
@ -299,11 +309,11 @@ class PHPWord_Section_Table_Cell
|
|||
/**
|
||||
* Create a new TextRun
|
||||
*
|
||||
* @return PHPWord_Section_TextRun
|
||||
* @return PhpOffice\PhpWord\Section\TextRun
|
||||
*/
|
||||
public function createTextRun($styleParagraph = null)
|
||||
{
|
||||
$textRun = new PHPWord_Section_TextRun($styleParagraph);
|
||||
$textRun = new TextRun($styleParagraph);
|
||||
$this->_elementCollection[] = $textRun;
|
||||
return $textRun;
|
||||
}
|
||||
|
|
@ -321,7 +331,7 @@ class PHPWord_Section_Table_Cell
|
|||
/**
|
||||
* Get Cell Style
|
||||
*
|
||||
* @return PHPWord_Style_Cell
|
||||
* @return PhpOffice\PhpWord\Style\Cell
|
||||
*/
|
||||
public function getStyle()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,12 +25,10 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPWord_Section_Table_Row
|
||||
*/
|
||||
class PHPWord_Section_Table_Row
|
||||
{
|
||||
namespace PhpOffice\PhpWord\Section\Table;
|
||||
|
||||
class Row
|
||||
{
|
||||
/**
|
||||
* Row height
|
||||
*
|
||||
|
|
@ -41,7 +39,7 @@ class PHPWord_Section_Table_Row
|
|||
/**
|
||||
* Row style
|
||||
*
|
||||
* @var PHPWord_Style_Row
|
||||
* @var PhpOffice\PhpWord\Style\Row
|
||||
*/
|
||||
private $_style;
|
||||
|
||||
|
|
@ -80,7 +78,7 @@ class PHPWord_Section_Table_Row
|
|||
$this->_insideOf = $insideOf;
|
||||
$this->_pCount = $pCount;
|
||||
$this->_height = $height;
|
||||
$this->_style = new PHPWord_Style_Row();
|
||||
$this->_style = new PhpOffice\PhpWord\Style\Row();
|
||||
|
||||
if (!is_null($style)) {
|
||||
if (is_array($style)) {
|
||||
|
|
@ -100,11 +98,11 @@ class PHPWord_Section_Table_Row
|
|||
*
|
||||
* @param int $width
|
||||
* @param mixed $style
|
||||
* @return PHPWord_Section_Table_Cell
|
||||
* @return PhpOffice\PhpWord\Section\Table\Cell
|
||||
*/
|
||||
public function addCell($width = null, $style = null)
|
||||
{
|
||||
$cell = new PHPWord_Section_Table_Cell($this->_insideOf, $this->_pCount, $width, $style);
|
||||
$cell = new Cell($this->_insideOf, $this->_pCount, $width, $style);
|
||||
$this->_cells[] = $cell;
|
||||
return $cell;
|
||||
}
|
||||
|
|
@ -122,7 +120,7 @@ class PHPWord_Section_Table_Row
|
|||
/**
|
||||
* Get row style
|
||||
*
|
||||
* @return PHPWord_Style_Row
|
||||
* @return PhpOffice\PhpWord\Style\Row
|
||||
*/
|
||||
public function getStyle()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,10 +25,12 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_Section_Text
|
||||
*/
|
||||
class PHPWord_Section_Text
|
||||
namespace PhpOffice\PhpWord\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
use PhpOffice\PhpWord\Style\Paragraph;
|
||||
|
||||
class Text
|
||||
{
|
||||
/**
|
||||
* Text content
|
||||
|
|
@ -40,14 +42,14 @@ class PHPWord_Section_Text
|
|||
/**
|
||||
* Text style
|
||||
*
|
||||
* @var PHPWord_Style_Font
|
||||
* @var PhpOffice\PhpWord\Style\Font
|
||||
*/
|
||||
private $fontStyle;
|
||||
|
||||
/**
|
||||
* Paragraph style
|
||||
*
|
||||
* @var PHPWord_Style_Paragraph
|
||||
* @var PhpOffice\PhpWord\Style\Paragraph
|
||||
*/
|
||||
private $paragraphStyle;
|
||||
|
||||
|
|
@ -55,8 +57,8 @@ class PHPWord_Section_Text
|
|||
* Create a new Text Element
|
||||
*
|
||||
* @param string $text
|
||||
* @param null|array|\PHPWord_Style_Font $fontStyle
|
||||
* @param null|array|\PHPWord_Style_Paragraph $paragraphStyle
|
||||
* @param null|array|PhpOffice\PhpWord\Style\Font $fontStyle
|
||||
* @param null|array|PhpOffice\PhpWord\Style\Paragraph $paragraphStyle
|
||||
*/
|
||||
public function __construct($text = null, $fontStyle = null, $paragraphStyle = null)
|
||||
{
|
||||
|
|
@ -68,20 +70,20 @@ class PHPWord_Section_Text
|
|||
/**
|
||||
* Set Text style
|
||||
*
|
||||
* @param null|array|\PHPWord_Style_Font $style
|
||||
* @param null|array|\PHPWord_Style_Paragraph $paragraphStyle
|
||||
* @return PHPWord_Style_Font
|
||||
* @param null|array|PhpOffice\PhpWord\Style\Font $style
|
||||
* @param null|array|PhpOffice\PhpWord\Style\Paragraph $paragraphStyle
|
||||
* @return PhpOffice\PhpWord\Style\Font
|
||||
*/
|
||||
public function setFontStyle($style = null, $paragraphStyle = null)
|
||||
{
|
||||
if ($style instanceof PHPWord_Style_Font) {
|
||||
if ($style instanceof Font) {
|
||||
$this->fontStyle = $style;
|
||||
$this->setParagraphStyle($paragraphStyle);
|
||||
} elseif (is_array($style)) {
|
||||
$this->fontStyle = new PHPWord_Style_Font('text', $paragraphStyle);
|
||||
$this->fontStyle = new Font('text', $paragraphStyle);
|
||||
$this->fontStyle->setArrayStyle($style);
|
||||
} elseif (null === $style) {
|
||||
$this->fontStyle = new PHPWord_Style_Font('text', $paragraphStyle);
|
||||
$this->fontStyle = new Font('text', $paragraphStyle);
|
||||
} else {
|
||||
$this->fontStyle = $style;
|
||||
$this->setParagraphStyle($paragraphStyle);
|
||||
|
|
@ -92,7 +94,7 @@ class PHPWord_Section_Text
|
|||
/**
|
||||
* Get Text style
|
||||
*
|
||||
* @return PHPWord_Style_Font
|
||||
* @return PhpOffice\PhpWord\Style\Font
|
||||
*/
|
||||
public function getFontStyle()
|
||||
{
|
||||
|
|
@ -102,18 +104,18 @@ class PHPWord_Section_Text
|
|||
/**
|
||||
* Set Paragraph style
|
||||
*
|
||||
* @param null|array|\PHPWord_Style_Paragraph $style
|
||||
* @return null|\PHPWord_Style_Paragraph
|
||||
* @param null|array|PhpOffice\PhpWord\Style\Paragraph $style
|
||||
* @return null|PhpOffice\PhpWord\Style\Paragraph
|
||||
*/
|
||||
public function setParagraphStyle($style = null)
|
||||
{
|
||||
if (is_array($style)) {
|
||||
$this->paragraphStyle = new PHPWord_Style_Paragraph;
|
||||
$this->paragraphStyle = new Paragraph;
|
||||
$this->paragraphStyle->setArrayStyle($style);
|
||||
} elseif ($style instanceof PHPWord_Style_Paragraph) {
|
||||
} elseif ($style instanceof Paragraph) {
|
||||
$this->paragraphStyle = $style;
|
||||
} elseif (null === $style) {
|
||||
$this->paragraphStyle = new PHPWord_Style_Paragraph;
|
||||
$this->paragraphStyle = new Paragraph;
|
||||
} else {
|
||||
$this->paragraphStyle = $style;
|
||||
}
|
||||
|
|
@ -123,7 +125,7 @@ class PHPWord_Section_Text
|
|||
/**
|
||||
* Get Paragraph style
|
||||
*
|
||||
* @return PHPWord_Style_Paragraph
|
||||
* @return PhpOffice\PhpWord\Style\Paragraph
|
||||
*/
|
||||
public function getParagraphStyle()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -25,22 +25,24 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_Section_TextBreak
|
||||
*/
|
||||
class PHPWord_Section_TextBreak
|
||||
namespace PhpOffice\PhpWord\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
use PhpOffice\PhpWord\Style\Paragraph;
|
||||
|
||||
class TextBreak
|
||||
{
|
||||
/**
|
||||
* Paragraph style
|
||||
*
|
||||
* @var PHPWord_Style_Pagaraph
|
||||
* @var PhpOffice\PhpWord\Style\Pagaraph
|
||||
*/
|
||||
private $paragraphStyle = null;
|
||||
|
||||
/**
|
||||
* Text style
|
||||
*
|
||||
* @var PHPWord_Style_Font
|
||||
* @var PhpOffice\PhpWord\Style\Font
|
||||
*/
|
||||
private $fontStyle = null;
|
||||
|
||||
|
|
@ -60,17 +62,17 @@ class PHPWord_Section_TextBreak
|
|||
/**
|
||||
* Set Text style
|
||||
*
|
||||
* @param null|array|\PHPWord_Style_Font $style
|
||||
* @param null|array|\PHPWord_Style_Paragraph $paragraphStyle
|
||||
* @return PHPWord_Style_Font
|
||||
* @param null|array|PhpOffice\PhpWord\Style\Font $style
|
||||
* @param null|array|PhpOffice\PhpWord\Style\Paragraph $paragraphStyle
|
||||
* @return PhpOffice\PhpWord\Style\Font
|
||||
*/
|
||||
public function setFontStyle($style = null, $paragraphStyle = null)
|
||||
{
|
||||
if ($style instanceof PHPWord_Style_Font) {
|
||||
if ($style instanceof Font) {
|
||||
$this->fontStyle = $style;
|
||||
$this->setParagraphStyle($paragraphStyle);
|
||||
} elseif (is_array($style)) {
|
||||
$this->fontStyle = new PHPWord_Style_Font('text', $paragraphStyle);
|
||||
$this->fontStyle = new Font('text', $paragraphStyle);
|
||||
$this->fontStyle->setArrayStyle($style);
|
||||
} else {
|
||||
$this->fontStyle = $style;
|
||||
|
|
@ -82,7 +84,7 @@ class PHPWord_Section_TextBreak
|
|||
/**
|
||||
* Get Text style
|
||||
*
|
||||
* @return PHPWord_Style_Font
|
||||
* @return PhpOffice\PhpWord\Style\Font
|
||||
*/
|
||||
public function getFontStyle()
|
||||
{
|
||||
|
|
@ -92,15 +94,15 @@ class PHPWord_Section_TextBreak
|
|||
/**
|
||||
* Set Paragraph style
|
||||
*
|
||||
* @param null|array|\PHPWord_Style_Paragraph $style
|
||||
* @return null|\PHPWord_Style_Paragraph
|
||||
* @param null|array|PhpOffice\PhpWord\Style\Paragraph $style
|
||||
* @return null|PhpOffice\PhpWord\Style\Paragraph
|
||||
*/
|
||||
public function setParagraphStyle($style = null)
|
||||
{
|
||||
if (is_array($style)) {
|
||||
$this->paragraphStyle = new PHPWord_Style_Paragraph;
|
||||
$this->paragraphStyle = new Paragraph;
|
||||
$this->paragraphStyle->setArrayStyle($style);
|
||||
} elseif ($style instanceof PHPWord_Style_Paragraph) {
|
||||
} elseif ($style instanceof Paragraph) {
|
||||
$this->paragraphStyle = $style;
|
||||
} else {
|
||||
$this->paragraphStyle = $style;
|
||||
|
|
@ -111,10 +113,10 @@ class PHPWord_Section_TextBreak
|
|||
/**
|
||||
* Get Paragraph style
|
||||
*
|
||||
* @return PHPWord_Style_Paragraph
|
||||
* @return PhpOffice\PhpWord\Style\Paragraph
|
||||
*/
|
||||
public function getParagraphStyle()
|
||||
{
|
||||
return $this->paragraphStyle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -25,16 +25,18 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPWord_Section_TextRun
|
||||
*/
|
||||
class PHPWord_Section_TextRun
|
||||
{
|
||||
namespace PhpOffice\PhpWord\Section;
|
||||
|
||||
use PhpOffice\PhpWord\Media;
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
use PhpOffice\PhpWord\Style\Paragraph;
|
||||
|
||||
class TextRun
|
||||
{
|
||||
/**
|
||||
* Paragraph style
|
||||
*
|
||||
* @var PHPWord_Style_Font
|
||||
* @var PhpOffice\PhpWord\Style\Paragraph
|
||||
*/
|
||||
private $_styleParagraph;
|
||||
|
||||
|
|
@ -55,7 +57,7 @@ class PHPWord_Section_TextRun
|
|||
|
||||
// Set paragraph style
|
||||
if (is_array($styleParagraph)) {
|
||||
$this->_styleParagraph = new PHPWord_Style_Paragraph();
|
||||
$this->_styleParagraph = new Paragraph();
|
||||
|
||||
foreach ($styleParagraph as $key => $value) {
|
||||
if (substr($key, 0, 1) != '_') {
|
||||
|
|
@ -74,14 +76,14 @@ class PHPWord_Section_TextRun
|
|||
*
|
||||
* @var string $text
|
||||
* @var mixed $styleFont
|
||||
* @return PHPWord_Section_Text
|
||||
* @return PhpOffice\PhpWord\Section\Text
|
||||
*/
|
||||
public function addText($text = null, $styleFont = null)
|
||||
{
|
||||
if (!PHPWord_Shared_String::IsUTF8($text)) {
|
||||
if (!String::IsUTF8($text)) {
|
||||
$text = utf8_encode($text);
|
||||
}
|
||||
$text = new PHPWord_Section_Text($text, $styleFont);
|
||||
$text = new Text($text, $styleFont);
|
||||
$this->_elementCollection[] = $text;
|
||||
return $text;
|
||||
}
|
||||
|
|
@ -92,7 +94,7 @@ class PHPWord_Section_TextRun
|
|||
* @param string $linkSrc
|
||||
* @param string $linkName
|
||||
* @param mixed $styleFont
|
||||
* @return PHPWord_Section_Link
|
||||
* @return PhpOffice\PhpWord\Section\Link
|
||||
*/
|
||||
public function addLink($linkSrc, $linkName = null, $styleFont = null)
|
||||
{
|
||||
|
|
@ -101,8 +103,8 @@ class PHPWord_Section_TextRun
|
|||
$linkName = utf8_encode($linkName);
|
||||
}
|
||||
|
||||
$link = new PHPWord_Section_Link($linkSrc, $linkName, $styleFont);
|
||||
$rID = PHPWord_Media::addSectionLinkElement($linkSrc);
|
||||
$link = new Link($linkSrc, $linkName, $styleFont);
|
||||
$rID = Media::addSectionLinkElement($linkSrc);
|
||||
$link->setRelationId($rID);
|
||||
|
||||
$this->_elementCollection[] = $link;
|
||||
|
|
@ -114,14 +116,14 @@ class PHPWord_Section_TextRun
|
|||
*
|
||||
* @param string $imageSrc
|
||||
* @param mixed $styleFont
|
||||
* @return PHPWord_Section_Image
|
||||
* @return PhpOffice\PhpWord\Section\Image
|
||||
*/
|
||||
public function addImage($imageSrc, $style = null)
|
||||
{
|
||||
$image = new PHPWord_Section_Image($imageSrc, $style);
|
||||
$image = new Image($imageSrc, $style);
|
||||
|
||||
if (!is_null($image->getSource())) {
|
||||
$rID = PHPWord_Media::addSectionMediaElement($imageSrc, 'image');
|
||||
$rID = Media::addSectionMediaElement($imageSrc, 'image');
|
||||
$image->setRelationId($rID);
|
||||
|
||||
$this->_elementCollection[] = $image;
|
||||
|
|
@ -134,14 +136,14 @@ class PHPWord_Section_TextRun
|
|||
/**
|
||||
* Add TextBreak
|
||||
*
|
||||
* @param int $count
|
||||
* @param null|string|array|PHPWord_Style_Font $fontStyle
|
||||
* @param null|string|array|PHPWord_Style_Paragraph $paragraphStyle
|
||||
* @param int $count
|
||||
* @param null|string|array|PhpOffice\PhpWord\Style\Font $fontStyle
|
||||
* @param null|string|array|PhpOffice\PhpWord\Style\Paragraph $paragraphStyle
|
||||
*/
|
||||
public function addTextBreak($count = 1, $fontStyle = null, $paragraphStyle = null)
|
||||
{
|
||||
for ($i = 1; $i <= $count; $i++) {
|
||||
$this->_elementCollection[] = new PHPWord_Section_TextBreak($fontStyle, $paragraphStyle);
|
||||
$this->_elementCollection[] = new TextBreak($fontStyle, $paragraphStyle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -149,12 +151,12 @@ class PHPWord_Section_TextRun
|
|||
* Create a new Footnote Element
|
||||
*
|
||||
* @param string $text
|
||||
* @return PHPWord_Section_Footnote
|
||||
* @return PhpOffice\PhpWord\Section\Footnote
|
||||
*/
|
||||
public function createFootnote($styleParagraph = null)
|
||||
{
|
||||
$footnote = new PHPWord_Section_Footnote($styleParagraph);
|
||||
$refID = PHPWord_Footnote::addFootnoteElement($footnote);
|
||||
$footnote = new PhpOffice\PhpWord\Section\Footnote($styleParagraph);
|
||||
$refID = PhpOffice\PhpWord\Footnote::addFootnoteElement($footnote);
|
||||
$footnote->setReferenceId($refID);
|
||||
$this->_elementCollection[] = $footnote;
|
||||
return $footnote;
|
||||
|
|
@ -173,10 +175,10 @@ class PHPWord_Section_TextRun
|
|||
/**
|
||||
* Get Paragraph style
|
||||
*
|
||||
* @return PHPWord_Style_Paragraph
|
||||
* @return PhpOffice\PhpWord\Style\Paragraph
|
||||
*/
|
||||
public function getParagraphStyle()
|
||||
{
|
||||
return $this->_styleParagraph;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -25,12 +25,10 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_Section_Title
|
||||
*/
|
||||
class PHPWord_Section_Title
|
||||
{
|
||||
namespace PhpOffice\PhpWord\Section;
|
||||
|
||||
class Title
|
||||
{
|
||||
/**
|
||||
* Title Text content
|
||||
*
|
||||
|
|
|
|||
|
|
@ -25,10 +25,9 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* PHPWord_Settings
|
||||
*/
|
||||
class PHPWord_Settings
|
||||
namespace PhpOffice\PhpWord;
|
||||
|
||||
class Settings
|
||||
{
|
||||
/**
|
||||
* Compatibility option for XMLWriter
|
||||
|
|
|
|||
|
|
@ -25,10 +25,9 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_Shared_Drawing
|
||||
*/
|
||||
class PHPWord_Shared_Drawing
|
||||
namespace PhpOffice\PhpWord\Shared;
|
||||
|
||||
class Drawing
|
||||
{
|
||||
/**
|
||||
* Convert pixels to EMU
|
||||
|
|
|
|||
|
|
@ -25,10 +25,9 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_Shared_File
|
||||
*/
|
||||
class PHPWord_Shared_File
|
||||
namespace PhpOffice\PhpWord\Shared;
|
||||
|
||||
class File
|
||||
{
|
||||
/**
|
||||
* Verify if a file exists
|
||||
|
|
|
|||
|
|
@ -25,10 +25,9 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_Shared_Font
|
||||
*/
|
||||
class PHPWord_Shared_Font
|
||||
namespace PhpOffice\PhpWord\Shared;
|
||||
|
||||
class Font
|
||||
{
|
||||
/**
|
||||
* Calculate an (approximate) pixel size, based on a font points size
|
||||
|
|
|
|||
|
|
@ -25,10 +25,9 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_Shared_String
|
||||
*/
|
||||
class PHPWord_Shared_String
|
||||
namespace PhpOffice\PhpWord\Shared;
|
||||
|
||||
class String
|
||||
{
|
||||
/**
|
||||
* Control characters array
|
||||
|
|
|
|||
|
|
@ -25,18 +25,20 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Shared;
|
||||
|
||||
use PhpOffice\PhpWord\Settings;
|
||||
|
||||
if (!defined('DATE_W3C')) {
|
||||
define('DATE_W3C', 'Y-m-d\TH:i:sP');
|
||||
}
|
||||
|
||||
/**
|
||||
* Class PHPWord_Shared_XMLWriter
|
||||
*
|
||||
* @method bool startElement(string $name)
|
||||
* @method bool writeAttribute(string $name, string $value)
|
||||
* @method bool endElement()
|
||||
*/
|
||||
class PHPWord_Shared_XMLWriter
|
||||
class XMLWriter
|
||||
{
|
||||
/** Temporary storage method */
|
||||
const STORAGE_MEMORY = 1;
|
||||
|
|
@ -57,7 +59,7 @@ class PHPWord_Shared_XMLWriter
|
|||
private $_tempFileName = '';
|
||||
|
||||
/**
|
||||
* Create a new PHPWord_Shared_XMLWriter instance
|
||||
* Create a new XMLWriter instance
|
||||
*
|
||||
* @param int $pTemporaryStorage Temporary storage location
|
||||
* @param string $pTemporaryStorageFolder Temporary storage folder
|
||||
|
|
@ -82,7 +84,7 @@ class PHPWord_Shared_XMLWriter
|
|||
}
|
||||
|
||||
// Set xml Compatibility
|
||||
$compatibility = PHPWord_Settings::getCompatibility();
|
||||
$compatibility = Settings::getCompatibility();
|
||||
if ($compatibility) {
|
||||
$this->_xmlWriter->setIndent(false);
|
||||
$this->_xmlWriter->setIndentString('');
|
||||
|
|
|
|||
|
|
@ -25,12 +25,12 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Shared;
|
||||
|
||||
/**
|
||||
* Class PHPWord_Shared_ZipStreamWrapper
|
||||
*
|
||||
* @codeCoverageIgnore Legacy from PHPExcel
|
||||
*/
|
||||
class PHPWord_Shared_ZipStreamWrapper
|
||||
class ZipStreamWrapper
|
||||
{
|
||||
/**
|
||||
* Internal ZipAcrhive
|
||||
|
|
@ -180,4 +180,4 @@ class PHPWord_Shared_ZipStreamWrapper
|
|||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -25,30 +25,27 @@
|
|||
* @version 0.8.0
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class PHPWord_Style
|
||||
*/
|
||||
class PHPWord_Style
|
||||
{
|
||||
namespace PhpOffice\PhpWord;
|
||||
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
use PhpOffice\PhpWord\Style\Paragraph;
|
||||
use PhpOffice\PhpWord\Style\TableFull;
|
||||
|
||||
class Style
|
||||
{
|
||||
/**
|
||||
* Style Elements
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private static $_styleElements = array();
|
||||
|
||||
|
||||
/**
|
||||
* Add a paragraph style
|
||||
*
|
||||
* @param string $styleName
|
||||
* @param array $styles
|
||||
*/
|
||||
public static function addParagraphStyle($styleName, $styles)
|
||||
{
|
||||
if (!array_key_exists($styleName, self::$_styleElements)) {
|
||||
$style = new PHPWord_Style_Paragraph();
|
||||
$style = new Paragraph();
|
||||
foreach ($styles as $key => $value) {
|
||||
if (substr($key, 0, 1) != '_') {
|
||||
$key = '_' . $key;
|
||||
|
|
@ -61,8 +58,6 @@ class PHPWord_Style
|
|||
}
|
||||
|
||||
/**
|
||||
* Add a font style
|
||||
*
|
||||
* @param string $styleName
|
||||
* @param array $styleFont
|
||||
* @param array $styleParagraph
|
||||
|
|
@ -70,7 +65,7 @@ class PHPWord_Style
|
|||
public static function addFontStyle($styleName, $styleFont, $styleParagraph = null)
|
||||
{
|
||||
if (!array_key_exists($styleName, self::$_styleElements)) {
|
||||
$font = new PHPWord_Style_Font('text', $styleParagraph);
|
||||
$font = new Font('text', $styleParagraph);
|
||||
foreach ($styleFont as $key => $value) {
|
||||
if (substr($key, 0, 1) != '_') {
|
||||
$key = '_' . $key;
|
||||
|
|
@ -82,15 +77,13 @@ class PHPWord_Style
|
|||
}
|
||||
|
||||
/**
|
||||
* Add a link style
|
||||
*
|
||||
* @param string $styleName
|
||||
* @param array $styles
|
||||
*/
|
||||
public static function addLinkStyle($styleName, $styles)
|
||||
{
|
||||
if (!array_key_exists($styleName, self::$_styleElements)) {
|
||||
$style = new PHPWord_Style_Font('link');
|
||||
$style = new Font('link');
|
||||
foreach ($styles as $key => $value) {
|
||||
if (substr($key, 0, 1) != '_') {
|
||||
$key = '_' . $key;
|
||||
|
|
@ -103,23 +96,19 @@ class PHPWord_Style
|
|||
}
|
||||
|
||||
/**
|
||||
* Add a table style
|
||||
*
|
||||
* @param string $styleName
|
||||
* @param array $styles
|
||||
*/
|
||||
public static function addTableStyle($styleName, $styleTable, $styleFirstRow = null, $styleLastRow = null)
|
||||
{
|
||||
if (!array_key_exists($styleName, self::$_styleElements)) {
|
||||
$style = new PHPWord_Style_TableFull($styleTable, $styleFirstRow, $styleLastRow);
|
||||
$style = new TableFull($styleTable, $styleFirstRow, $styleLastRow);
|
||||
|
||||
self::$_styleElements[$styleName] = $style;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a title style
|
||||
*
|
||||
* @param string $styleName
|
||||
* @param array $styleFont
|
||||
* @param array $styleParagraph
|
||||
|
|
@ -128,7 +117,7 @@ class PHPWord_Style
|
|||
{
|
||||
$styleName = 'Heading_' . $titleCount;
|
||||
if (!array_key_exists($styleName, self::$_styleElements)) {
|
||||
$font = new PHPWord_Style_Font('title', $styleParagraph);
|
||||
$font = new Font('title', $styleParagraph);
|
||||
foreach ($styleFont as $key => $value) {
|
||||
if (substr($key, 0, 1) != '_') {
|
||||
$key = '_' . $key;
|
||||
|
|
@ -141,9 +130,7 @@ class PHPWord_Style
|
|||
}
|
||||
|
||||
/**
|
||||
* Set default paragraph style
|
||||
*
|
||||
* @param array $styles Paragraph style definition
|
||||
* @param array $styles Paragraph style definition
|
||||
*/
|
||||
public static function setDefaultParagraphStyle($styles)
|
||||
{
|
||||
|
|
@ -153,7 +140,7 @@ class PHPWord_Style
|
|||
/**
|
||||
* Get all styles
|
||||
*
|
||||
* @return PHPWord_Style_Font[]
|
||||
* @return PhpOffice\PhpWord\Style\Font[]
|
||||
*/
|
||||
public static function getStyles()
|
||||
{
|
||||
|
|
@ -161,10 +148,7 @@ class PHPWord_Style
|
|||
}
|
||||
|
||||
/**
|
||||
* Get style
|
||||
*
|
||||
* @param string
|
||||
* @return PHPWord_Style
|
||||
*/
|
||||
public static function getStyle($styleName)
|
||||
{
|
||||
|
|
@ -174,4 +158,4 @@ class PHPWord_Style
|
|||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue