Namespace adjustments on writer classes
This commit is contained in:
parent
acba6b448a
commit
41407825a2
@ -26,13 +26,13 @@ class ODText extends Writer implements IWriter
|
|||||||
/**
|
/**
|
||||||
* Private unique PHPWord_Worksheet_BaseDrawing HashTable
|
* Private unique PHPWord_Worksheet_BaseDrawing HashTable
|
||||||
*
|
*
|
||||||
* @var \PhpOffice\PhpWord\HashTable
|
* @var HashTable
|
||||||
*/
|
*/
|
||||||
private $drawingHashTable;
|
private $drawingHashTable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new ODText writer
|
* Create new ODText writer
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param PhpWord $phpWord
|
||||||
*/
|
*/
|
||||||
public function __construct(PhpWord $phpWord = null)
|
public function __construct(PhpWord $phpWord = null)
|
||||||
{
|
{
|
||||||
@ -57,7 +57,7 @@ class ODText extends Writer implements IWriter
|
|||||||
* Save PhpWord to file
|
* Save PhpWord to file
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws \PhpOffice\PhpWord\Exceptions\Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function save($pFilename = null)
|
public function save($pFilename = null)
|
||||||
{
|
{
|
||||||
@ -139,7 +139,7 @@ class ODText extends Writer implements IWriter
|
|||||||
/**
|
/**
|
||||||
* Get PHPWord_Worksheet_BaseDrawing HashTable
|
* Get PHPWord_Worksheet_BaseDrawing HashTable
|
||||||
*
|
*
|
||||||
* @return \PhpOffice\PhpWord\HashTable
|
* @return HashTable
|
||||||
*/
|
*/
|
||||||
public function getDrawingHashTable()
|
public function getDrawingHashTable()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -35,7 +35,7 @@ class Content extends WriterPart
|
|||||||
/**
|
/**
|
||||||
* Write content file to XML format
|
* Write content file to XML format
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param PhpWord $phpWord
|
||||||
* @return string XML Output
|
* @return string XML Output
|
||||||
*/
|
*/
|
||||||
public function writeContent(PhpWord $phpWord = null)
|
public function writeContent(PhpWord $phpWord = null)
|
||||||
@ -126,7 +126,7 @@ class Content extends WriterPart
|
|||||||
$numFonts = 0;
|
$numFonts = 0;
|
||||||
if (count($styles) > 0) {
|
if (count($styles) > 0) {
|
||||||
foreach ($styles as $styleName => $style) {
|
foreach ($styles as $styleName => $style) {
|
||||||
// PhpOffice\PhpWord\Style\Font
|
// Font
|
||||||
if ($style instanceof Font) {
|
if ($style instanceof Font) {
|
||||||
$numFonts++;
|
$numFonts++;
|
||||||
$name = $style->getName();
|
$name = $style->getName();
|
||||||
@ -158,7 +158,7 @@ class Content extends WriterPart
|
|||||||
if (preg_match('#^T[0-9]+$#', $styleName) != 0
|
if (preg_match('#^T[0-9]+$#', $styleName) != 0
|
||||||
|| preg_match('#^P[0-9]+$#', $styleName) != 0
|
|| preg_match('#^P[0-9]+$#', $styleName) != 0
|
||||||
) {
|
) {
|
||||||
// PhpOffice\PhpWord\Style\Font
|
// Font
|
||||||
if ($style instanceof Font) {
|
if ($style instanceof Font) {
|
||||||
$xmlWriter->startElement('style:style');
|
$xmlWriter->startElement('style:style');
|
||||||
$xmlWriter->writeAttribute('style:name', $styleName);
|
$xmlWriter->writeAttribute('style:name', $styleName);
|
||||||
@ -288,8 +288,8 @@ class Content extends WriterPart
|
|||||||
/**
|
/**
|
||||||
* Write text
|
* Write text
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param \PhpOffice\PhpWord\Section\Text $text
|
* @param Text $text
|
||||||
* @param bool $withoutP
|
* @param bool $withoutP
|
||||||
*/
|
*/
|
||||||
protected function writeText(XMLWriter $xmlWriter, Text $text, $withoutP = false)
|
protected function writeText(XMLWriter $xmlWriter, Text $text, $withoutP = false)
|
||||||
@ -336,8 +336,8 @@ class Content extends WriterPart
|
|||||||
/**
|
/**
|
||||||
* Write TextRun section
|
* Write TextRun section
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param \PhpOffice\PhpWord\Section\TextRun $textrun
|
* @param TextRun $textrun
|
||||||
* @todo Enable all other section types
|
* @todo Enable all other section types
|
||||||
*/
|
*/
|
||||||
protected function writeTextRun(XMLWriter $xmlWriter, TextRun $textrun)
|
protected function writeTextRun(XMLWriter $xmlWriter, TextRun $textrun)
|
||||||
@ -357,7 +357,7 @@ class Content extends WriterPart
|
|||||||
/**
|
/**
|
||||||
* Write TextBreak
|
* Write TextBreak
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
*/
|
*/
|
||||||
protected function writeTextBreak(XMLWriter $xmlWriter = null)
|
protected function writeTextBreak(XMLWriter $xmlWriter = null)
|
||||||
{
|
{
|
||||||
@ -370,8 +370,8 @@ class Content extends WriterPart
|
|||||||
/**
|
/**
|
||||||
* Write end section
|
* Write end section
|
||||||
*
|
*
|
||||||
* @param PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param PhpOffice\PhpWord\Section $section
|
* @param Section $section
|
||||||
*/
|
*/
|
||||||
private function writeEndSection(XMLWriter $xmlWriter = null, Section $section = null)
|
private function writeEndSection(XMLWriter $xmlWriter = null, Section $section = null)
|
||||||
{
|
{
|
||||||
@ -380,8 +380,8 @@ class Content extends WriterPart
|
|||||||
/**
|
/**
|
||||||
* Write section
|
* Write section
|
||||||
*
|
*
|
||||||
* @param PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param PhpOffice\PhpWord\Section $section
|
* @param Section $section
|
||||||
*/
|
*/
|
||||||
private function writeSection(XMLWriter $xmlWriter = null, Section $section = null)
|
private function writeSection(XMLWriter $xmlWriter = null, Section $section = null)
|
||||||
{
|
{
|
||||||
@ -391,7 +391,7 @@ class Content extends WriterPart
|
|||||||
/**
|
/**
|
||||||
* Write unsupported element
|
* Write unsupported element
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param string $element
|
* @param string $element
|
||||||
*/
|
*/
|
||||||
private function writeUnsupportedElement($xmlWriter, $element)
|
private function writeUnsupportedElement($xmlWriter, $element)
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class Manifest extends WriterPart
|
|||||||
/**
|
/**
|
||||||
* Write Manifest file to XML format
|
* Write Manifest file to XML format
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param PhpWord $phpWord
|
||||||
* @return string XML Output
|
* @return string XML Output
|
||||||
*/
|
*/
|
||||||
public function writeManifest(PhpWord $phpWord = null)
|
public function writeManifest(PhpWord $phpWord = null)
|
||||||
@ -97,7 +97,7 @@ class Manifest extends WriterPart
|
|||||||
*
|
*
|
||||||
* @param string $pFile Filename
|
* @param string $pFile Filename
|
||||||
* @return string Mime Type
|
* @return string Mime Type
|
||||||
* @throws \PhpOffice\PhpWord\Exceptions\Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function getImageMimeType($pFile = '')
|
private function getImageMimeType($pFile = '')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -20,7 +20,7 @@ class Meta extends WriterPart
|
|||||||
/**
|
/**
|
||||||
* Write Meta file to XML format
|
* Write Meta file to XML format
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param PhpWord $phpWord
|
||||||
* @return string XML Output
|
* @return string XML Output
|
||||||
*/
|
*/
|
||||||
public function writeMeta(PhpWord $phpWord = null)
|
public function writeMeta(PhpWord $phpWord = null)
|
||||||
|
|||||||
@ -19,7 +19,7 @@ class Mimetype extends WriterPart
|
|||||||
/**
|
/**
|
||||||
* Write Mimetype to Text format
|
* Write Mimetype to Text format
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param PhpWord $phpWord
|
||||||
* @return string Text Output
|
* @return string Text Output
|
||||||
*/
|
*/
|
||||||
public function writeMimetype(PhpWord $phpWord = null)
|
public function writeMimetype(PhpWord $phpWord = null)
|
||||||
|
|||||||
@ -24,7 +24,7 @@ class Styles extends WriterPart
|
|||||||
/**
|
/**
|
||||||
* Write Styles file to XML format
|
* Write Styles file to XML format
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param PhpWord $phpWord
|
||||||
* @return string XML Output
|
* @return string XML Output
|
||||||
*/
|
*/
|
||||||
public function writeStyles(PhpWord $phpWord = null)
|
public function writeStyles(PhpWord $phpWord = null)
|
||||||
@ -73,7 +73,7 @@ class Styles extends WriterPart
|
|||||||
$numFonts = 0;
|
$numFonts = 0;
|
||||||
if (count($styles) > 0) {
|
if (count($styles) > 0) {
|
||||||
foreach ($styles as $styleName => $style) {
|
foreach ($styles as $styleName => $style) {
|
||||||
// PhpOffice\PhpWord\Style\Font
|
// Font
|
||||||
if ($style instanceof Font) {
|
if ($style instanceof Font) {
|
||||||
$numFonts++;
|
$numFonts++;
|
||||||
$name = $style->getName();
|
$name = $style->getName();
|
||||||
@ -144,7 +144,7 @@ class Styles extends WriterPart
|
|||||||
if (preg_match('#^T[0-9]+$#', $styleName) == 0
|
if (preg_match('#^T[0-9]+$#', $styleName) == 0
|
||||||
&& preg_match('#^P[0-9]+$#', $styleName) == 0
|
&& preg_match('#^P[0-9]+$#', $styleName) == 0
|
||||||
) {
|
) {
|
||||||
// PhpOffice\PhpWord\Style\Font
|
// Font
|
||||||
if ($style instanceof Font) {
|
if ($style instanceof Font) {
|
||||||
// style:style
|
// style:style
|
||||||
$xmlWriter->startElement('style:style');
|
$xmlWriter->startElement('style:style');
|
||||||
@ -168,7 +168,7 @@ class Styles extends WriterPart
|
|||||||
$xmlWriter->endElement();
|
$xmlWriter->endElement();
|
||||||
$xmlWriter->endElement();
|
$xmlWriter->endElement();
|
||||||
} elseif ($style instanceof Paragraph) {
|
} elseif ($style instanceof Paragraph) {
|
||||||
// PhpOffice\PhpWord\Style\Paragraph
|
// Paragraph
|
||||||
// style:style
|
// style:style
|
||||||
$xmlWriter->startElement('style:style');
|
$xmlWriter->startElement('style:style');
|
||||||
$xmlWriter->writeAttribute('style:name', $styleName);
|
$xmlWriter->writeAttribute('style:name', $styleName);
|
||||||
@ -183,7 +183,7 @@ class Styles extends WriterPart
|
|||||||
|
|
||||||
$xmlWriter->endElement();
|
$xmlWriter->endElement();
|
||||||
} elseif ($style instanceof Table) {
|
} elseif ($style instanceof Table) {
|
||||||
// PhpOffice\PhpWord\Style\Table
|
// Table
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class RTF extends Writer implements IWriter
|
|||||||
/**
|
/**
|
||||||
* Private unique PHPWord_Worksheet_BaseDrawing HashTable
|
* Private unique PHPWord_Worksheet_BaseDrawing HashTable
|
||||||
*
|
*
|
||||||
* @var \PhpOffice\PhpWord\HashTable
|
* @var HashTable
|
||||||
*/
|
*/
|
||||||
private $drawingHashTable;
|
private $drawingHashTable;
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ class RTF extends Writer implements IWriter
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new RTF writer
|
* Create new RTF writer
|
||||||
* @param \PhpOffice\PhpWord\PhpWord $phpWord
|
* @param PhpWord $phpWord
|
||||||
*/
|
*/
|
||||||
public function __construct(PhpWord $phpWord = null)
|
public function __construct(PhpWord $phpWord = null)
|
||||||
{
|
{
|
||||||
@ -78,7 +78,7 @@ class RTF extends Writer implements IWriter
|
|||||||
* Save PhpWord to file
|
* Save PhpWord to file
|
||||||
*
|
*
|
||||||
* @param string $pFilename
|
* @param string $pFilename
|
||||||
* @throws \PhpOffice\PhpWord\Exceptions\Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
public function save($pFilename = null)
|
public function save($pFilename = null)
|
||||||
{
|
{
|
||||||
@ -98,7 +98,7 @@ class RTF extends Writer implements IWriter
|
|||||||
/**
|
/**
|
||||||
* Get PHPWord_Worksheet_BaseDrawing HashTable
|
* Get PHPWord_Worksheet_BaseDrawing HashTable
|
||||||
*
|
*
|
||||||
* @return \PhpOffice\PhpWord\HashTable
|
* @return HashTable
|
||||||
*/
|
*/
|
||||||
public function getDrawingHashTable()
|
public function getDrawingHashTable()
|
||||||
{
|
{
|
||||||
@ -181,7 +181,7 @@ class RTF extends Writer implements IWriter
|
|||||||
$styles = Style::getStyles();
|
$styles = Style::getStyles();
|
||||||
if (count($styles) > 0) {
|
if (count($styles) > 0) {
|
||||||
foreach ($styles as $styleName => $style) {
|
foreach ($styles as $styleName => $style) {
|
||||||
// PhpOffice\PhpWord\Style\Font
|
// Font
|
||||||
if ($style instanceof Font) {
|
if ($style instanceof Font) {
|
||||||
if (in_array($style->getName(), $arrFonts) == false) {
|
if (in_array($style->getName(), $arrFonts) == false) {
|
||||||
$arrFonts[] = $style->getName();
|
$arrFonts[] = $style->getName();
|
||||||
|
|||||||
@ -46,7 +46,7 @@ class Word2007 extends Writer implements IWriter
|
|||||||
/**
|
/**
|
||||||
* Create new Word2007 writer
|
* Create new Word2007 writer
|
||||||
*
|
*
|
||||||
* @param PhpOffice\PhpWord\PhpWord
|
* @param PhpWord
|
||||||
*/
|
*/
|
||||||
public function __construct(PhpWord $phpWord = null)
|
public function __construct(PhpWord $phpWord = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -27,6 +27,8 @@ use PhpOffice\PhpWord\Shared\XMLWriter;
|
|||||||
use PhpOffice\PhpWord\Style\Paragraph;
|
use PhpOffice\PhpWord\Style\Paragraph;
|
||||||
use PhpOffice\PhpWord\Style\Font;
|
use PhpOffice\PhpWord\Style\Font;
|
||||||
use PhpOffice\PhpWord\Style\Cell;
|
use PhpOffice\PhpWord\Style\Cell;
|
||||||
|
use PhpOffice\PhpWord\Style\Table as TableStyle;
|
||||||
|
use PhpOffice\PhpWord\Style\Image as ImageStyle;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Word2007 base part writer
|
* Word2007 base part writer
|
||||||
@ -197,7 +199,7 @@ class Base extends WriterPart
|
|||||||
* Write preserve text element
|
* Write preserve text element
|
||||||
*
|
*
|
||||||
* @param XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param TextRun $textrun
|
* @param PreserveText $textrun
|
||||||
*/
|
*/
|
||||||
protected function writePreserveText(
|
protected function writePreserveText(
|
||||||
XMLWriter $xmlWriter,
|
XMLWriter $xmlWriter,
|
||||||
@ -364,7 +366,7 @@ class Base extends WriterPart
|
|||||||
// Table style
|
// Table style
|
||||||
$tblStyle = $table->getStyle();
|
$tblStyle = $table->getStyle();
|
||||||
$tblWidth = $table->getWidth();
|
$tblWidth = $table->getWidth();
|
||||||
if ($tblStyle instanceof \PhpOffice\PhpWord\Style\Table) {
|
if ($tblStyle instanceof TableStyle) {
|
||||||
$this->writeTableStyle($xmlWriter, $tblStyle, false);
|
$this->writeTableStyle($xmlWriter, $tblStyle, false);
|
||||||
} else {
|
} else {
|
||||||
if (!empty($tblStyle)) {
|
if (!empty($tblStyle)) {
|
||||||
@ -523,16 +525,16 @@ class Base extends WriterPart
|
|||||||
}
|
}
|
||||||
|
|
||||||
switch ($wrappingStyle) {
|
switch ($wrappingStyle) {
|
||||||
case \PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_BEHIND:
|
case ImageStyle::WRAPPING_STYLE_BEHIND:
|
||||||
$imgStyle .= 'position:absolute;z-index:-251658752;';
|
$imgStyle .= 'position:absolute;z-index:-251658752;';
|
||||||
break;
|
break;
|
||||||
case \PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_SQUARE:
|
case ImageStyle::WRAPPING_STYLE_SQUARE:
|
||||||
$imgStyle .= 'position:absolute;z-index:251659264;mso-position-horizontal:absolute;mso-position-vertical:absolute;';
|
$imgStyle .= 'position:absolute;z-index:251659264;mso-position-horizontal:absolute;mso-position-vertical:absolute;';
|
||||||
break;
|
break;
|
||||||
case \PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_TIGHT:
|
case ImageStyle::WRAPPING_STYLE_TIGHT:
|
||||||
$imgStyle .= 'position:absolute;z-index:251659264;mso-wrap-edited:f;mso-position-horizontal:absolute;mso-position-vertical:absolute';
|
$imgStyle .= 'position:absolute;z-index:251659264;mso-wrap-edited:f;mso-position-horizontal:absolute;mso-position-vertical:absolute';
|
||||||
break;
|
break;
|
||||||
case \PhpOffice\PhpWord\Style\Image::WRAPPING_STYLE_INFRONT:
|
case ImageStyle::WRAPPING_STYLE_INFRONT:
|
||||||
$imgStyle .= 'position:absolute;zz-index:251659264;mso-position-horizontal:absolute;mso-position-vertical:absolute;';
|
$imgStyle .= 'position:absolute;zz-index:251659264;mso-position-horizontal:absolute;mso-position-vertical:absolute;';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -767,7 +769,7 @@ class Base extends WriterPart
|
|||||||
* Write paragraph style
|
* Write paragraph style
|
||||||
*
|
*
|
||||||
* @param XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param \PhpOffice\PhpWord\Style\Paragraph $style
|
* @param Paragraph $style
|
||||||
* @param bool $withoutPPR
|
* @param bool $withoutPPR
|
||||||
*/
|
*/
|
||||||
protected function writeParagraphStyle(
|
protected function writeParagraphStyle(
|
||||||
@ -867,10 +869,10 @@ class Base extends WriterPart
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write footnote reference element
|
* Write font style
|
||||||
*
|
*
|
||||||
* @param XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param PhpOffice\PhpWord\Section $section
|
* @param Font $style
|
||||||
*/
|
*/
|
||||||
protected function writeFontStyle(XMLWriter $xmlWriter, Font $style)
|
protected function writeFontStyle(XMLWriter $xmlWriter, Font $style)
|
||||||
{
|
{
|
||||||
@ -974,12 +976,12 @@ class Base extends WriterPart
|
|||||||
* Write table style
|
* Write table style
|
||||||
*
|
*
|
||||||
* @param XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param PhpOffice\PhpWord\Style\Table $style
|
* @param TableStyle $style
|
||||||
* @param boolean $isFullStyle
|
* @param boolean $isFullStyle
|
||||||
*/
|
*/
|
||||||
protected function writeTableStyle(
|
protected function writeTableStyle(
|
||||||
XMLWriter $xmlWriter,
|
XMLWriter $xmlWriter,
|
||||||
\PhpOffice\PhpWord\Style\Table $style,
|
TableStyle $style,
|
||||||
$isFullStyle = true
|
$isFullStyle = true
|
||||||
) {
|
) {
|
||||||
$bgColor = $style->getBgColor();
|
$bgColor = $style->getBgColor();
|
||||||
@ -1105,12 +1107,12 @@ class Base extends WriterPart
|
|||||||
*
|
*
|
||||||
* @param XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param string $type
|
* @param string $type
|
||||||
* @param PhpOffice\PhpWord\Style\Table $style
|
* @param TableStyle $style
|
||||||
*/
|
*/
|
||||||
protected function writeRowStyle(
|
protected function writeRowStyle(
|
||||||
XMLWriter $xmlWriter,
|
XMLWriter $xmlWriter,
|
||||||
$type,
|
$type,
|
||||||
\PhpOffice\PhpWord\Style\Table $style
|
TableStyle $style
|
||||||
) {
|
) {
|
||||||
$brdSz = $style->getBorderSize();
|
$brdSz = $style->getBorderSize();
|
||||||
$brdCol = $style->getBorderColor();
|
$brdCol = $style->getBorderColor();
|
||||||
@ -1174,7 +1176,7 @@ class Base extends WriterPart
|
|||||||
* Write footnote reference element
|
* Write footnote reference element
|
||||||
*
|
*
|
||||||
* @param XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param PhpOffice\PhpWord\Style\Cell $style
|
* @param Cell $style
|
||||||
*/
|
*/
|
||||||
protected function writeCellStyle(XMLWriter $xmlWriter, Cell $style = null)
|
protected function writeCellStyle(XMLWriter $xmlWriter, Cell $style = null)
|
||||||
{
|
{
|
||||||
@ -1321,10 +1323,9 @@ class Base extends WriterPart
|
|||||||
*
|
*
|
||||||
* @param XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param Paragraph|string $styleParagraph
|
* @param Paragraph|string $styleParagraph
|
||||||
* @param boolean $spIsObject
|
|
||||||
* @param boolean $withoutPPR
|
* @param boolean $withoutPPR
|
||||||
*/
|
*/
|
||||||
private function writeInlineParagraphStyle(
|
protected function writeInlineParagraphStyle(
|
||||||
XMLWriter $xmlWriter,
|
XMLWriter $xmlWriter,
|
||||||
$styleParagraph = null,
|
$styleParagraph = null,
|
||||||
$withoutPPR = false
|
$withoutPPR = false
|
||||||
@ -1350,9 +1351,8 @@ class Base extends WriterPart
|
|||||||
*
|
*
|
||||||
* @param XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param Font|string $styleFont
|
* @param Font|string $styleFont
|
||||||
* @param boolean $sfIsObject
|
|
||||||
*/
|
*/
|
||||||
private function writeInlineFontStyle(
|
protected function writeInlineFontStyle(
|
||||||
XMLWriter $xmlWriter,
|
XMLWriter $xmlWriter,
|
||||||
$styleFont = null
|
$styleFont = null
|
||||||
) {
|
) {
|
||||||
|
|||||||
@ -161,10 +161,10 @@ class ContentTypes extends WriterPart
|
|||||||
/**
|
/**
|
||||||
* Write Default XML element
|
* Write Default XML element
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter XML Writer
|
* @param XMLWriter $xmlWriter XML Writer
|
||||||
* @param string $pPartname Part name
|
* @param string $pPartname Part name
|
||||||
* @param string $pContentType Content type
|
* @param string $pContentType Content type
|
||||||
* @throws \PhpOffice\PhpWord\Exceptions\Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function writeDefaultContentType(XMLWriter $xmlWriter = null, $pPartname = '', $pContentType = '')
|
private function writeDefaultContentType(XMLWriter $xmlWriter = null, $pPartname = '', $pContentType = '')
|
||||||
{
|
{
|
||||||
@ -182,10 +182,10 @@ class ContentTypes extends WriterPart
|
|||||||
/**
|
/**
|
||||||
* Write Override XML element
|
* Write Override XML element
|
||||||
*
|
*
|
||||||
* @param \PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param string $pPartname Part name
|
* @param string $pPartname Part name
|
||||||
* @param string $pContentType Content type
|
* @param string $pContentType Content type
|
||||||
* @throws \PhpOffice\PhpWord\Exceptions\Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function writeOverrideContentType(XMLWriter $xmlWriter = null, $pPartname = '', $pContentType = '')
|
private function writeOverrideContentType(XMLWriter $xmlWriter = null, $pPartname = '', $pContentType = '')
|
||||||
{
|
{
|
||||||
@ -205,7 +205,7 @@ class ContentTypes extends WriterPart
|
|||||||
*
|
*
|
||||||
* @param string $pFile Filename
|
* @param string $pFile Filename
|
||||||
* @return string Mime Type
|
* @return string Mime Type
|
||||||
* @throws \PhpOffice\PhpWord\Exceptions\Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private function getImageMimeType($pFile = '')
|
private function getImageMimeType($pFile = '')
|
||||||
{
|
{
|
||||||
|
|||||||
@ -110,7 +110,7 @@ class DocProps extends WriterPart
|
|||||||
/**
|
/**
|
||||||
* Write docProps/core.xml
|
* Write docProps/core.xml
|
||||||
*
|
*
|
||||||
* @param PhpOffice\PhpWord\PhpWord $phpWord
|
* @param PhpWord $phpWord
|
||||||
*/
|
*/
|
||||||
public function writeDocPropsCore(PhpWord $phpWord = null)
|
public function writeDocPropsCore(PhpWord $phpWord = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -36,7 +36,7 @@ class Document extends Base
|
|||||||
/**
|
/**
|
||||||
* Write word/document.xml
|
* Write word/document.xml
|
||||||
*
|
*
|
||||||
* @param PhpOffice\PhpWord\PhpWord $phpWord
|
* @param PhpWord $phpWord
|
||||||
*/
|
*/
|
||||||
public function writeDocument(PhpWord $phpWord = null)
|
public function writeDocument(PhpWord $phpWord = null)
|
||||||
{
|
{
|
||||||
@ -118,8 +118,8 @@ class Document extends Base
|
|||||||
/**
|
/**
|
||||||
* Write begin section
|
* Write begin section
|
||||||
*
|
*
|
||||||
* @param PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param PhpOffice\PhpWord\Section $section
|
* @param Section $section
|
||||||
*/
|
*/
|
||||||
private function writeSection(XMLWriter $xmlWriter, Section $section)
|
private function writeSection(XMLWriter $xmlWriter, Section $section)
|
||||||
{
|
{
|
||||||
@ -133,8 +133,8 @@ class Document extends Base
|
|||||||
/**
|
/**
|
||||||
* Write end section
|
* Write end section
|
||||||
*
|
*
|
||||||
* @param PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param PhpOffice\PhpWord\Section $section
|
* @param Section $section
|
||||||
*/
|
*/
|
||||||
private function writeEndSection(XMLWriter $xmlWriter, Section $section)
|
private function writeEndSection(XMLWriter $xmlWriter, Section $section)
|
||||||
{
|
{
|
||||||
@ -272,7 +272,7 @@ class Document extends Base
|
|||||||
/**
|
/**
|
||||||
* Write page break element
|
* Write page break element
|
||||||
*
|
*
|
||||||
* @param PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
*/
|
*/
|
||||||
private function writePageBreak(XMLWriter $xmlWriter)
|
private function writePageBreak(XMLWriter $xmlWriter)
|
||||||
{
|
{
|
||||||
@ -288,7 +288,7 @@ class Document extends Base
|
|||||||
/**
|
/**
|
||||||
* Write TOC element
|
* Write TOC element
|
||||||
*
|
*
|
||||||
* @param PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
*/
|
*/
|
||||||
private function writeTOC(XMLWriter $xmlWriter)
|
private function writeTOC(XMLWriter $xmlWriter)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -15,6 +15,7 @@ use PhpOffice\PhpWord\Section\Table;
|
|||||||
use PhpOffice\PhpWord\Section\Text;
|
use PhpOffice\PhpWord\Section\Text;
|
||||||
use PhpOffice\PhpWord\Section\TextBreak;
|
use PhpOffice\PhpWord\Section\TextBreak;
|
||||||
use PhpOffice\PhpWord\Section\TextRun;
|
use PhpOffice\PhpWord\Section\TextRun;
|
||||||
|
use PhpOffice\PhpWord\Section\Footer as FooterElement;
|
||||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,9 +26,9 @@ class Footer extends Base
|
|||||||
/**
|
/**
|
||||||
* Write word/footnotes.xml
|
* Write word/footnotes.xml
|
||||||
*
|
*
|
||||||
* @param PhpOffice\PhpWord\Section\Footer $footer
|
* @param FooterElement $footer
|
||||||
*/
|
*/
|
||||||
public function writeFooter(\PhpOffice\PhpWord\Section\Footer $footer)
|
public function writeFooter(FooterElement $footer)
|
||||||
{
|
{
|
||||||
// Create XML writer
|
// Create XML writer
|
||||||
$xmlWriter = $this->getXmlWriter();
|
$xmlWriter = $this->getXmlWriter();
|
||||||
|
|||||||
@ -77,26 +77,18 @@ class Footnotes extends Base
|
|||||||
/**
|
/**
|
||||||
* Write footnote content, overrides method in parent class
|
* Write footnote content, overrides method in parent class
|
||||||
*
|
*
|
||||||
* @param PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param PhpOffice\PhpWord\Section\Footnote $footnote
|
* @param Footnote $footnote
|
||||||
|
* @param boolean $withoutP
|
||||||
*/
|
*/
|
||||||
protected function writeFootnote(XMLWriter $xmlWriter, Footnote $footnote)
|
protected function writeFootnote(XMLWriter $xmlWriter, Footnote $footnote, $withoutP = false)
|
||||||
{
|
{
|
||||||
$xmlWriter->startElement('w:footnote');
|
$xmlWriter->startElement('w:footnote');
|
||||||
$xmlWriter->writeAttribute('w:id', $footnote->getReferenceId());
|
$xmlWriter->writeAttribute('w:id', $footnote->getReferenceId());
|
||||||
$xmlWriter->startElement('w:p');
|
$xmlWriter->startElement('w:p');
|
||||||
// Paragraph style
|
// Paragraph style
|
||||||
$paragraphStyle = $footnote->getParagraphStyle();
|
$styleParagraph = $footnote->getParagraphStyle();
|
||||||
$spIsObject = ($paragraphStyle instanceof Paragraph) ? true : false;
|
$this->writeInlineParagraphStyle($xmlWriter, $styleParagraph);
|
||||||
if ($spIsObject) {
|
|
||||||
$this->writeParagraphStyle($xmlWriter, $paragraphStyle);
|
|
||||||
} elseif (!$spIsObject && !is_null($paragraphStyle)) {
|
|
||||||
$xmlWriter->startElement('w:pPr');
|
|
||||||
$xmlWriter->startElement('w:pStyle');
|
|
||||||
$xmlWriter->writeAttribute('w:val', $paragraphStyle);
|
|
||||||
$xmlWriter->endElement();
|
|
||||||
$xmlWriter->endElement();
|
|
||||||
}
|
|
||||||
// Reference symbol
|
// Reference symbol
|
||||||
$xmlWriter->startElement('w:r');
|
$xmlWriter->startElement('w:r');
|
||||||
$xmlWriter->startElement('w:rPr');
|
$xmlWriter->startElement('w:rPr');
|
||||||
|
|||||||
@ -15,6 +15,7 @@ use PhpOffice\PhpWord\Section\Table;
|
|||||||
use PhpOffice\PhpWord\Section\Text;
|
use PhpOffice\PhpWord\Section\Text;
|
||||||
use PhpOffice\PhpWord\Section\TextBreak;
|
use PhpOffice\PhpWord\Section\TextBreak;
|
||||||
use PhpOffice\PhpWord\Section\TextRun;
|
use PhpOffice\PhpWord\Section\TextRun;
|
||||||
|
use PhpOffice\PhpWord\Section\Header as HeaderElement;
|
||||||
use PhpOffice\PhpWord\Shared\XMLWriter;
|
use PhpOffice\PhpWord\Shared\XMLWriter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,9 +26,9 @@ class Header extends Base
|
|||||||
/**
|
/**
|
||||||
* Write word/headerx.xml
|
* Write word/headerx.xml
|
||||||
*
|
*
|
||||||
* @param PhpOffice\PhpWord\Section\Header $header
|
* @param HeaderElement $header
|
||||||
*/
|
*/
|
||||||
public function writeHeader(\PhpOffice\PhpWord\Section\Header $header)
|
public function writeHeader(HeaderElement $header)
|
||||||
{
|
{
|
||||||
// Create XML writer
|
// Create XML writer
|
||||||
$xmlWriter = $this->getXmlWriter();
|
$xmlWriter = $this->getXmlWriter();
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class Rels extends Base
|
|||||||
/**
|
/**
|
||||||
* Write _rels/.rels
|
* Write _rels/.rels
|
||||||
*
|
*
|
||||||
* @param PhpOffice\PhpWord\PhpWord $phpWord
|
* @param PhpWord $phpWord
|
||||||
*/
|
*/
|
||||||
public function writeRelationships(PhpWord $phpWord = null)
|
public function writeRelationships(PhpWord $phpWord = null)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -14,6 +14,7 @@ use PhpOffice\PhpWord\Shared\XMLWriter;
|
|||||||
use PhpOffice\PhpWord\Style;
|
use PhpOffice\PhpWord\Style;
|
||||||
use PhpOffice\PhpWord\Style\Font;
|
use PhpOffice\PhpWord\Style\Font;
|
||||||
use PhpOffice\PhpWord\Style\Paragraph;
|
use PhpOffice\PhpWord\Style\Paragraph;
|
||||||
|
use PhpOffice\PhpWord\Style\Table;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Word2007 styles part writer
|
* Word2007 styles part writer
|
||||||
@ -23,7 +24,7 @@ class Styles extends Base
|
|||||||
/**
|
/**
|
||||||
* Write word/styles.xml
|
* Write word/styles.xml
|
||||||
*
|
*
|
||||||
* @param PhpOffice\PhpWord\PhpWord $phpWord
|
* @param PhpWord $phpWord
|
||||||
*/
|
*/
|
||||||
public function writeStyles(PhpWord $phpWord = null)
|
public function writeStyles(PhpWord $phpWord = null)
|
||||||
{
|
{
|
||||||
@ -121,7 +122,7 @@ class Styles extends Base
|
|||||||
$this->writeParagraphStyle($xmlWriter, $style);
|
$this->writeParagraphStyle($xmlWriter, $style);
|
||||||
$xmlWriter->endElement();
|
$xmlWriter->endElement();
|
||||||
|
|
||||||
} elseif ($style instanceof \PhpOffice\PhpWord\Style\Table) {
|
} elseif ($style instanceof Table) {
|
||||||
$xmlWriter->startElement('w:style');
|
$xmlWriter->startElement('w:style');
|
||||||
$xmlWriter->writeAttribute('w:type', 'table');
|
$xmlWriter->writeAttribute('w:type', 'table');
|
||||||
$xmlWriter->writeAttribute('w:customStyle', '1');
|
$xmlWriter->writeAttribute('w:customStyle', '1');
|
||||||
@ -151,7 +152,7 @@ class Styles extends Base
|
|||||||
/**
|
/**
|
||||||
* Write default font and other default styles
|
* Write default font and other default styles
|
||||||
*
|
*
|
||||||
* @param PhpOffice\PhpWord\Shared\XMLWriter $xmlWriter
|
* @param XMLWriter $xmlWriter
|
||||||
* @param array $styles
|
* @param array $styles
|
||||||
*/
|
*/
|
||||||
private function writeDefaultStyles(XMLWriter $xmlWriter, PhpWord $phpWord, $styles)
|
private function writeDefaultStyles(XMLWriter $xmlWriter, PhpWord $phpWord, $styles)
|
||||||
|
|||||||
@ -22,7 +22,7 @@ abstract class Writer implements IWriter
|
|||||||
/**
|
/**
|
||||||
* PHPWord object
|
* PHPWord object
|
||||||
*
|
*
|
||||||
* @var PhpOffice\PhpWord\PhpWord
|
* @var PhpWord
|
||||||
*/
|
*/
|
||||||
protected $phpWord = null;
|
protected $phpWord = null;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user