Reviewed and merged #658.
This commit is contained in:
parent
5781f659b1
commit
f359825cb7
|
|
@ -25,12 +25,17 @@ Use the correspondent `getAlignment` and `setAlignment` methods instead. - @Roma
|
|||
- `left`, `right`, and `justify` alignment options for tables (now are mapped to `Jc::START`, `Jc::END`, and `Jc::CENTER`). - @RomanSyroeshko
|
||||
|
||||
### Removed
|
||||
- `PhpOffice\PhpWord\Style\Alignment`. Style properties, which previously stored instances of this class, now deal with strings.
|
||||
- `\PhpOffice\PhpWord\Style\Alignment`. Style properties, which previously stored instances of this class, now deal with strings.
|
||||
In each case set of available string values is defined by the correspondent simple type. - @RomanSyroeshko
|
||||
- Manual installation support. Since the release we have dependencies on third party libraries,
|
||||
so installation via ZIP-archive download is not an option anymore. To install PHPWord use [Composer](https://getcomposer.org/).
|
||||
We also removed `PhpOffice\PhpWord\Autoloader`, because the latter change made it completely useless.
|
||||
We also removed `\PhpOffice\PhpWord\Autoloader`, because the latter change made it completely useless.
|
||||
Autoloaders provided by Composer are in use now (see `bootstrap.php`). - @RomanSyroeshko
|
||||
- `\PhpOffice\PhpWord\Shared\Drawing` replaced by `\PhpOffice\Common\Drawing`. - @Progi1984 #658
|
||||
- `\PhpOffice\PhpWord\Shared\Font`. - @Progi1984 #658
|
||||
- `\PhpOffice\PhpWord\Shared\String` replaced by `\PhpOffice\Common\Text`. - @Progi1984 @RomanSyroeshko #658
|
||||
- `\PhpOffice\PhpWord\Shared\XMLReader` replaced by `\PhpOffice\Common\XMLReader`. - @Progi1984 #658
|
||||
- `\PhpOffice\PhpWord\Shared\XMLWriter` replaced by `\PhpOffice\Common\XMLWriter`. - @Progi1984 @RomanSyroeshko #658
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -34,7 +34,9 @@
|
|||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"ext-xml": "*",
|
||||
"zendframework/zend-validator": "2.5.*"
|
||||
"zendframework/zend-validator": "2.5.*",
|
||||
"zendframework/zend-stdlib": "~2.5",
|
||||
"phpoffice/common": "0.2.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "3.7.*",
|
||||
|
|
@ -43,9 +45,11 @@
|
|||
"phpmd/phpmd": "2.*",
|
||||
"phploc/phploc": "2.*",
|
||||
"dompdf/dompdf":"0.6.*",
|
||||
"tecnick.com/tcpdf": "6.*",
|
||||
"tecnickcom/tcpdf": "6.*",
|
||||
"mpdf/mpdf": "5.*",
|
||||
"zendframework/zend-validator": "2.5.*"
|
||||
"zendframework/zend-validator": "2.5.*",
|
||||
"zendframework/zend-stdlib": "~2.5",
|
||||
"phpoffice/common": "0.2.*"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-zip": "Allows writing DOCX and ODT",
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
use PhpOffice\Common\Text as CommonText;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
|
||||
/**
|
||||
|
|
@ -47,7 +47,7 @@ class Bookmark extends AbstractElement
|
|||
public function __construct($name)
|
||||
{
|
||||
|
||||
$this->name = String::toUTF8($name);
|
||||
$this->name = CommonText::toUTF8($name);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
use PhpOffice\Common\Text as CommonText;
|
||||
|
||||
/**
|
||||
* Check box element
|
||||
|
|
@ -56,7 +56,7 @@ class CheckBox extends Text
|
|||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = String::toUTF8($name);
|
||||
$this->name = CommonText::toUTF8($name);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
use PhpOffice\Common\Text as CommonText;
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
use PhpOffice\PhpWord\Style\Paragraph;
|
||||
|
||||
|
|
@ -78,8 +78,8 @@ class Link extends AbstractElement
|
|||
*/
|
||||
public function __construct($source, $text = null, $fontStyle = null, $paragraphStyle = null, $internal = false)
|
||||
{
|
||||
$this->source = String::toUTF8($source);
|
||||
$this->text = is_null($text) ? $this->source : String::toUTF8($text);
|
||||
$this->source = CommonText::toUTF8($source);
|
||||
$this->text = is_null($text) ? $this->source : CommonText::toUTF8($text);
|
||||
$this->fontStyle = $this->setNewStyle(new Font('text'), $fontStyle);
|
||||
$this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle);
|
||||
$this->internal = $internal;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
use PhpOffice\Common\Text as CommonText;
|
||||
use PhpOffice\PhpWord\Style\ListItem as ListItemStyle;
|
||||
|
||||
/**
|
||||
|
|
@ -57,7 +57,7 @@ class ListItem extends AbstractElement
|
|||
*/
|
||||
public function __construct($text, $depth = 0, $fontStyle = null, $listStyle = null, $paragraphStyle = null)
|
||||
{
|
||||
$this->textObject = new Text(String::toUTF8($text), $fontStyle, $paragraphStyle);
|
||||
$this->textObject = new Text(CommonText::toUTF8($text), $fontStyle, $paragraphStyle);
|
||||
$this->depth = $depth;
|
||||
|
||||
// Version >= 0.10.0 will pass numbering style name. Older version will use old method
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
use PhpOffice\Common\Text as CommonText;
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
use PhpOffice\PhpWord\Style\Paragraph;
|
||||
|
||||
|
|
@ -61,7 +61,7 @@ class PreserveText extends AbstractElement
|
|||
$this->fontStyle = $this->setNewStyle(new Font('text'), $fontStyle);
|
||||
$this->paragraphStyle = $this->setNewStyle(new Paragraph(), $paragraphStyle);
|
||||
|
||||
$this->text = String::toUTF8($text);
|
||||
$this->text = CommonText::toUTF8($text);
|
||||
$matches = preg_split('/({.*?})/', $this->text, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
if (isset($matches[0])) {
|
||||
$this->text = $matches;
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
use PhpOffice\Common\Text as CommonText;
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
use PhpOffice\PhpWord\Style\Paragraph;
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ class Text extends AbstractElement
|
|||
*/
|
||||
public function setText($text)
|
||||
{
|
||||
$this->text = String::toUTF8($text);
|
||||
$this->text = CommonText::toUTF8($text);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
use PhpOffice\Common\Text as CommonText;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
|
||||
/**
|
||||
|
|
@ -61,7 +61,7 @@ class Title extends AbstractElement
|
|||
*/
|
||||
public function __construct($text, $depth = 1)
|
||||
{
|
||||
$this->text = String::toUTF8($text);
|
||||
$this->text = CommonText::toUTF8($text);
|
||||
$this->depth = $depth;
|
||||
if (array_key_exists("Heading_{$this->depth}", Style::getStyles())) {
|
||||
$this->style = "Heading{$this->depth}";
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Reader;
|
||||
|
||||
use PhpOffice\Common\Drawing;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\Drawing;
|
||||
use PhpOffice\PhpWord\Shared\OLERead;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Reader;
|
||||
|
||||
use PhpOffice\Common\XMLReader;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLReader;
|
||||
|
||||
/**
|
||||
* Reader for ODText
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Reader\ODText;
|
||||
|
||||
use PhpOffice\Common\XMLReader;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLReader;
|
||||
|
||||
/**
|
||||
* Content reader
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Reader\ODText;
|
||||
|
||||
use PhpOffice\Common\XMLReader;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLReader;
|
||||
|
||||
/**
|
||||
* Meta reader
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Reader;
|
||||
|
||||
use PhpOffice\Common\XMLReader;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLReader;
|
||||
use PhpOffice\PhpWord\Shared\ZipArchive;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Reader\Word2007;
|
||||
|
||||
use PhpOffice\Common\XMLReader;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLReader;
|
||||
|
||||
/**
|
||||
* Abstract part reader
|
||||
|
|
@ -92,7 +92,7 @@ abstract class AbstractPart
|
|||
/**
|
||||
* Read w:p.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
|
||||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||
* @param \DOMElement $domNode
|
||||
* @param mixed $parent
|
||||
* @param string $docPart
|
||||
|
|
@ -183,7 +183,7 @@ abstract class AbstractPart
|
|||
/**
|
||||
* Read w:r.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
|
||||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||
* @param \DOMElement $domNode
|
||||
* @param mixed $parent
|
||||
* @param string $docPart
|
||||
|
|
@ -246,7 +246,7 @@ abstract class AbstractPart
|
|||
/**
|
||||
* Read w:tbl.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
|
||||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||
* @param \DOMElement $domNode
|
||||
* @param mixed $parent
|
||||
* @param string $docPart
|
||||
|
|
@ -307,7 +307,7 @@ abstract class AbstractPart
|
|||
/**
|
||||
* Read w:pPr.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
|
||||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||
* @param \DOMElement $domNode
|
||||
* @return array|null
|
||||
*/
|
||||
|
|
@ -339,7 +339,7 @@ abstract class AbstractPart
|
|||
/**
|
||||
* Read w:rPr
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
|
||||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||
* @param \DOMElement $domNode
|
||||
* @return array|null
|
||||
*/
|
||||
|
|
@ -382,7 +382,7 @@ abstract class AbstractPart
|
|||
/**
|
||||
* Read w:tblPr
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
|
||||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||
* @param \DOMElement $domNode
|
||||
* @return string|array|null
|
||||
* @todo Capture w:tblStylePr w:type="firstRow"
|
||||
|
|
@ -418,7 +418,7 @@ abstract class AbstractPart
|
|||
/**
|
||||
* Read w:tcPr
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
|
||||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||
* @param \DOMElement $domNode
|
||||
* @return array
|
||||
*/
|
||||
|
|
@ -438,7 +438,7 @@ abstract class AbstractPart
|
|||
/**
|
||||
* Read style definition
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
|
||||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||
* @param \DOMElement $parentNode
|
||||
* @param array $styleDefs
|
||||
* @ignoreScrutinizerPatch
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Reader\Word2007;
|
||||
|
||||
use PhpOffice\Common\XMLReader;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLReader;
|
||||
|
||||
/**
|
||||
* Core properties reader
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Reader\Word2007;
|
||||
|
||||
use PhpOffice\Common\XMLReader;
|
||||
use PhpOffice\PhpWord\Metadata\DocInfo;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLReader;
|
||||
|
||||
/**
|
||||
* Custom properties reader
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Reader\Word2007;
|
||||
|
||||
use PhpOffice\Common\XMLReader;
|
||||
use PhpOffice\PhpWord\Element\Section;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLReader;
|
||||
|
||||
/**
|
||||
* Document reader
|
||||
|
|
@ -99,7 +99,7 @@ class Document extends AbstractPart
|
|||
/**
|
||||
* Read w:sectPr
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
|
||||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||
* @param \DOMElement $domNode
|
||||
* @ignoreScrutinizerPatch
|
||||
* @return array
|
||||
|
|
@ -142,7 +142,7 @@ class Document extends AbstractPart
|
|||
/**
|
||||
* Read w:p node.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
|
||||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||
* @param \DOMElement $node
|
||||
* @param \PhpOffice\PhpWord\Element\Section &$section
|
||||
* @return void
|
||||
|
|
@ -172,7 +172,7 @@ class Document extends AbstractPart
|
|||
/**
|
||||
* Read w:sectPr node.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
|
||||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||
* @param \DOMElement $node
|
||||
* @param \PhpOffice\PhpWord\Element\Section &$section
|
||||
* @return void
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Reader\Word2007;
|
||||
|
||||
use PhpOffice\Common\XMLReader;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLReader;
|
||||
|
||||
/**
|
||||
* Footnotes reader
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Reader\Word2007;
|
||||
|
||||
use PhpOffice\Common\XMLReader;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLReader;
|
||||
|
||||
/**
|
||||
* Numbering reader
|
||||
|
|
@ -90,7 +90,7 @@ class Numbering extends AbstractPart
|
|||
/**
|
||||
* Read numbering level definition from w:abstractNum and w:num
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLReader $xmlReader
|
||||
* @param \PhpOffice\Common\XMLReader $xmlReader
|
||||
* @param \DOMElement $subnode
|
||||
* @param integer $levelId
|
||||
* @return array
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Reader\Word2007;
|
||||
|
||||
use PhpOffice\Common\XMLReader;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLReader;
|
||||
|
||||
/**
|
||||
* Styles reader
|
||||
|
|
|
|||
|
|
@ -1,225 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of PHPWord - A pure PHP library for reading and writing
|
||||
* word processing documents.
|
||||
*
|
||||
* PHPWord is free software distributed under the terms of the GNU Lesser
|
||||
* General Public License version 3 as published by the Free Software Foundation.
|
||||
*
|
||||
* For the full copyright and license information, please read the LICENSE
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2015 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Shared;
|
||||
|
||||
/**
|
||||
* Common drawing functions
|
||||
*/
|
||||
class Drawing
|
||||
{
|
||||
/**
|
||||
* Convert pixels to EMU
|
||||
*
|
||||
* @param integer $pValue Value in pixels
|
||||
* @return double Value in EMU
|
||||
*/
|
||||
public static function pixelsToEMU($pValue = 0)
|
||||
{
|
||||
return round($pValue * 9525);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert EMU to pixels
|
||||
*
|
||||
* @param integer $pValue Value in EMU
|
||||
* @return integer Value in pixels
|
||||
*/
|
||||
public static function emuToPixels($pValue = 0)
|
||||
{
|
||||
if ($pValue != 0) {
|
||||
return round($pValue / 9525);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert pixels to points
|
||||
*
|
||||
* @param integer $pValue Value in pixels
|
||||
* @return double Value in points
|
||||
*/
|
||||
public static function pixelsToPoints($pValue = 0)
|
||||
{
|
||||
return $pValue * 0.67777777;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert points width to pixels
|
||||
*
|
||||
* @param integer $pValue Value in points
|
||||
* @return integer Value in pixels
|
||||
*/
|
||||
public static function pointsToPixels($pValue = 0)
|
||||
{
|
||||
if ($pValue != 0) {
|
||||
return $pValue * 1.333333333;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert degrees to angle
|
||||
*
|
||||
* @param integer $pValue Degrees
|
||||
* @return integer Angle
|
||||
*/
|
||||
public static function degreesToAngle($pValue = 0)
|
||||
{
|
||||
return (integer)round($pValue * 60000);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert angle to degrees
|
||||
*
|
||||
* @param integer $pValue Angle
|
||||
* @return integer Degrees
|
||||
*/
|
||||
public static function angleToDegrees($pValue = 0)
|
||||
{
|
||||
if ($pValue != 0) {
|
||||
return round($pValue / 60000);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert pixels to centimeters
|
||||
*
|
||||
* @param integer $pValue Value in pixels
|
||||
* @return double Value in centimeters
|
||||
*/
|
||||
public static function pixelsToCentimeters($pValue = 0)
|
||||
{
|
||||
return $pValue * 0.028;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert centimeters width to pixels
|
||||
*
|
||||
* @param integer $pValue Value in centimeters
|
||||
* @return integer Value in pixels
|
||||
*/
|
||||
public static function centimetersToPixels($pValue = 0)
|
||||
{
|
||||
if ($pValue != 0) {
|
||||
return $pValue / 0.028;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert centimeters width to twips
|
||||
*
|
||||
* @param integer $pValue
|
||||
*/
|
||||
public static function centimetersToTwips($pValue = 0)
|
||||
{
|
||||
if ($pValue != 0) {
|
||||
return $pValue * 566.928;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert twips width to centimeters
|
||||
*
|
||||
* @param integer $pValue
|
||||
*/
|
||||
public static function twipsToCentimeters($pValue = 0)
|
||||
{
|
||||
if ($pValue != 0) {
|
||||
return $pValue / 566.928;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert inches width to twips
|
||||
*
|
||||
* @param integer $pValue
|
||||
*/
|
||||
public static function inchesToTwips($pValue = 0)
|
||||
{
|
||||
if ($pValue != 0) {
|
||||
return $pValue * 1440;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert twips width to inches
|
||||
*
|
||||
* @param integer $pValue
|
||||
*/
|
||||
public static function twipsToInches($pValue = 0)
|
||||
{
|
||||
if ($pValue != 0) {
|
||||
return $pValue / 1440;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert twips width to pixels
|
||||
*
|
||||
* @param integer $pValue
|
||||
*/
|
||||
public static function twipsToPixels($pValue = 0)
|
||||
{
|
||||
if ($pValue != 0) {
|
||||
return round($pValue / 15.873984);
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert HTML hexadecimal to RGB
|
||||
*
|
||||
* @param string $pValue HTML Color in hexadecimal
|
||||
* @return array Value in RGB
|
||||
*/
|
||||
public static function htmlToRGB($pValue)
|
||||
{
|
||||
if ($pValue[0] == '#') {
|
||||
$pValue = substr($pValue, 1);
|
||||
}
|
||||
|
||||
if (strlen($pValue) == 6) {
|
||||
list($colorR, $colorG, $colorB) = array($pValue[0] . $pValue[1], $pValue[2] . $pValue[3], $pValue[4] . $pValue[5]);
|
||||
} elseif (strlen($pValue) == 3) {
|
||||
list($colorR, $colorG, $colorB) = array($pValue[0] . $pValue[0], $pValue[1] . $pValue[1], $pValue[2] . $pValue[2]);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
$colorR = hexdec($colorR);
|
||||
$colorG = hexdec($colorG);
|
||||
$colorB = hexdec($colorB);
|
||||
|
||||
return array($colorR, $colorG, $colorB);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of PHPWord - A pure PHP library for reading and writing
|
||||
* word processing documents.
|
||||
*
|
||||
* PHPWord is free software distributed under the terms of the GNU Lesser
|
||||
* General Public License version 3 as published by the Free Software Foundation.
|
||||
*
|
||||
* For the full copyright and license information, please read the LICENSE
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2015 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Shared;
|
||||
|
||||
/**
|
||||
* DEPRECATED: Common font functions; Use 'Converter'
|
||||
*
|
||||
* @deprecated 0.12.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Font
|
||||
{
|
||||
/**
|
||||
* Calculate an (approximate) pixel size, based on a font points size
|
||||
*
|
||||
* @param int $fontSizeInPoints Font size (in points)
|
||||
* @return int Font size (in pixels)
|
||||
*/
|
||||
public static function fontSizeToPixels($fontSizeInPoints = 12)
|
||||
{
|
||||
return Converter::pointToPixel($fontSizeInPoints);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate an (approximate) pixel size, based on inch size
|
||||
*
|
||||
* @param int $sizeInInch Font size (in inch)
|
||||
* @return int Size (in pixels)
|
||||
*/
|
||||
public static function inchSizeToPixels($sizeInInch = 1)
|
||||
{
|
||||
return Converter::inchToPixel($sizeInInch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate an (approximate) pixel size, based on centimeter size
|
||||
*
|
||||
* @param int $sizeInCm Font size (in centimeters)
|
||||
* @return double Size (in pixels)
|
||||
*/
|
||||
public static function centimeterSizeToPixels($sizeInCm = 1)
|
||||
{
|
||||
return Converter::cmToPixel($sizeInCm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert centimeter to twip
|
||||
*
|
||||
* @param int $sizeInCm
|
||||
* @return double
|
||||
*/
|
||||
public static function centimeterSizeToTwips($sizeInCm = 1)
|
||||
{
|
||||
return Converter::cmToTwip($sizeInCm);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert inch to twip
|
||||
*
|
||||
* @param int $sizeInInch
|
||||
* @return double
|
||||
*/
|
||||
public static function inchSizeToTwips($sizeInInch = 1)
|
||||
{
|
||||
return Converter::inchToTwip($sizeInInch);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert pixel to twip
|
||||
*
|
||||
* @param int $sizeInPixel
|
||||
* @return double
|
||||
*/
|
||||
public static function pixelSizeToTwips($sizeInPixel = 1)
|
||||
{
|
||||
return Converter::pixelToTwip($sizeInPixel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate twip based on point size, used mainly for paragraph spacing
|
||||
*
|
||||
* @param integer $sizeInPoint Size in point
|
||||
* @return integer Size (in twips)
|
||||
*/
|
||||
public static function pointSizeToTwips($sizeInPoint = 1)
|
||||
{
|
||||
return Converter::pointToTwip($sizeInPoint);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,195 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of PHPWord - A pure PHP library for reading and writing
|
||||
* word processing documents.
|
||||
*
|
||||
* PHPWord is free software distributed under the terms of the GNU Lesser
|
||||
* General Public License version 3 as published by the Free Software Foundation.
|
||||
*
|
||||
* For the full copyright and license information, please read the LICENSE
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2015 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Shared;
|
||||
|
||||
/**
|
||||
* Common string functions
|
||||
*/
|
||||
class String
|
||||
{
|
||||
/**
|
||||
* Control characters array
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
private static $controlCharacters = array();
|
||||
|
||||
/**
|
||||
* Convert from OpenXML escaped control character to PHP control character
|
||||
*
|
||||
* @param string $value Value to unescape
|
||||
* @return string
|
||||
*/
|
||||
public static function controlCharacterOOXML2PHP($value = '')
|
||||
{
|
||||
if (empty(self::$controlCharacters)) {
|
||||
self::buildControlCharacters();
|
||||
}
|
||||
|
||||
return str_replace(array_keys(self::$controlCharacters), array_values(self::$controlCharacters), $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert from PHP control character to OpenXML escaped control character
|
||||
*
|
||||
* @param string $value Value to escape
|
||||
* @return string
|
||||
*/
|
||||
public static function controlCharacterPHP2OOXML($value = '')
|
||||
{
|
||||
if (empty(self::$controlCharacters)) {
|
||||
self::buildControlCharacters();
|
||||
}
|
||||
|
||||
return str_replace(array_values(self::$controlCharacters), array_keys(self::$controlCharacters), $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if a string contains UTF-8 data
|
||||
*
|
||||
* @param string $value
|
||||
* @return boolean
|
||||
*/
|
||||
public static function isUTF8($value = '')
|
||||
{
|
||||
return $value === '' || preg_match('/^./su', $value) === 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return UTF8 encoded value
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function toUTF8($value = '')
|
||||
{
|
||||
if (!is_null($value) && !self::isUTF8($value)) {
|
||||
$value = utf8_encode($value);
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns unicode from UTF8 text
|
||||
*
|
||||
* The function is splitted to reduce cyclomatic complexity
|
||||
*
|
||||
* @param string $text UTF8 text
|
||||
* @return string Unicode text
|
||||
* @since 0.11.0
|
||||
*/
|
||||
public static function toUnicode($text)
|
||||
{
|
||||
return self::unicodeToEntities(self::utf8ToUnicode($text));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns unicode array from UTF8 text
|
||||
*
|
||||
* @param string $text UTF8 text
|
||||
* @return array
|
||||
* @since 0.11.0
|
||||
* @link http://www.randomchaos.com/documents/?source=php_and_unicode
|
||||
*/
|
||||
private static function utf8ToUnicode($text)
|
||||
{
|
||||
$unicode = array();
|
||||
$values = array();
|
||||
$lookingFor = 1;
|
||||
|
||||
// Gets unicode for each character
|
||||
for ($i = 0; $i < strlen($text); $i++) {
|
||||
$thisValue = ord($text[$i]);
|
||||
if ($thisValue < 128) {
|
||||
$unicode[] = $thisValue;
|
||||
} else {
|
||||
if (count($values) == 0) {
|
||||
$lookingFor = $thisValue < 224 ? 2 : 3;
|
||||
}
|
||||
$values[] = $thisValue;
|
||||
if (count($values) == $lookingFor) {
|
||||
if ($lookingFor == 3) {
|
||||
$number = (($values[0] % 16) * 4096) + (($values[1] % 64) * 64) + ($values[2] % 64);
|
||||
} else {
|
||||
$number = (($values[0] % 32) * 64) + ($values[1] % 64);
|
||||
}
|
||||
$unicode[] = $number;
|
||||
$values = array();
|
||||
$lookingFor = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $unicode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns entites from unicode array
|
||||
*
|
||||
* @param array $unicode
|
||||
* @return string
|
||||
* @since 0.11.0
|
||||
* @link http://www.randomchaos.com/documents/?source=php_and_unicode
|
||||
*/
|
||||
private static function unicodeToEntities($unicode)
|
||||
{
|
||||
$entities = '';
|
||||
|
||||
foreach ($unicode as $value) {
|
||||
if ($value != 65279) {
|
||||
$entities .= $value > 127 ? '\uc0{\u' . $value . '}' : chr($value);
|
||||
}
|
||||
}
|
||||
|
||||
return $entities;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return name without underscore for < 0.10.0 variable name compatibility
|
||||
*
|
||||
* @param string $value
|
||||
* @return string
|
||||
*/
|
||||
public static function removeUnderscorePrefix($value)
|
||||
{
|
||||
if (!is_null($value)) {
|
||||
if (substr($value, 0, 1) == '_') {
|
||||
$value = substr($value, 1);
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Build control characters array.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private static function buildControlCharacters()
|
||||
{
|
||||
for ($i = 0; $i <= 19; ++$i) {
|
||||
if ($i != 9 && $i != 10 && $i != 13) {
|
||||
$find = '_x' . sprintf('%04s', strtoupper(dechex($i))) . '_';
|
||||
$replace = chr($i);
|
||||
self::$controlCharacters[$find] = $replace;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,194 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of PHPWord - A pure PHP library for reading and writing
|
||||
* word processing documents.
|
||||
*
|
||||
* PHPWord is free software distributed under the terms of the GNU Lesser
|
||||
* General Public License version 3 as published by the Free Software Foundation.
|
||||
*
|
||||
* For the full copyright and license information, please read the LICENSE
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2015 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Shared;
|
||||
|
||||
use PhpOffice\PhpWord\Exception\Exception;
|
||||
|
||||
/**
|
||||
* XML Reader wrapper
|
||||
*
|
||||
* @since 0.10.0
|
||||
*/
|
||||
class XMLReader
|
||||
{
|
||||
/**
|
||||
* DOMDocument object
|
||||
*
|
||||
* @var \DOMDocument
|
||||
*/
|
||||
private $dom = null;
|
||||
|
||||
/**
|
||||
* DOMXpath object
|
||||
*
|
||||
* @var \DOMXpath
|
||||
*/
|
||||
private $xpath = null;
|
||||
|
||||
/**
|
||||
* Get DOMDocument from ZipArchive
|
||||
*
|
||||
* @param string $zipFile
|
||||
* @param string $xmlFile
|
||||
*
|
||||
* @return \DOMDocument|false
|
||||
*
|
||||
* @throws \PhpOffice\PhpWord\Exception\Exception
|
||||
*/
|
||||
public function getDomFromZip($zipFile, $xmlFile)
|
||||
{
|
||||
if (file_exists($zipFile) === false) {
|
||||
throw new Exception('Cannot find archive file.');
|
||||
}
|
||||
|
||||
$zip = new ZipArchive();
|
||||
$zip->open($zipFile);
|
||||
$content = $zip->getFromName($xmlFile);
|
||||
$zip->close();
|
||||
|
||||
if ($content === false) {
|
||||
return false;
|
||||
} else {
|
||||
return $this->getDomFromString($content);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get DOMDocument from content string
|
||||
*
|
||||
* @param string $content
|
||||
* @return \DOMDocument
|
||||
*/
|
||||
public function getDomFromString($content)
|
||||
{
|
||||
$this->dom = new \DOMDocument();
|
||||
$this->dom->loadXML($content);
|
||||
|
||||
return $this->dom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get elements
|
||||
*
|
||||
* @param string $path
|
||||
* @param \DOMElement $contextNode
|
||||
* @return \DOMNodeList
|
||||
*/
|
||||
public function getElements($path, \DOMElement $contextNode = null)
|
||||
{
|
||||
if ($this->dom === null) {
|
||||
return array();
|
||||
}
|
||||
if ($this->xpath === null) {
|
||||
$this->xpath = new \DOMXpath($this->dom);
|
||||
}
|
||||
|
||||
if (is_null($contextNode)) {
|
||||
return $this->xpath->query($path);
|
||||
} else {
|
||||
return $this->xpath->query($path, $contextNode);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get element
|
||||
*
|
||||
* @param string $path
|
||||
* @param \DOMElement $contextNode
|
||||
* @return \DOMElement|null
|
||||
*/
|
||||
public function getElement($path, \DOMElement $contextNode = null)
|
||||
{
|
||||
$elements = $this->getElements($path, $contextNode);
|
||||
if ($elements->length > 0) {
|
||||
return $elements->item(0);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get element attribute
|
||||
*
|
||||
* @param string $attribute
|
||||
* @param \DOMElement $contextNode
|
||||
* @param string $path
|
||||
* @return string|null
|
||||
*/
|
||||
public function getAttribute($attribute, \DOMElement $contextNode = null, $path = null)
|
||||
{
|
||||
$return = null;
|
||||
if ($path !== null) {
|
||||
$elements = $this->getElements($path, $contextNode);
|
||||
if ($elements->length > 0) {
|
||||
/** @var \DOMElement $node Type hint */
|
||||
$node = $elements->item(0);
|
||||
$return = $node->getAttribute($attribute);
|
||||
}
|
||||
} else {
|
||||
if ($contextNode !== null) {
|
||||
$return = $contextNode->getAttribute($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
return ($return == '') ? null : $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get element value
|
||||
*
|
||||
* @param string $path
|
||||
* @param \DOMElement $contextNode
|
||||
* @return string|null
|
||||
*/
|
||||
public function getValue($path, \DOMElement $contextNode = null)
|
||||
{
|
||||
$elements = $this->getElements($path, $contextNode);
|
||||
if ($elements->length > 0) {
|
||||
return $elements->item(0)->nodeValue;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Count elements
|
||||
*
|
||||
* @param string $path
|
||||
* @param \DOMElement $contextNode
|
||||
* @return integer
|
||||
*/
|
||||
public function countElements($path, \DOMElement $contextNode = null)
|
||||
{
|
||||
$elements = $this->getElements($path, $contextNode);
|
||||
|
||||
return $elements->length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Element exists
|
||||
*
|
||||
* @param string $path
|
||||
* @param \DOMElement $contextNode
|
||||
* @return boolean
|
||||
*/
|
||||
public function elementExists($path, \DOMElement $contextNode = null)
|
||||
{
|
||||
return $this->getElements($path, $contextNode)->length > 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,203 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of PHPWord - A pure PHP library for reading and writing
|
||||
* word processing documents.
|
||||
*
|
||||
* PHPWord is free software distributed under the terms of the GNU Lesser
|
||||
* General Public License version 3 as published by the Free Software Foundation.
|
||||
*
|
||||
* For the full copyright and license information, please read the LICENSE
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2015 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Shared;
|
||||
|
||||
use PhpOffice\PhpWord\Settings;
|
||||
|
||||
/**
|
||||
* XMLWriter wrapper
|
||||
*
|
||||
* @method bool endElement()
|
||||
* @method bool startDocument(string $version = 1.0, string $encoding = null, string $standalone = null)
|
||||
* @method bool startElement(string $name)
|
||||
* @method bool text(string $content)
|
||||
* @method bool writeAttribute(string $name, mixed $value)
|
||||
* @method bool writeElement(string $name, string $content = null)
|
||||
* @method bool writeRaw(string $content)
|
||||
*/
|
||||
class XMLWriter
|
||||
{
|
||||
/** Temporary storage location */
|
||||
const STORAGE_MEMORY = 1;
|
||||
const STORAGE_DISK = 2;
|
||||
|
||||
/**
|
||||
* Internal XMLWriter
|
||||
*
|
||||
* @var \XMLWriter
|
||||
*/
|
||||
private $xmlWriter;
|
||||
|
||||
/**
|
||||
* Temporary filename
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $tempFile = '';
|
||||
|
||||
/**
|
||||
* Create new XMLWriter
|
||||
*
|
||||
* @param int $tempLocation Temporary storage location
|
||||
* @param string $tempFolder Temporary storage folder
|
||||
*/
|
||||
public function __construct($tempLocation = self::STORAGE_MEMORY, $tempFolder = './')
|
||||
{
|
||||
// Create internal XMLWriter
|
||||
$this->xmlWriter = new \XMLWriter();
|
||||
|
||||
// Open temporary storage
|
||||
if ($tempLocation == self::STORAGE_MEMORY) {
|
||||
$this->xmlWriter->openMemory();
|
||||
} else {
|
||||
// Create temporary filename
|
||||
$this->tempFile = tempnam($tempFolder, 'xml');
|
||||
|
||||
// Fallback to memory when temporary file cannot be used
|
||||
// @codeCoverageIgnoreStart
|
||||
// Can't find any test case. Uncomment when found.
|
||||
if (false === $this->tempFile || false === $this->xmlWriter->openUri($this->tempFile)) {
|
||||
$this->xmlWriter->openMemory();
|
||||
}
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
|
||||
// Set xml Compatibility
|
||||
$compatibility = Settings::hasCompatibility();
|
||||
if ($compatibility) {
|
||||
$this->xmlWriter->setIndent(false);
|
||||
$this->xmlWriter->setIndentString('');
|
||||
} else {
|
||||
$this->xmlWriter->setIndent(true);
|
||||
$this->xmlWriter->setIndentString(' ');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
public function __destruct()
|
||||
{
|
||||
// Destruct XMLWriter
|
||||
unset($this->xmlWriter);
|
||||
|
||||
// Unlink temporary files
|
||||
if ($this->tempFile != '') {
|
||||
@unlink($this->tempFile);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Catch function calls (and pass them to internal XMLWriter)
|
||||
*
|
||||
* @param mixed $function
|
||||
* @param mixed $args
|
||||
*
|
||||
* @throws \BadMethodCallException
|
||||
*/
|
||||
public function __call($function, $args)
|
||||
{
|
||||
// Catch exception
|
||||
if (method_exists($this->xmlWriter, $function) === false) {
|
||||
throw new \BadMethodCallException("Method '{$function}' does not exists.");
|
||||
}
|
||||
|
||||
// Run method
|
||||
try {
|
||||
@call_user_func_array(array($this->xmlWriter, $function), $args);
|
||||
} catch (\Exception $ex) {
|
||||
// Do nothing!
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get written data
|
||||
*
|
||||
* @return string XML data
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
if ($this->tempFile == '') {
|
||||
return $this->xmlWriter->outputMemory(true);
|
||||
} else {
|
||||
$this->xmlWriter->flush();
|
||||
return file_get_contents($this->tempFile);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write simple element and attribute(s) block
|
||||
*
|
||||
* There are two options:
|
||||
* 1. If the `$attributes` is an array, then it's an associative array of attributes
|
||||
* 2. If not, then it's a simple attribute-value pair
|
||||
*
|
||||
* @param string $element
|
||||
* @param string|array $attributes
|
||||
* @param string $value
|
||||
* @return void
|
||||
*/
|
||||
public function writeElementBlock($element, $attributes, $value = null)
|
||||
{
|
||||
$this->xmlWriter->startElement($element);
|
||||
if (!is_array($attributes)) {
|
||||
$attributes = array($attributes => $value);
|
||||
}
|
||||
foreach ($attributes as $attribute => $value) {
|
||||
$this->xmlWriter->writeAttribute($attribute, $value);
|
||||
}
|
||||
$this->xmlWriter->endElement();
|
||||
}
|
||||
|
||||
/**
|
||||
* Write element if ...
|
||||
*
|
||||
* @param bool $condition
|
||||
* @param string $element
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function writeElementIf($condition, $element, $attribute = null, $value = null)
|
||||
{
|
||||
if ($condition == true) {
|
||||
if (is_null($attribute)) {
|
||||
$this->xmlWriter->writeElement($element, $value);
|
||||
} else {
|
||||
$this->xmlWriter->startElement($element);
|
||||
$this->xmlWriter->writeAttribute($attribute, $value);
|
||||
$this->xmlWriter->endElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Write attribute if ...
|
||||
*
|
||||
* @param bool $condition
|
||||
* @param string $attribute
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
*/
|
||||
public function writeAttributeIf($condition, $attribute, $value)
|
||||
{
|
||||
if ($condition == true) {
|
||||
$this->xmlWriter->writeAttribute($attribute, $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Style;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
use PhpOffice\Common\Text;
|
||||
|
||||
/**
|
||||
* Abstract style class
|
||||
|
|
@ -161,7 +161,7 @@ abstract class AbstractStyle
|
|||
if (isset($this->aliases[$key])) {
|
||||
$key = $this->aliases[$key];
|
||||
}
|
||||
$method = 'set' . String::removeUnderscorePrefix($key);
|
||||
$method = 'set' . Text::removeUnderscorePrefix($key);
|
||||
if (method_exists($this, $method)) {
|
||||
$this->$method($value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Style;
|
||||
|
||||
use PhpOffice\Common\Text;
|
||||
use PhpOffice\PhpWord\Exception\InvalidStyleException;
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
use PhpOffice\PhpWord\SimpleType\Jc;
|
||||
|
||||
/**
|
||||
|
|
@ -167,7 +167,7 @@ class Paragraph extends Border
|
|||
*/
|
||||
public function setStyleValue($key, $value)
|
||||
{
|
||||
$key = String::removeUnderscorePrefix($key);
|
||||
$key = Text::removeUnderscorePrefix($key);
|
||||
if ('indent' == $key || 'hanging' == $key) {
|
||||
$value = $value * 720;
|
||||
} elseif ('spacing' == $key) {
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ namespace PhpOffice\PhpWord;
|
|||
use PhpOffice\PhpWord\Exception\CopyFileException;
|
||||
use PhpOffice\PhpWord\Exception\CreateTemporaryFileException;
|
||||
use PhpOffice\PhpWord\Exception\Exception;
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
use PhpOffice\PhpWord\Shared\ZipArchive;
|
||||
use Zend\Stdlib\StringUtils;
|
||||
|
||||
class TemplateProcessor
|
||||
{
|
||||
|
|
@ -148,7 +148,7 @@ class TemplateProcessor
|
|||
$macro = '${' . $macro . '}';
|
||||
}
|
||||
|
||||
if (!String::isUTF8($replace)) {
|
||||
if (!StringUtils::isValidUtf8($replace)) {
|
||||
$replace = utf8_encode($replace);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\ODText\Part;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Settings;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Part\AbstractPart as Word2007AbstractPart;
|
||||
|
|
@ -36,7 +36,7 @@ abstract class AbstractPart extends Word2007AbstractPart
|
|||
/**
|
||||
* Write common root attributes.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @return void
|
||||
*/
|
||||
protected function writeCommonRootAttributes(XMLWriter $xmlWriter)
|
||||
|
|
@ -73,7 +73,7 @@ abstract class AbstractPart extends Word2007AbstractPart
|
|||
/**
|
||||
* Write font faces declaration.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @return void
|
||||
*/
|
||||
protected function writeFontFaces(XMLWriter $xmlWriter)
|
||||
|
|
|
|||
|
|
@ -17,12 +17,12 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\ODText\Part;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\Image;
|
||||
use PhpOffice\PhpWord\Element\Table;
|
||||
use PhpOffice\PhpWord\Element\Text;
|
||||
use PhpOffice\PhpWord\Element\TextRun;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
use PhpOffice\PhpWord\Style\Paragraph;
|
||||
|
|
@ -110,7 +110,7 @@ class Content extends AbstractPart
|
|||
*
|
||||
* @since 0.11.0
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @return void
|
||||
*/
|
||||
private function writeAutoStyles(XMLWriter $xmlWriter)
|
||||
|
|
@ -134,7 +134,7 @@ class Content extends AbstractPart
|
|||
/**
|
||||
* Write automatic styles.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @return void
|
||||
*/
|
||||
private function writeTextStyles(XMLWriter $xmlWriter)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\ODText\Part;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
|
||||
/**
|
||||
* ODText meta part writer: meta.xml
|
||||
|
|
@ -86,7 +86,7 @@ class Meta extends AbstractPart
|
|||
/**
|
||||
* Write individual property
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param string $property
|
||||
* @param string $value
|
||||
* @return void
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\ODText\Part;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Settings;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
|
||||
/**
|
||||
|
|
@ -63,7 +63,7 @@ class Styles extends AbstractPart
|
|||
/**
|
||||
* Write default styles.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @return void
|
||||
*/
|
||||
private function writeDefault(XMLWriter $xmlWriter)
|
||||
|
|
@ -108,7 +108,7 @@ class Styles extends AbstractPart
|
|||
/**
|
||||
* Write named styles.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @return void
|
||||
*/
|
||||
private function writeNamed(XMLWriter $xmlWriter)
|
||||
|
|
@ -130,7 +130,7 @@ class Styles extends AbstractPart
|
|||
/**
|
||||
* Write page layout styles.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @return void
|
||||
*/
|
||||
private function writePageLayout(XMLWriter $xmlWriter)
|
||||
|
|
@ -183,7 +183,7 @@ class Styles extends AbstractPart
|
|||
/**
|
||||
* Write master style.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @return void
|
||||
*/
|
||||
private function writeMaster(XMLWriter $xmlWriter)
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\RTF\Element;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
use PhpOffice\Common\Text as CommonText;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
use PhpOffice\PhpWord\Style\Font as FontStyle;
|
||||
use PhpOffice\PhpWord\Style\Paragraph as ParagraphStyle;
|
||||
|
|
@ -112,7 +112,7 @@ abstract class AbstractElement extends HTMLAbstractElement
|
|||
*/
|
||||
protected function writeText($text)
|
||||
{
|
||||
return String::toUnicode($text);
|
||||
return CommonText::toUnicode($text);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,9 +17,9 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
|
||||
|
||||
use PhpOffice\Common\Text as CommonText;
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\AbstractElement as Element;
|
||||
use PhpOffice\PhpWord\Shared\String;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
/**
|
||||
* Abstract element writer
|
||||
|
|
@ -31,7 +31,7 @@ abstract class AbstractElement
|
|||
/**
|
||||
* XML writer
|
||||
*
|
||||
* @var \PhpOffice\PhpWord\Shared\XMLWriter
|
||||
* @var \PhpOffice\Common\XMLWriter
|
||||
*/
|
||||
private $xmlWriter;
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ abstract class AbstractElement
|
|||
/**
|
||||
* Create new instance
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Element\AbstractElement $element
|
||||
* @param bool $withoutP
|
||||
*/
|
||||
|
|
@ -71,7 +71,7 @@ abstract class AbstractElement
|
|||
/**
|
||||
* Get XML Writer
|
||||
*
|
||||
* @return \PhpOffice\PhpWord\Shared\XMLWriter
|
||||
* @return \PhpOffice\Common\XMLWriter
|
||||
*/
|
||||
protected function getXmlWriter()
|
||||
{
|
||||
|
|
@ -167,6 +167,6 @@ abstract class AbstractElement
|
|||
*/
|
||||
protected function getText($text)
|
||||
{
|
||||
return String::controlCharacterPHP2OOXML($text);
|
||||
return CommonText::controlCharacterPHP2OOXML($text);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\AbstractContainer as ContainerElement;
|
||||
use PhpOffice\PhpWord\Element\AbstractElement as Element;
|
||||
use PhpOffice\PhpWord\Element\TextBreak as TextBreakElement;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
/**
|
||||
* Container element writer (section, textrun, header, footnote, cell, etc.)
|
||||
|
|
@ -73,7 +73,7 @@ class Container extends AbstractElement
|
|||
/**
|
||||
* Write individual element
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Element\AbstractElement $element
|
||||
* @param bool $withoutP
|
||||
* @return string
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\FormField as FormFieldElement;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
/**
|
||||
* FormField element writer
|
||||
|
|
@ -107,7 +107,7 @@ class FormField extends Text
|
|||
* Write textinput.
|
||||
*
|
||||
* @link http://www.datypic.com/sc/ooxml/t-w_CT_FFTextInput.html
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Element\FormField $element
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -124,7 +124,7 @@ class FormField extends Text
|
|||
* Write checkbox.
|
||||
*
|
||||
* @link http://www.datypic.com/sc/ooxml/t-w_CT_FFCheckBox.html
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Element\FormField $element
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -148,7 +148,7 @@ class FormField extends Text
|
|||
* Write dropdown.
|
||||
*
|
||||
* @link http://www.datypic.com/sc/ooxml/t-w_CT_FFDDList.html
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Element\FormField $element
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\Image as ImageElement;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Style\Image as ImageStyleWriter;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\SDT as SDTElement;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
/**
|
||||
* Structured document tag element writer
|
||||
|
|
@ -73,7 +73,7 @@ class SDT extends Text
|
|||
* Write combo box.
|
||||
*
|
||||
* @link http://www.datypic.com/sc/ooxml/t-w_CT_SdtComboBox.html
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Element\SDT $element
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -93,7 +93,7 @@ class SDT extends Text
|
|||
* Write drop down list.
|
||||
*
|
||||
* @link http://www.datypic.com/sc/ooxml/t-w_CT_SdtDropDownList.html
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Element\SDT $element
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -106,7 +106,7 @@ class SDT extends Text
|
|||
* Write date.
|
||||
*
|
||||
* @link http://www.datypic.com/sc/ooxml/t-w_CT_SdtDate.html
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Element\SDT $element
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\Shape as ShapeElement;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style\Shape as ShapeStyle;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Style\Shape as ShapeStyleWriter;
|
||||
|
||||
|
|
@ -78,7 +78,7 @@ class Shape extends AbstractElement
|
|||
/**
|
||||
* Write arc.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Style\Shape $style
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -93,7 +93,7 @@ class Shape extends AbstractElement
|
|||
/**
|
||||
* Write curve.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Style\Shape $style
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -109,7 +109,7 @@ class Shape extends AbstractElement
|
|||
/**
|
||||
* Write line.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Style\Shape $style
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -124,7 +124,7 @@ class Shape extends AbstractElement
|
|||
/**
|
||||
* Write polyline.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Style\Shape $style
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -136,7 +136,7 @@ class Shape extends AbstractElement
|
|||
/**
|
||||
* Write rectangle.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Style\Shape $style
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\TOC as TOCElement;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style\Font;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Style\Font as FontStyleWriter;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Style\Paragraph as ParagraphStyleWriter;
|
||||
|
|
@ -66,7 +66,7 @@ class TOC extends AbstractElement
|
|||
/**
|
||||
* Write title
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Element\TOC $element
|
||||
* @param \PhpOffice\PhpWord\Element\Title $title
|
||||
* @param bool $writeFieldMark
|
||||
|
|
@ -135,7 +135,7 @@ class TOC extends AbstractElement
|
|||
/**
|
||||
* Write style
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Element\TOC $element
|
||||
* @param int $indent
|
||||
* @return void
|
||||
|
|
@ -182,7 +182,7 @@ class TOC extends AbstractElement
|
|||
/**
|
||||
* Write TOC Field.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Element\TOC $element
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,10 +17,10 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Element;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\Cell as CellElement;
|
||||
use PhpOffice\PhpWord\Element\Row as RowElement;
|
||||
use PhpOffice\PhpWord\Element\Table as TableElement;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style\Cell as CellStyle;
|
||||
use PhpOffice\PhpWord\Style\Row as RowStyle;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Style\Cell as CellStyleWriter;
|
||||
|
|
@ -73,7 +73,7 @@ class Table extends AbstractElement
|
|||
/**
|
||||
* Write column.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Element\Table $element
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -110,7 +110,7 @@ class Table extends AbstractElement
|
|||
/**
|
||||
* Write row.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Element\Row $row
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -137,7 +137,7 @@ class Table extends AbstractElement
|
|||
/**
|
||||
* Write cell.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Element\Cell $cell
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,8 +17,9 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Part;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Exception\Exception;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Settings;
|
||||
use PhpOffice\PhpWord\Writer\AbstractWriter;
|
||||
|
||||
/**
|
||||
|
|
@ -75,7 +76,7 @@ abstract class AbstractPart
|
|||
/**
|
||||
* Get XML Writer
|
||||
*
|
||||
* @return \PhpOffice\PhpWord\Shared\XMLWriter
|
||||
* @return \PhpOffice\Common\XMLWriter
|
||||
*/
|
||||
protected function getXmlWriter()
|
||||
{
|
||||
|
|
@ -86,9 +87,9 @@ abstract class AbstractPart
|
|||
}
|
||||
}
|
||||
if ($useDiskCaching) {
|
||||
return new XMLWriter(XMLWriter::STORAGE_DISK, $this->parentWriter->getDiskCachingDirectory());
|
||||
return new XMLWriter(XMLWriter::STORAGE_DISK, $this->parentWriter->getDiskCachingDirectory(), Settings::hasCompatibility());
|
||||
} else {
|
||||
return new XMLWriter(XMLWriter::STORAGE_MEMORY);
|
||||
return new XMLWriter(XMLWriter::STORAGE_MEMORY, './', Settings::hasCompatibility());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Part;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\Chart as ChartElement;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
/**
|
||||
* Word2007 chart part writer: word/charts/chartx.xml
|
||||
|
|
@ -96,7 +96,7 @@ class Chart extends AbstractPart
|
|||
* Write chart
|
||||
*
|
||||
* @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_Chart.html
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @return void
|
||||
*/
|
||||
private function writeChart(XMLWriter $xmlWriter)
|
||||
|
|
@ -121,7 +121,7 @@ class Chart extends AbstractPart
|
|||
* @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_AreaChart.html
|
||||
* @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_RadarChart.html
|
||||
* @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_ScatterChart.html
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @return void
|
||||
*/
|
||||
private function writePlotArea(XMLWriter $xmlWriter)
|
||||
|
|
@ -180,7 +180,7 @@ class Chart extends AbstractPart
|
|||
/**
|
||||
* Write series.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param bool $scatter
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -219,7 +219,7 @@ class Chart extends AbstractPart
|
|||
/**
|
||||
* Write series items.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param string $type
|
||||
* @param array $values
|
||||
* @return void
|
||||
|
|
@ -258,7 +258,7 @@ class Chart extends AbstractPart
|
|||
* Write axis
|
||||
*
|
||||
* @link http://www.datypic.com/sc/ooxml/t-draw-chart_CT_CatAx.html
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param string $type
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -301,7 +301,7 @@ class Chart extends AbstractPart
|
|||
* Write shape
|
||||
*
|
||||
* @link http://www.datypic.com/sc/ooxml/t-a_CT_ShapeProperties.html
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param bool $line
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Part;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
|
||||
/**
|
||||
* Word2007 contenttypes part writer: [Content_Types].xml
|
||||
|
|
@ -79,7 +79,7 @@ class ContentTypes extends AbstractPart
|
|||
/**
|
||||
* Write content types element
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter XML Writer
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter XML Writer
|
||||
* @param array $parts
|
||||
* @param boolean $isDefault
|
||||
* @return void
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Part;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\Section;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Element\Container;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Style\Section as SectionStyleWriter;
|
||||
|
||||
|
|
@ -81,7 +81,7 @@ class Document extends AbstractPart
|
|||
/**
|
||||
* Write begin section.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Element\Section $section
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -97,7 +97,7 @@ class Document extends AbstractPart
|
|||
/**
|
||||
* Write end section.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Element\Section $section
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Part;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Element\Footnote;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Element\Container;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Style\Paragraph as ParagraphStyleWriter;
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ class Footnotes extends AbstractPart
|
|||
/**
|
||||
* Write note item.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Element\Footnote|\PhpOffice\PhpWord\Element\Endnote $element
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Part;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
use PhpOffice\PhpWord\Style\Numbering as NumberingStyle;
|
||||
use PhpOffice\PhpWord\Style\NumberingLevel;
|
||||
|
|
@ -97,7 +97,7 @@ class Numbering extends AbstractPart
|
|||
/**
|
||||
* Write level.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Style\NumberingLevel $level
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -138,7 +138,7 @@ class Numbering extends AbstractPart
|
|||
*
|
||||
* @since 0.11.0
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Style\NumberingLevel $level
|
||||
* @return void
|
||||
* @todo Use paragraph style writer
|
||||
|
|
@ -171,7 +171,7 @@ class Numbering extends AbstractPart
|
|||
*
|
||||
* @since 0.11.0
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Style\NumberingLevel $level
|
||||
* @return void
|
||||
* @todo Use font style writer
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Part;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Exception\Exception;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
/**
|
||||
* Word2007 main relationship writer: _rels/.rels
|
||||
|
|
@ -49,7 +49,7 @@ class Rels extends AbstractPart
|
|||
/**
|
||||
* Write relationships.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param array $xmlRels
|
||||
* @param array $mediaRels
|
||||
* @param int $relId
|
||||
|
|
@ -77,7 +77,7 @@ class Rels extends AbstractPart
|
|||
/**
|
||||
* Write media relationships.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param int $relId
|
||||
* @param array $mediaRel
|
||||
* @return void
|
||||
|
|
@ -103,7 +103,7 @@ class Rels extends AbstractPart
|
|||
* Format:
|
||||
* <Relationship Id="rId..." Type="http://..." Target="....xml" TargetMode="..." />
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param int $relId Relationship ID
|
||||
* @param string $type Relationship type
|
||||
* @param string $target Relationship target
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class Settings extends AbstractPart
|
|||
/**
|
||||
* Write indivual setting, recursive to any child settings.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param string $settingKey
|
||||
* @param array|string $settingValue
|
||||
* @return void
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Part;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Settings as PhpWordSettings;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
use PhpOffice\PhpWord\Style\Font as FontStyle;
|
||||
use PhpOffice\PhpWord\Style\Paragraph as ParagraphStyle;
|
||||
|
|
@ -77,7 +77,7 @@ class Styles extends AbstractPart
|
|||
/**
|
||||
* Write default font and other default styles.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Style\AbstractStyle[] $styles
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -142,7 +142,7 @@ class Styles extends AbstractPart
|
|||
/**
|
||||
* Write font style.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param string $styleName
|
||||
* @param \PhpOffice\PhpWord\Style\Font $style
|
||||
* @return void
|
||||
|
|
@ -196,7 +196,7 @@ class Styles extends AbstractPart
|
|||
/**
|
||||
* Write paragraph style.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param string $styleName
|
||||
* @param \PhpOffice\PhpWord\Style\Paragraph $style
|
||||
* @return void
|
||||
|
|
@ -229,7 +229,7 @@ class Styles extends AbstractPart
|
|||
/**
|
||||
* Write table style.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param string $styleName
|
||||
* @param \PhpOffice\PhpWord\Style\Table $style
|
||||
* @return void
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Style;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Settings;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
|
||||
/**
|
||||
* Style writer
|
||||
|
|
@ -30,7 +30,7 @@ abstract class AbstractStyle
|
|||
/**
|
||||
* XML writer
|
||||
*
|
||||
* @var \PhpOffice\PhpWord\Shared\XMLWriter
|
||||
* @var \PhpOffice\Common\XMLWriter
|
||||
*/
|
||||
private $xmlWriter;
|
||||
|
||||
|
|
@ -49,7 +49,7 @@ abstract class AbstractStyle
|
|||
/**
|
||||
* Create new instance.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param string|\PhpOffice\PhpWord\Style\AbstractStyle $style
|
||||
*/
|
||||
public function __construct(XMLWriter $xmlWriter, $style = null)
|
||||
|
|
@ -61,7 +61,7 @@ abstract class AbstractStyle
|
|||
/**
|
||||
* Get XML Writer
|
||||
*
|
||||
* @return \PhpOffice\PhpWord\Shared\XMLWriter
|
||||
* @return \PhpOffice\Common\XMLWriter
|
||||
*/
|
||||
protected function getXmlWriter()
|
||||
{
|
||||
|
|
@ -106,7 +106,7 @@ abstract class AbstractStyle
|
|||
/**
|
||||
* Write child style.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param string $name
|
||||
* @param mixed $value
|
||||
* @return void
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Style;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style\Frame as FrameStyle;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Element\ParagraphAlignment;
|
||||
|
||||
|
|
@ -105,7 +105,7 @@ class Frame extends AbstractStyle
|
|||
/**
|
||||
* Write wrap.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Style\Frame $style
|
||||
* @param string $wrap
|
||||
* @return void
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Style;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
|
||||
/**
|
||||
* Margin border style writer
|
||||
|
|
@ -72,7 +72,7 @@ class MarginBorder extends AbstractStyle
|
|||
/**
|
||||
* Write side.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param string $side
|
||||
* @param int $width
|
||||
* @param string $color
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Style;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style;
|
||||
use PhpOffice\PhpWord\Style\Paragraph as ParagraphStyle;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Element\ParagraphAlignment;
|
||||
|
|
@ -138,7 +138,7 @@ class Paragraph extends AbstractStyle
|
|||
/**
|
||||
* Write tabs.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Style\Tab[] $tabs
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -157,7 +157,7 @@ class Paragraph extends AbstractStyle
|
|||
/**
|
||||
* Write numbering.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param array $numbering
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007\Style;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\Style\Table as TableStyle;
|
||||
use PhpOffice\PhpWord\Writer\Word2007\Element\TableAlignment;
|
||||
|
||||
|
|
@ -60,7 +60,7 @@ class Table extends AbstractStyle
|
|||
/**
|
||||
* Write full style.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Style\Table $style
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -97,7 +97,7 @@ class Table extends AbstractStyle
|
|||
/**
|
||||
* Write width.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param int $width
|
||||
* @param string $unit
|
||||
* @return void
|
||||
|
|
@ -113,7 +113,7 @@ class Table extends AbstractStyle
|
|||
/**
|
||||
* Write margin.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Style\Table $style
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -133,7 +133,7 @@ class Table extends AbstractStyle
|
|||
/**
|
||||
* Write border.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Style\Table $style
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -154,7 +154,7 @@ class Table extends AbstractStyle
|
|||
/**
|
||||
* Write row style.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Style\Table $style
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -174,7 +174,7 @@ class Table extends AbstractStyle
|
|||
/**
|
||||
* Write shading.
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\Common\XMLWriter $xmlWriter
|
||||
* @param \PhpOffice\PhpWord\Style\Table $style
|
||||
* @return void
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -1,73 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of PHPWord - A pure PHP library for reading and writing
|
||||
* word processing documents.
|
||||
*
|
||||
* PHPWord is free software distributed under the terms of the GNU Lesser
|
||||
* General Public License version 3 as published by the Free Software Foundation.
|
||||
*
|
||||
* For the full copyright and license information, please read the LICENSE
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2015 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Shared;
|
||||
|
||||
/**
|
||||
* Test class for PhpOffice\PhpWord\Shared\String
|
||||
*
|
||||
* @coversDefaultClass \PhpOffice\PhpWord\Shared\String
|
||||
* @runTestsInSeparateProcesses
|
||||
*/
|
||||
class StringTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Is UTF8
|
||||
*/
|
||||
public function testIsUTF8()
|
||||
{
|
||||
$this->assertTrue(String::isUTF8(''));
|
||||
$this->assertTrue(String::isUTF8('éééé'));
|
||||
$this->assertFalse(String::isUTF8(utf8_decode('éééé')));
|
||||
}
|
||||
|
||||
/**
|
||||
* OOXML to PHP control character
|
||||
*/
|
||||
public function testControlCharacterOOXML2PHP()
|
||||
{
|
||||
$this->assertEquals('', String::controlCharacterOOXML2PHP(''));
|
||||
$this->assertEquals(chr(0x08), String::controlCharacterOOXML2PHP('_x0008_'));
|
||||
}
|
||||
|
||||
/**
|
||||
* PHP to OOXML control character
|
||||
*/
|
||||
public function testControlCharacterPHP2OOXML()
|
||||
{
|
||||
$this->assertEquals('', String::controlCharacterPHP2OOXML(''));
|
||||
$this->assertEquals('_x0008_', String::controlCharacterPHP2OOXML(chr(0x08)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test unicode conversion
|
||||
*/
|
||||
public function testToUnicode()
|
||||
{
|
||||
$this->assertEquals('a', String::toUnicode('a'));
|
||||
$this->assertEquals('\uc0{\u8364}', String::toUnicode('€'));
|
||||
$this->assertEquals('\uc0{\u233}', String::toUnicode('é'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test remove underscore prefix
|
||||
*/
|
||||
public function testRemoveUnderscorePrefix()
|
||||
{
|
||||
$this->assertEquals('item', String::removeUnderscorePrefix('_item'));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,73 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of PHPWord - A pure PHP library for reading and writing
|
||||
* word processing documents.
|
||||
*
|
||||
* PHPWord is free software distributed under the terms of the GNU Lesser
|
||||
* General Public License version 3 as published by the Free Software Foundation.
|
||||
*
|
||||
* For the full copyright and license information, please read the LICENSE
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2015 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Shared;
|
||||
|
||||
/**
|
||||
* Test class for PhpOffice\PhpWord\Shared\XMLReader
|
||||
*
|
||||
* @runTestsInSeparateProcesses
|
||||
* @since 0.10.0
|
||||
*/
|
||||
class XMLReaderTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test get DOMDocument from ZipArchive exception
|
||||
*
|
||||
* @expectedException \PhpOffice\PhpWord\Exception\Exception
|
||||
* @expectedExceptionMessage Cannot find archive file.
|
||||
*/
|
||||
public function testGetDomFromZipException()
|
||||
{
|
||||
$filename = __DIR__ . '/../_files/documents/foo.zip';
|
||||
$object = new XMLReader();
|
||||
$object->getDomFromZip($filename, 'yadayadaya');
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get DOMDocument from ZipArchive returns false
|
||||
*/
|
||||
public function testGetDomFromZipReturnsFalse()
|
||||
{
|
||||
$filename = __DIR__ . '/../_files/documents/reader.docx.zip';
|
||||
$object = new XMLReader();
|
||||
$this->assertFalse($object->getDomFromZip($filename, 'yadayadaya'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get elements returns empty
|
||||
*/
|
||||
public function testGetElementsReturnsEmpty()
|
||||
{
|
||||
$object = new XMLReader();
|
||||
$this->assertEquals(array(), $object->getElements('w:document'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test get element returns null
|
||||
*/
|
||||
public function testGetElementReturnsNull()
|
||||
{
|
||||
$filename = __DIR__ . '/../_files/documents/reader.docx.zip';
|
||||
|
||||
$object = new XMLReader();
|
||||
$object->getDomFromZip($filename, '[Content_Types].xml');
|
||||
$element = $object->getElements('*')->item(0);
|
||||
|
||||
$this->assertNull($object->getElement('yadayadaya', $element));
|
||||
}
|
||||
}
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is part of PHPWord - A pure PHP library for reading and writing
|
||||
* word processing documents.
|
||||
*
|
||||
* PHPWord is free software distributed under the terms of the GNU Lesser
|
||||
* General Public License version 3 as published by the Free Software Foundation.
|
||||
*
|
||||
* For the full copyright and license information, please read the LICENSE
|
||||
* file that was distributed with this source code. For the full list of
|
||||
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
|
||||
*
|
||||
* @link https://github.com/PHPOffice/PHPWord
|
||||
* @copyright 2010-2015 PHPWord contributors
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord\Shared;
|
||||
|
||||
use PhpOffice\PhpWord\Settings;
|
||||
|
||||
/**
|
||||
* Test class for PhpOffice\PhpWord\Shared\XMLWriter
|
||||
*/
|
||||
class XMLWriterTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Test method exception
|
||||
*
|
||||
* @expectedException \BadMethodCallException
|
||||
* @expectedExceptionMessage Method 'foo' does not exists.
|
||||
*/
|
||||
public function testCallException()
|
||||
{
|
||||
Settings::setCompatibility(false);
|
||||
$object = new XMLWriter();
|
||||
$object->foo();
|
||||
}
|
||||
}
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
namespace PhpOffice\PhpWord\Writer\ODText;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
|
||||
/**
|
||||
* Test class for PhpOffice\PhpWord\Writer\ODText\Element subnamespace
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
namespace PhpOffice\PhpWord\Writer\ODText;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
|
||||
/**
|
||||
* Test class for PhpOffice\PhpWord\Writer\ODText\Style subnamespace
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class TCPDFTest extends \PHPUnit_Framework_TestCase
|
|||
$section->addText(htmlspecialchars('Test 1', ENT_COMPAT, 'UTF-8'));
|
||||
|
||||
$rendererName = Settings::PDF_RENDERER_TCPDF;
|
||||
$rendererLibraryPath = realpath(PHPWORD_TESTS_BASE_DIR . '/../vendor/tecnick.com/tcpdf');
|
||||
$rendererLibraryPath = realpath(PHPWORD_TESTS_BASE_DIR . '/../vendor/tecnickcom/tcpdf');
|
||||
Settings::setPdfRenderer($rendererName, $rendererLibraryPath);
|
||||
$writer = new PDF($phpWord);
|
||||
$writer->save($file);
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
*/
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007;
|
||||
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
use PhpOffice\PhpWord\PhpWord;
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\PhpWord\TestHelperDOCX;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
*/
|
||||
namespace PhpOffice\PhpWord\Writer\Word2007;
|
||||
|
||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||
use PhpOffice\Common\XMLWriter;
|
||||
|
||||
/**
|
||||
* Test class for PhpOffice\PhpWord\Writer\Word2007\Style subnamespace
|
||||
|
|
|
|||
Loading…
Reference in New Issue