From ec9d90017ff7d44ec275158726b4c2d3d84d4197 Mon Sep 17 00:00:00 2001 From: Ivan Lanin Date: Fri, 25 Apr 2014 23:57:43 +0700 Subject: [PATCH] Refactor: Fine tune element writing --- src/PhpWord/Writer/ODText/Content.php | 2 ++ src/PhpWord/Writer/RTF.php | 31 ++++++++++++++------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/src/PhpWord/Writer/ODText/Content.php b/src/PhpWord/Writer/ODText/Content.php index 801c57c4..572ed9f6 100644 --- a/src/PhpWord/Writer/ODText/Content.php +++ b/src/PhpWord/Writer/ODText/Content.php @@ -12,6 +12,8 @@ namespace PhpOffice\PhpWord\Writer\ODText; use PhpOffice\PhpWord\Media; use PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\PhpWord; +use PhpOffice\PhpWord\Element\Text; +use PhpOffice\PhpWord\Element\Table; use PhpOffice\PhpWord\Exception\Exception; use PhpOffice\PhpWord\Shared\XMLWriter; use PhpOffice\PhpWord\Style\Font; diff --git a/src/PhpWord/Writer/RTF.php b/src/PhpWord/Writer/RTF.php index 5d75555c..01a30baa 100755 --- a/src/PhpWord/Writer/RTF.php +++ b/src/PhpWord/Writer/RTF.php @@ -10,9 +10,10 @@ namespace PhpOffice\PhpWord\Writer; use PhpOffice\PhpWord\PhpWord; +use PhpOffice\PhpWord\Style; +use PhpOffice\PhpWord\Element\Text; use PhpOffice\PhpWord\Exception\Exception; use PhpOffice\PhpWord\Shared\Drawing; -use PhpOffice\PhpWord\Style; use PhpOffice\PhpWord\Style\Font; use PhpOffice\PhpWord\Writer\RTF\Element\Element as ElementWriter; @@ -98,16 +99,6 @@ class RTF extends AbstractWriter implements WriterInterface return $this->fontTable; } - /** - * Set last paragraph style - * - * @param mixed $value - */ - public function setLastParagraphStyle($value = '') - { - $this->lastParagraphStyle = $value; - } - /** * Get last paragraph style * @@ -118,6 +109,16 @@ class RTF extends AbstractWriter implements WriterInterface return $this->lastParagraphStyle; } + /** + * Set last paragraph style + * + * @param mixed $value + */ + public function setLastParagraphStyle($value = '') + { + $this->lastParagraphStyle = $value; + } + /** * Get all data * @@ -125,8 +126,8 @@ class RTF extends AbstractWriter implements WriterInterface */ private function writeDocument() { - $this->fontTable = $this->getDataFont(); - $this->colorTable = $this->getDataColor(); + $this->fontTable = $this->populateFontTable(); + $this->colorTable = $this->populateColorTable(); // Set the default character set $sRTFContent = '{\rtf1'; @@ -200,7 +201,7 @@ class RTF extends AbstractWriter implements WriterInterface * * @return array */ - private function getDataFont() + private function populateFontTable() { $phpWord = $this->phpWord; @@ -254,7 +255,7 @@ class RTF extends AbstractWriter implements WriterInterface * * @return array */ - private function getDataColor() + private function populateColorTable() { $phpWord = $this->phpWord;