Refactor: Fine tune element writing
This commit is contained in:
parent
2567a2223c
commit
ec9d90017f
|
|
@ -12,6 +12,8 @@ namespace PhpOffice\PhpWord\Writer\ODText;
|
||||||
use PhpOffice\PhpWord\Media;
|
use PhpOffice\PhpWord\Media;
|
||||||
use PhpOffice\PhpWord\Style;
|
use PhpOffice\PhpWord\Style;
|
||||||
use PhpOffice\PhpWord\PhpWord;
|
use PhpOffice\PhpWord\PhpWord;
|
||||||
|
use PhpOffice\PhpWord\Element\Text;
|
||||||
|
use PhpOffice\PhpWord\Element\Table;
|
||||||
use PhpOffice\PhpWord\Exception\Exception;
|
use PhpOffice\PhpWord\Exception\Exception;
|
||||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||||
use PhpOffice\PhpWord\Style\Font;
|
use PhpOffice\PhpWord\Style\Font;
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,10 @@
|
||||||
namespace PhpOffice\PhpWord\Writer;
|
namespace PhpOffice\PhpWord\Writer;
|
||||||
|
|
||||||
use PhpOffice\PhpWord\PhpWord;
|
use PhpOffice\PhpWord\PhpWord;
|
||||||
|
use PhpOffice\PhpWord\Style;
|
||||||
|
use PhpOffice\PhpWord\Element\Text;
|
||||||
use PhpOffice\PhpWord\Exception\Exception;
|
use PhpOffice\PhpWord\Exception\Exception;
|
||||||
use PhpOffice\PhpWord\Shared\Drawing;
|
use PhpOffice\PhpWord\Shared\Drawing;
|
||||||
use PhpOffice\PhpWord\Style;
|
|
||||||
use PhpOffice\PhpWord\Style\Font;
|
use PhpOffice\PhpWord\Style\Font;
|
||||||
use PhpOffice\PhpWord\Writer\RTF\Element\Element as ElementWriter;
|
use PhpOffice\PhpWord\Writer\RTF\Element\Element as ElementWriter;
|
||||||
|
|
||||||
|
|
@ -98,16 +99,6 @@ class RTF extends AbstractWriter implements WriterInterface
|
||||||
return $this->fontTable;
|
return $this->fontTable;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set last paragraph style
|
|
||||||
*
|
|
||||||
* @param mixed $value
|
|
||||||
*/
|
|
||||||
public function setLastParagraphStyle($value = '')
|
|
||||||
{
|
|
||||||
$this->lastParagraphStyle = $value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get last paragraph style
|
* Get last paragraph style
|
||||||
*
|
*
|
||||||
|
|
@ -118,6 +109,16 @@ class RTF extends AbstractWriter implements WriterInterface
|
||||||
return $this->lastParagraphStyle;
|
return $this->lastParagraphStyle;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set last paragraph style
|
||||||
|
*
|
||||||
|
* @param mixed $value
|
||||||
|
*/
|
||||||
|
public function setLastParagraphStyle($value = '')
|
||||||
|
{
|
||||||
|
$this->lastParagraphStyle = $value;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all data
|
* Get all data
|
||||||
*
|
*
|
||||||
|
|
@ -125,8 +126,8 @@ class RTF extends AbstractWriter implements WriterInterface
|
||||||
*/
|
*/
|
||||||
private function writeDocument()
|
private function writeDocument()
|
||||||
{
|
{
|
||||||
$this->fontTable = $this->getDataFont();
|
$this->fontTable = $this->populateFontTable();
|
||||||
$this->colorTable = $this->getDataColor();
|
$this->colorTable = $this->populateColorTable();
|
||||||
|
|
||||||
// Set the default character set
|
// Set the default character set
|
||||||
$sRTFContent = '{\rtf1';
|
$sRTFContent = '{\rtf1';
|
||||||
|
|
@ -200,7 +201,7 @@ class RTF extends AbstractWriter implements WriterInterface
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function getDataFont()
|
private function populateFontTable()
|
||||||
{
|
{
|
||||||
$phpWord = $this->phpWord;
|
$phpWord = $this->phpWord;
|
||||||
|
|
||||||
|
|
@ -254,7 +255,7 @@ class RTF extends AbstractWriter implements WriterInterface
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function getDataColor()
|
private function populateColorTable()
|
||||||
{
|
{
|
||||||
$phpWord = $this->phpWord;
|
$phpWord = $this->phpWord;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue