Drop most deprecations
This commit is contained in:
parent
c5e7a535e6
commit
b9f1151bc6
|
|
@ -5,7 +5,7 @@ include_once 'Sample_Header.php';
|
|||
// New Word document
|
||||
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$phpWord->getProtection()->setEditing('forms');
|
||||
$phpWord->getSettings()->getDocumentProtection()->setEditing('forms');
|
||||
|
||||
// New section
|
||||
$section = $phpWord->addSection();
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ $tableStyle = ['borderSize' => 6, 'borderColor' => '000000', 'width' => 5000, 'u
|
|||
$table = $section->addTable($tableStyle);
|
||||
$cellHCentered = ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER];
|
||||
$cellHEnd = ['alignment' => \PhpOffice\PhpWord\SimpleType\Jc::END];
|
||||
$cellVCentered = ['valign' => \PhpOffice\PhpWord\Style\Cell::VALIGN_CENTER];
|
||||
$cellVCentered = ['valign' => \PhpOffice\PhpWord\SimpleType\VerticalJc::CENTER];
|
||||
|
||||
//Vidually bidirectinal table
|
||||
$table->addRow();
|
||||
|
|
|
|||
|
|
@ -285,36 +285,4 @@ abstract class AbstractContainer extends AbstractElement
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create textrun element.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @param mixed $paragraphStyle
|
||||
*
|
||||
* @return \PhpOffice\PhpWord\Element\TextRun
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function createTextRun($paragraphStyle = null)
|
||||
{
|
||||
return $this->addTextRun($paragraphStyle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Create footnote element.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @param mixed $paragraphStyle
|
||||
*
|
||||
* @return \PhpOffice\PhpWord\Element\Footnote
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function createFootnote($paragraphStyle = null)
|
||||
{
|
||||
return $this->addFootnote($paragraphStyle);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,32 +60,4 @@ class Footnote extends AbstractContainer
|
|||
{
|
||||
return $this->paragraphStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Footnote Reference ID.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getReferenceId()
|
||||
{
|
||||
return $this->getRelationId();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Footnote Reference ID.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param int $rId
|
||||
*/
|
||||
public function setReferenceId($rId): void
|
||||
{
|
||||
$this->setRelationId($rId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -554,28 +554,4 @@ class Image extends AbstractElement
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get is watermark.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getIsWatermark()
|
||||
{
|
||||
return $this->isWatermark();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get is memory image.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getIsMemImage()
|
||||
{
|
||||
return $this->isMemImage();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,48 +126,6 @@ class Link extends AbstractElement
|
|||
return $this->paragraphStyle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get link target.
|
||||
*
|
||||
* @deprecated 0.12.0
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getTarget()
|
||||
{
|
||||
return $this->source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Link source.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getLinkSrc()
|
||||
{
|
||||
return $this->getSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Link name.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getLinkName()
|
||||
{
|
||||
return $this->getText();
|
||||
}
|
||||
|
||||
/**
|
||||
* is internal.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -136,32 +136,4 @@ class OLEObject extends AbstractElement
|
|||
{
|
||||
$this->imageRelationId = $rId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Object ID.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getObjectId()
|
||||
{
|
||||
return $this->relationId + 1325353440;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Object ID.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @param int $objId
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function setObjectId($objId): void
|
||||
{
|
||||
$this->relationId = $objId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,20 +152,6 @@ class Section extends AbstractContainer
|
|||
return $this->footnoteProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the footnote properties.
|
||||
*
|
||||
* @deprecated Use the `getFootnoteProperties` method instead
|
||||
*
|
||||
* @return FootnoteProperties
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getFootnotePropoperties()
|
||||
{
|
||||
return $this->footnoteProperties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the footnote properties.
|
||||
*
|
||||
|
|
@ -230,78 +216,4 @@ class Section extends AbstractContainer
|
|||
|
||||
throw new Exception('Invalid header/footer type.');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set section style.
|
||||
*
|
||||
* @deprecated 0.12.0
|
||||
*
|
||||
* @param array $settings
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function setSettings($settings = null): void
|
||||
{
|
||||
$this->setStyle($settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get section style.
|
||||
*
|
||||
* @deprecated 0.12.0
|
||||
*
|
||||
* @return \PhpOffice\PhpWord\Style\Section
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getSettings()
|
||||
{
|
||||
return $this->getStyle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create header.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @return Header
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function createHeader()
|
||||
{
|
||||
return $this->addHeader();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create footer.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @return Footer
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function createFooter()
|
||||
{
|
||||
return $this->addFooter();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get footer.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @return Footer
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getFooter()
|
||||
{
|
||||
if (empty($this->footers)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $this->footers[1];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -207,166 +207,4 @@ class Media
|
|||
{
|
||||
self::$elements = [];
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new Section Media Element.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @param string $src
|
||||
* @param string $type
|
||||
* @param \PhpOffice\PhpWord\Element\Image $image
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function addSectionMediaElement($src, $type, ?Image $image = null)
|
||||
{
|
||||
return self::addElement('section', $type, $src, $image);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new Section Link Element.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @param string $linkSrc
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function addSectionLinkElement($linkSrc)
|
||||
{
|
||||
return self::addElement('section', 'link', $linkSrc);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Section Media Elements.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function getSectionMediaElements($key = null)
|
||||
{
|
||||
return self::getElements('section', $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Section Media Elements Count.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function countSectionMediaElements($key = null)
|
||||
{
|
||||
return self::countElements('section', $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new Header Media Element.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @param int $headerCount
|
||||
* @param string $src
|
||||
* @param \PhpOffice\PhpWord\Element\Image $image
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function addHeaderMediaElement($headerCount, $src, ?Image $image = null)
|
||||
{
|
||||
return self::addElement("header{$headerCount}", 'image', $src, $image);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Header Media Elements Count.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function countHeaderMediaElements($key)
|
||||
{
|
||||
return self::countElements($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Header Media Elements.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function getHeaderMediaElements()
|
||||
{
|
||||
return self::getElements('header');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add new Footer Media Element.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @param int $footerCount
|
||||
* @param string $src
|
||||
* @param \PhpOffice\PhpWord\Element\Image $image
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function addFooterMediaElement($footerCount, $src, ?Image $image = null)
|
||||
{
|
||||
return self::addElement("footer{$footerCount}", 'image', $src, $image);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Footer Media Elements Count.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @param string $key
|
||||
*
|
||||
* @return int
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function countFooterMediaElements($key)
|
||||
{
|
||||
return self::countElements($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Footer Media Elements.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function getFooterMediaElements()
|
||||
{
|
||||
return self::getElements('footer');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,27 +44,6 @@ use PhpOffice\PhpWord\Exception\Exception;
|
|||
*/
|
||||
class PhpWord
|
||||
{
|
||||
/**
|
||||
* Default font settings.
|
||||
*
|
||||
* @deprecated 0.11.0 Use Settings constants
|
||||
*
|
||||
* @const string|int
|
||||
*/
|
||||
const DEFAULT_FONT_NAME = Settings::DEFAULT_FONT_NAME;
|
||||
/**
|
||||
* @deprecated 0.11.0 Use Settings constants
|
||||
*/
|
||||
const DEFAULT_FONT_SIZE = Settings::DEFAULT_FONT_SIZE;
|
||||
/**
|
||||
* @deprecated 0.11.0 Use Settings constants
|
||||
*/
|
||||
const DEFAULT_FONT_COLOR = Settings::DEFAULT_FONT_COLOR;
|
||||
/**
|
||||
* @deprecated 0.11.0 Use Settings constants
|
||||
*/
|
||||
const DEFAULT_FONT_CONTENT_TYPE = Settings::DEFAULT_FONT_CONTENT_TYPE;
|
||||
|
||||
/**
|
||||
* Collection of sections.
|
||||
*
|
||||
|
|
@ -179,21 +158,6 @@ class PhpWord
|
|||
return $this->metadata['DocInfo'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get protection.
|
||||
*
|
||||
* @return \PhpOffice\PhpWord\Metadata\Protection
|
||||
*
|
||||
* @since 0.12.0
|
||||
* @deprecated Get the Document protection from PhpWord->getSettings()->getDocumentProtection();
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getProtection()
|
||||
{
|
||||
return $this->getSettings()->getDocumentProtection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get compatibility.
|
||||
*
|
||||
|
|
@ -324,26 +288,6 @@ class PhpWord
|
|||
return Style::setDefaultParagraphStyle($styles);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load template by filename.
|
||||
*
|
||||
* @deprecated 0.12.0 Use `new TemplateProcessor($documentTemplate)` instead.
|
||||
*
|
||||
* @param string $filename Fully qualified filename
|
||||
*
|
||||
* @return TemplateProcessor
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function loadTemplate($filename)
|
||||
{
|
||||
if (file_exists($filename)) {
|
||||
return new TemplateProcessor($filename);
|
||||
}
|
||||
|
||||
throw new Exception("Template file {$filename} not found.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Save to file or download.
|
||||
*
|
||||
|
|
@ -381,52 +325,4 @@ class PhpWord
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create new section.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @param array $settings
|
||||
*
|
||||
* @return \PhpOffice\PhpWord\Element\Section
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function createSection($settings = null)
|
||||
{
|
||||
return $this->addSection($settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get document properties object.
|
||||
*
|
||||
* @deprecated 0.12.0
|
||||
*
|
||||
* @return \PhpOffice\PhpWord\Metadata\DocInfo
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getDocumentProperties()
|
||||
{
|
||||
return $this->getDocInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set document properties object.
|
||||
*
|
||||
* @deprecated 0.12.0
|
||||
*
|
||||
* @param \PhpOffice\PhpWord\Metadata\DocInfo $documentProperties
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function setDocumentProperties($documentProperties)
|
||||
{
|
||||
$this->metadata['Document'] = $documentProperties;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,16 +109,4 @@ abstract class AbstractReader implements ReaderInterface
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read data only?
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getReadDataOnly()
|
||||
{
|
||||
return $this->isReadDataOnly();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class Settings
|
|||
*/
|
||||
const ZIPARCHIVE = 'ZipArchive';
|
||||
const PCLZIP = 'PclZip';
|
||||
const OLD_LIB = 'PhpOffice\\PhpWord\\Shared\\ZipArchive'; // @deprecated 0.11
|
||||
const OLD_LIB = \PhpOffice\PhpWord\Shared\ZipArchive::class; // @deprecated 0.11
|
||||
|
||||
/**
|
||||
* PDF rendering libraries.
|
||||
|
|
@ -480,16 +480,4 @@ class Settings
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the compatibility option used by the XMLWriter.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public static function getCompatibility()
|
||||
{
|
||||
return self::hasCompatibility();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,6 +170,11 @@ abstract class AbstractStyle
|
|||
if (isset($this->aliases[$key])) {
|
||||
$key = $this->aliases[$key];
|
||||
}
|
||||
|
||||
if ($key === 'align') {
|
||||
$key = 'alignment';
|
||||
}
|
||||
|
||||
$method = 'set' . Text::removeUnderscorePrefix($key);
|
||||
if (method_exists($this, $method)) {
|
||||
$this->$method($value);
|
||||
|
|
@ -350,18 +355,4 @@ abstract class AbstractStyle
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set style using associative array.
|
||||
*
|
||||
* @deprecated 0.11.0
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function setArrayStyle(array $style = [])
|
||||
{
|
||||
return $this->setStyleByArray($style);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,27 +25,6 @@ use PhpOffice\PhpWord\SimpleType\VerticalJc;
|
|||
*/
|
||||
class Cell extends Border
|
||||
{
|
||||
/**
|
||||
* Vertical alignment constants.
|
||||
*
|
||||
* @const string
|
||||
*
|
||||
* @deprecated Use \PhpOffice\PhpWord\SimpleType\VerticalJc::TOP instead
|
||||
*/
|
||||
const VALIGN_TOP = 'top';
|
||||
/**
|
||||
* @deprecated Use \PhpOffice\PhpWord\SimpleType\VerticalJc::CENTER instead
|
||||
*/
|
||||
const VALIGN_CENTER = 'center';
|
||||
/**
|
||||
* @deprecated Use \PhpOffice\PhpWord\SimpleType\VerticalJc::BOTTOM instead
|
||||
*/
|
||||
const VALIGN_BOTTOM = 'bottom';
|
||||
/**
|
||||
* @deprecated Use \PhpOffice\PhpWord\SimpleType\VerticalJc::BOTH instead
|
||||
*/
|
||||
const VALIGN_BOTH = 'both';
|
||||
|
||||
//Text direction constants
|
||||
/**
|
||||
* Left to Right, Top to Bottom.
|
||||
|
|
@ -333,16 +312,4 @@ class Cell extends Border
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get default border color.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getDefaultBorderColor()
|
||||
{
|
||||
return self::DEFAULT_BORDER_COLOR;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,14 +33,6 @@ class Font extends AbstractStyle
|
|||
const UNDERLINE_DASHLONG = 'dashLong';
|
||||
const UNDERLINE_DASHLONGHEAVY = 'dashLongHeavy';
|
||||
const UNDERLINE_DOUBLE = 'dbl';
|
||||
/**
|
||||
* @deprecated use UNDERLINE_DOTHASH instead, TODO remove in version 1.0
|
||||
*/
|
||||
const UNDERLINE_DOTHASH = 'dotDash'; // Incorrect spelling, for backwards compatibility
|
||||
/**
|
||||
* @deprecated use UNDERLINE_DOTDASHHEAVY instead, TODO remove in version 1.0
|
||||
*/
|
||||
const UNDERLINE_DOTHASHHEAVY = 'dotDashHeavy'; // Incorrect spelling, for backwards compatibility
|
||||
const UNDERLINE_DOTDASH = 'dotDash';
|
||||
const UNDERLINE_DOTDASHHEAVY = 'dotDashHeavy';
|
||||
const UNDERLINE_DOTDOTDASH = 'dotDotDash';
|
||||
|
|
@ -907,78 +899,6 @@ class Font extends AbstractStyle
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bold.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getBold()
|
||||
{
|
||||
return $this->isBold();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get italic.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getItalic()
|
||||
{
|
||||
return $this->isItalic();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get superscript.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getSuperScript()
|
||||
{
|
||||
return $this->isSuperScript();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get subscript.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getSubScript()
|
||||
{
|
||||
return $this->isSubScript();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get strikethrough.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getStrikethrough()
|
||||
{
|
||||
return $this->isStrikethrough();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get paragraph style.
|
||||
*
|
||||
* @deprecated 0.11.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getParagraphStyle()
|
||||
{
|
||||
return $this->getParagraph();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get hidden text.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -245,32 +245,6 @@ class Frame extends AbstractStyle
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 0.13.0 Use the `getAlignment` method instead.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getAlign()
|
||||
{
|
||||
return $this->getAlignment();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 0.13.0 Use the `setAlignment` method instead.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function setAlign($value = null)
|
||||
{
|
||||
return $this->setAlignment($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get unit.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -328,32 +328,6 @@ class NumberingLevel extends AbstractStyle
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 0.13.0 Use the `getAlignment` method instead.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getAlign()
|
||||
{
|
||||
return $this->getAlignment();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 0.13.0 Use the `setAlignment` method instead.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function setAlign($value)
|
||||
{
|
||||
return $this->setAlignment($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get left.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -272,32 +272,6 @@ class Paragraph extends Border
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 0.13.0 Use the `getAlignment` method instead.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getAlign()
|
||||
{
|
||||
return $this->getAlignment();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 0.13.0 Use the `setAlignment` method instead.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function setAlign($value = null)
|
||||
{
|
||||
return $this->setAlignment($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get parent style ID.
|
||||
*
|
||||
|
|
@ -734,54 +708,6 @@ class Paragraph extends Border
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get allow first/last line to display on a separate page setting.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getWidowControl()
|
||||
{
|
||||
return $this->hasWidowControl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get keep paragraph with next paragraph setting.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getKeepNext()
|
||||
{
|
||||
return $this->isKeepNext();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get keep all lines on one page setting.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getKeepLines()
|
||||
{
|
||||
return $this->isKeepLines();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get start paragraph on next page setting.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getPageBreakBefore()
|
||||
{
|
||||
return $this->hasPageBreakBefore();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get shading.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -123,40 +123,4 @@ class Row extends AbstractStyle
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get tblHeader.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getTblHeader()
|
||||
{
|
||||
return $this->isTblHeader();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get cantSplit.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getCantSplit()
|
||||
{
|
||||
return $this->isCantSplit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get exactHeight.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getExactHeight()
|
||||
{
|
||||
return $this->isExactHeight();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,36 +161,4 @@ class Spacing extends AbstractStyle
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get line rule.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @deprecated Use getLineRule() instead
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getRule()
|
||||
{
|
||||
return $this->lineRule;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set line rule.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @deprecated Use setLineRule() instead
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function setRule($value = null)
|
||||
{
|
||||
$this->lineRule = $value;
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,18 +22,6 @@ namespace PhpOffice\PhpWord\Style;
|
|||
*/
|
||||
class TOC extends Tab
|
||||
{
|
||||
/**
|
||||
* Tab leader types for backward compatibility.
|
||||
*
|
||||
* @deprecated 0.11.0
|
||||
*
|
||||
* @const string
|
||||
*/
|
||||
const TABLEADER_DOT = self::TAB_LEADER_DOT;
|
||||
const TABLEADER_UNDERSCORE = self::TAB_LEADER_UNDERSCORE;
|
||||
const TABLEADER_LINE = self::TAB_LEADER_HYPHEN;
|
||||
const TABLEADER_NONE = self::TAB_LEADER_NONE;
|
||||
|
||||
/**
|
||||
* Indent.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -24,19 +24,6 @@ use PhpOffice\PhpWord\SimpleType\TblWidth;
|
|||
|
||||
class Table extends Border
|
||||
{
|
||||
/**
|
||||
* @deprecated Use \PhpOffice\PhpWord\SimpleType\TblWidth::AUTO instead
|
||||
*/
|
||||
const WIDTH_AUTO = 'auto'; // Automatically determined width
|
||||
/**
|
||||
* @deprecated Use \PhpOffice\PhpWord\SimpleType\TblWidth::PERCENT instead
|
||||
*/
|
||||
const WIDTH_PERCENT = 'pct'; // Width in fiftieths (1/50) of a percent (1% = 50 unit)
|
||||
/**
|
||||
* @deprecated Use \PhpOffice\PhpWord\SimpleType\TblWidth::TWIP instead
|
||||
*/
|
||||
const WIDTH_TWIP = 'dxa'; // Width in twentieths (1/20) of a point (twip)
|
||||
|
||||
//values for http://www.datypic.com/sc/ooxml/t-w_ST_TblLayoutType.html
|
||||
/**
|
||||
* AutoFit Table Layout.
|
||||
|
|
@ -596,32 +583,6 @@ class Table extends Border
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 0.13.0 Use the `getAlignment` method instead.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getAlign()
|
||||
{
|
||||
return $this->getAlignment();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated 0.13.0 Use the `setAlignment` method instead.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return self
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function setAlign($value = null)
|
||||
{
|
||||
return $this->setAlignment($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get width.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,27 +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.
|
||||
*
|
||||
* @see https://github.com/PHPOffice/PHPWord
|
||||
*
|
||||
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
|
||||
*/
|
||||
|
||||
namespace PhpOffice\PhpWord;
|
||||
|
||||
/**
|
||||
* @deprecated 0.12.0 Use `\PhpOffice\PhpWord\TemplateProcessor` instead.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
class Template extends TemplateProcessor
|
||||
{
|
||||
}
|
||||
|
|
@ -417,16 +417,4 @@ abstract class AbstractWriter implements WriterInterface
|
|||
|
||||
rmdir($dir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get use disk caching status.
|
||||
*
|
||||
* @deprecated 0.10.0
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function getUseDiskCaching()
|
||||
{
|
||||
return $this->isUseDiskCaching();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -122,18 +122,4 @@ class HTML extends AbstractWriter implements WriterInterface
|
|||
{
|
||||
$this->notes[$noteId] = $noteMark;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write document.
|
||||
*
|
||||
* @deprecated 0.11.0
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
*/
|
||||
public function writeDocument()
|
||||
{
|
||||
return $this->getContent();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,38 +117,6 @@ class PhpWordTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertInstanceOf('PhpOffice\\PhpWord\\Style\\Font', Style::getStyle($titleName));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test load template.
|
||||
*
|
||||
* @deprecated 0.12.0
|
||||
*/
|
||||
public function testLoadTemplate(): void
|
||||
{
|
||||
$templateFqfn = __DIR__ . '/_files/templates/blank.docx';
|
||||
|
||||
$phpWord = new PhpWord();
|
||||
self::assertInstanceOf(
|
||||
'PhpOffice\\PhpWord\\TemplateProcessor',
|
||||
$phpWord->loadTemplate($templateFqfn)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test load template exception.
|
||||
*
|
||||
* @deprecated 0.12.0
|
||||
*/
|
||||
public function testLoadTemplateException(): void
|
||||
{
|
||||
$this->expectException(\PhpOffice\PhpWord\Exception\Exception::class);
|
||||
$templateFqfn = implode(
|
||||
DIRECTORY_SEPARATOR,
|
||||
[PHPWORD_TESTS_BASE_DIR, 'PhpWord', 'Tests', '_files', 'templates', 'blanks.docx']
|
||||
);
|
||||
$phpWord = new PhpWord();
|
||||
$phpWord->loadTemplate($templateFqfn);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test save.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ class ElementTest extends AbstractTestReader
|
|||
self::assertEquals('Two', $listElements[0]->getText());
|
||||
self::assertEquals(' with ', $listElements[1]->getText());
|
||||
self::assertEquals('bold', $listElements[2]->getText());
|
||||
self::assertTrue($listElements[2]->getFontStyle()->getBold());
|
||||
self::assertTrue($listElements[2]->getFontStyle()->isBold());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@
|
|||
namespace PhpOffice\PhpWordTests\Style;
|
||||
|
||||
use InvalidArgumentException;
|
||||
use PhpOffice\PhpWord\SimpleType\Jc;
|
||||
use PhpOffice\PhpWord\Style\Paragraph;
|
||||
use ReflectionClass;
|
||||
|
||||
/**
|
||||
|
|
@ -38,6 +40,22 @@ class AbstractStyleTest extends \PHPUnit\Framework\TestCase
|
|||
self::assertEquals(1, $stub->getIndex());
|
||||
}
|
||||
|
||||
public function testSetStyleByArrayWithAlign(): void
|
||||
{
|
||||
$stub = new Paragraph();
|
||||
$stub->setStyleByArray(['align' => Jc::CENTER]);
|
||||
|
||||
self::assertEquals(Jc::CENTER, $stub->getAlignment());
|
||||
}
|
||||
|
||||
public function testSetStyleByArrayWithAlignment(): void
|
||||
{
|
||||
$stub = new Paragraph();
|
||||
$stub->setStyleByArray(['alignment' => Jc::CENTER]);
|
||||
|
||||
self::assertEquals(Jc::CENTER, $stub->getAlignment());
|
||||
}
|
||||
|
||||
/**
|
||||
* Test setBoolVal, setIntVal, setFloatVal, setEnumVal with normal value.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ class FontTest extends \PHPUnit\Framework\TestCase
|
|||
$object = new Font('text', ['alignment' => Jc::BOTH]);
|
||||
|
||||
self::assertEquals('text', $object->getStyleType());
|
||||
self::assertInstanceOf('PhpOffice\\PhpWord\\Style\\Paragraph', $object->getParagraphStyle());
|
||||
self::assertInstanceOf(\PhpOffice\PhpWord\Style\Paragraph::class, $object->getParagraph());
|
||||
self::assertIsArray($object->getStyleValues());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ class RowTest extends \PHPUnit\Framework\TestCase
|
|||
foreach ($properties as $key => $value) {
|
||||
// set/get
|
||||
$set = "set{$key}";
|
||||
$get = "get{$key}";
|
||||
$get = "is{$key}";
|
||||
$expected = $value ? 1 : 0;
|
||||
$object->$set($value);
|
||||
self::assertEquals($expected, $object->$get());
|
||||
|
|
@ -70,7 +70,7 @@ class RowTest extends \PHPUnit\Framework\TestCase
|
|||
];
|
||||
foreach ($properties as $key => $value) {
|
||||
$set = "set{$key}";
|
||||
$get = "get{$key}";
|
||||
$get = "is{$key}";
|
||||
$object->$set($value);
|
||||
self::assertFalse($object->$get());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,10 +42,10 @@ class SectionTest extends \PHPUnit\Framework\TestCase
|
|||
$margins = \PhpOffice\PhpWord\Shared\Converter::INCH_TO_TWIP;
|
||||
$phpWord->addFontStyle('hdrstyle1', ['name' => 'Courier New', 'size' => 8]);
|
||||
$section = $phpWord->addSection(['paperSize' => 'Letter', 'marginTop' => $margins, 'marginBottom' => $margins]);
|
||||
$header = $section->createHeader();
|
||||
$header = $section->addHeader();
|
||||
$phpWord->addParagraphStyle('centerheader', ['align' => 'center']);
|
||||
$header->addText('Centered Header', 'hdrstyle1', 'centerheader');
|
||||
$footer = $section->createFooter();
|
||||
$footer = $section->addFooter();
|
||||
$sizew = $section->getStyle()->getPageSizeW();
|
||||
$sizel = $section->getStyle()->getMarginLeft();
|
||||
$sizer = $section->getStyle()->getMarginRight();
|
||||
|
|
@ -177,7 +177,7 @@ class SectionTest extends \PHPUnit\Framework\TestCase
|
|||
$section = $phpWord->addSection(['paperSize' => 'Letter', 'Orientation' => 'portrait']);
|
||||
$section->addText('This section uses Letter paper in portrait orientation.');
|
||||
$section = $phpWord->addSection(['paperSize' => 'A4', 'Orientation' => 'landscape', 'pageNumberingStart' => '9']);
|
||||
$header = $section->createHeader();
|
||||
$header = $section->addHeader();
|
||||
$header->addField('PAGE');
|
||||
$section->addText('This section uses A4 paper in landscape orientation. It should have a page break beforehand. It artificially starts on page 9.');
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue