Leading backslashes in global function/constant calls were removed.
This commit is contained in:
parent
cdb3a20cb6
commit
191d37b280
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s') , " Create new PhpWord object" , \EOL;
|
||||
echo date('H:i:s') , " Create new PhpWord object" , EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$phpWord->addFontStyle('rStyle', array('bold' => true, 'italic' => true, 'size' => 16));
|
||||
$phpWord->addParagraphStyle('pStyle', array('align' => 'center', 'spaceAfter' => 100));
|
||||
|
|
@ -48,7 +48,7 @@ $section->addImage('resources/_earth.jpg', array('width'=>18, 'height'=>18));
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s') , ' Create new PhpWord object' , \EOL;
|
||||
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Ads styles
|
||||
|
|
@ -36,7 +36,7 @@ $section->addText("\tCenter Aligned", NULL, 'centerTab');
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s') , ' Create new PhpWord object' , \EOL;
|
||||
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// New portrait section
|
||||
|
|
@ -29,7 +29,7 @@ $section->addFooter()->addText('Footer');
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s') , ' Create new PhpWord object' , \EOL;
|
||||
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Ads styles
|
||||
|
|
@ -37,7 +37,7 @@ $textrun->addText(' Here is some more text. ');
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s') , " Create new PhpWord object" , \EOL;
|
||||
echo date('H:i:s') , " Create new PhpWord object" , EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$filler = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. ' .
|
||||
'Nulla fermentum, tortor id adipiscing adipiscing, tortor turpis commodo. ' .
|
||||
|
|
@ -39,7 +39,7 @@ $section->addText('Normal paragraph again.');
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s') , " Create new PhpWord object" , \EOL;
|
||||
echo date('H:i:s') , " Create new PhpWord object" , EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
\PhpOffice\PhpWord\Settings::setCompatibility(false);
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ $footnote->addText('The reference for this is wrapped in its own line');
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s') , " Create new PhpWord object" , \EOL;
|
||||
echo date('H:i:s') , " Create new PhpWord object" , EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
$document = $phpWord->loadTemplate('resources/Sample_07_TemplateCloneRow.docx');
|
||||
|
|
@ -56,7 +56,7 @@ $document->setValue('userName#3', 'Ray');
|
|||
$document->setValue('userPhone#3', '+1 428 889 775');
|
||||
|
||||
$name = 'Sample_07_TemplateCloneRow.docx';
|
||||
echo date('H:i:s'), " Write to Word2007 format", \EOL;
|
||||
echo date('H:i:s'), " Write to Word2007 format", EOL;
|
||||
$document->saveAs($name);
|
||||
rename($name, "results/{$name}");
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s') , " Create new PhpWord object" , \EOL;
|
||||
echo date('H:i:s') , " Create new PhpWord object" , EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$phpWord->setDefaultParagraphStyle(array(
|
||||
'align' => 'both',
|
||||
|
|
@ -49,7 +49,7 @@ $section->addText('Paragraph with pageBreakBefore = true (default: false). ' .
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s') , ' Create new PhpWord object' , \EOL;
|
||||
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$section = $phpWord->addSection();
|
||||
$header = array('size' => 16, 'bold' => true);
|
||||
|
|
@ -88,7 +88,7 @@ $table->addCell(null, $cellRowContinue);
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word Document
|
||||
echo date('H:i:s') , ' Create new PhpWord object' , \EOL;
|
||||
echo date('H:i:s') , ' Create new PhpWord object' , EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$section = $phpWord->addSection();
|
||||
$header = array('size' => 16, 'bold' => true);
|
||||
|
|
@ -13,7 +13,7 @@ $section->addText('中文楷体样式测试',array('name' => '楷体', 'size' =>
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -4,13 +4,13 @@ include_once 'Sample_Header.php';
|
|||
// Read contents
|
||||
$name = basename(__FILE__, '.php');
|
||||
$source = "resources/{$name}.docx";
|
||||
echo date('H:i:s'), " Reading contents from `{$source}`", \EOL;
|
||||
echo date('H:i:s'), " Reading contents from `{$source}`", EOL;
|
||||
$phpWord = \PhpOffice\PhpWord\IOFactory::load($source);
|
||||
|
||||
// (Re)write contents
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s') , " Create new PhpWord object" , \EOL;
|
||||
echo date('H:i:s') , " Create new PhpWord object" , EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// New portrait section
|
||||
|
|
@ -64,7 +64,7 @@ $section2->addText('Some text...');
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), " Create new PhpWord object", \EOL;
|
||||
echo date('H:i:s'), " Create new PhpWord object", EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Begin code
|
||||
|
|
@ -24,7 +24,7 @@ $section->addImage($source);
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), " Create new PhpWord object", \EOL;
|
||||
echo date('H:i:s'), " Create new PhpWord object", EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Begin code
|
||||
|
|
@ -48,7 +48,7 @@ $section->addListItem('List Item 7', 0, 'myOwnStyle', $listStyle, 'P-Style');
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), " Create new PhpWord object", \EOL;
|
||||
echo date('H:i:s'), " Create new PhpWord object", EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Begin code
|
||||
|
|
@ -22,7 +22,7 @@ $section->addLink('http://www.yahoo.com', null, 'myOwnLinkStyle');
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), " Create new PhpWord object", \EOL;
|
||||
echo date('H:i:s'), " Create new PhpWord object", EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Begin code
|
||||
|
|
@ -17,7 +17,7 @@ $section->addObject('resources/_sheet.xls');
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), " Create new PhpWord object", \EOL;
|
||||
echo date('H:i:s'), " Create new PhpWord object", EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Begin code
|
||||
|
|
@ -66,14 +66,14 @@ $section->addText('Text');
|
|||
$section->addTitle('Subtitle 3.1.2', 3);
|
||||
$section->addText('Text');
|
||||
|
||||
echo date('H:i:s'), " Note: Please refresh TOC manually.", \EOL;
|
||||
echo date('H:i:s'), " Note: Please refresh TOC manually.", EOL;
|
||||
// End code
|
||||
|
||||
// Save file
|
||||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), " Create new PhpWord object", \EOL;
|
||||
echo date('H:i:s'), " Create new PhpWord object", EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Begin code
|
||||
|
|
@ -18,7 +18,7 @@ $section->addText('The header reference to the current section includes a waterm
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), " Create new PhpWord object", \EOL;
|
||||
echo date('H:i:s'), " Create new PhpWord object", EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
// Begin code
|
||||
|
|
@ -31,7 +31,7 @@ $section->addText('Done.');
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), " Create new PhpWord object", \EOL;
|
||||
echo date('H:i:s'), " Create new PhpWord object", EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ $section->addText("Compatible with font colors", array("color"=>"0000ff", "bgCol
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), " Create new PhpWord object", \EOL;
|
||||
echo date('H:i:s'), " Create new PhpWord object", EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
$section = $phpWord->addSection();
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ $section->addText("So: $"."table2->addRow(3750, array('exactHeight'=>true));");
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s'), " Create new PhpWord object", \EOL;
|
||||
echo date('H:i:s'), " Create new PhpWord object", EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
$section = $phpWord->addSection();
|
||||
|
|
@ -18,7 +18,7 @@ $cell->addCheckBox('chkBox2', 'Checkbox 2');
|
|||
$name = basename(__FILE__, '.php');
|
||||
$writers = array('Word2007' => 'docx', 'ODText' => 'odt', 'RTF' => 'rtf');
|
||||
foreach ($writers as $writer => $extension) {
|
||||
echo date('H:i:s'), " Write to {$writer} format", \EOL;
|
||||
echo date('H:i:s'), " Write to {$writer} format", EOL;
|
||||
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, $writer);
|
||||
$xmlWriter->save("{$name}.{$extension}");
|
||||
rename("{$name}.{$extension}", "results/{$name}.{$extension}");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
include_once 'Sample_Header.php';
|
||||
|
||||
// New Word document
|
||||
echo date('H:i:s') , " Create new PhpWord object" , \EOL;
|
||||
echo date('H:i:s') , " Create new PhpWord object" , EOL;
|
||||
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
||||
|
||||
$document = $phpWord->loadTemplate('resources/Sample_23_TemplateBlock.docx');
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class Image extends AbstractElement
|
|||
if (stripos(strrev($source), strrev('.php')) === 0) {
|
||||
$this->isMemImage = true;
|
||||
} else {
|
||||
$this->isMemImage = (filter_var($source, \FILTER_VALIDATE_URL) !== false);
|
||||
$this->isMemImage = (filter_var($source, FILTER_VALIDATE_URL) !== false);
|
||||
}
|
||||
|
||||
// Check supported types
|
||||
|
|
@ -105,9 +105,9 @@ class Image extends AbstractElement
|
|||
}
|
||||
} else {
|
||||
$supportedTypes = array(
|
||||
\IMAGETYPE_JPEG, \IMAGETYPE_GIF,
|
||||
\IMAGETYPE_PNG, \IMAGETYPE_BMP,
|
||||
\IMAGETYPE_TIFF_II, \IMAGETYPE_TIFF_MM
|
||||
IMAGETYPE_JPEG, IMAGETYPE_GIF,
|
||||
IMAGETYPE_PNG, IMAGETYPE_BMP,
|
||||
IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM
|
||||
);
|
||||
if (!file_exists($source)) {
|
||||
throw new InvalidImageException();
|
||||
|
|
@ -124,7 +124,7 @@ class Image extends AbstractElement
|
|||
if (!in_array($this->imageType, $supportedTypes)) {
|
||||
throw new UnsupportedImageTypeException();
|
||||
}
|
||||
$this->imageType = \image_type_to_mime_type($this->imageType);
|
||||
$this->imageType = image_type_to_mime_type($this->imageType);
|
||||
}
|
||||
|
||||
// Set private properties
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ class Object extends AbstractElement
|
|||
$supportedTypes = array('xls', 'doc', 'ppt', 'xlsx', 'docx', 'pptx');
|
||||
$inf = pathinfo($src);
|
||||
|
||||
if (\file_exists($src) && in_array($inf['extension'], $supportedTypes)) {
|
||||
if (file_exists($src) && in_array($inf['extension'], $supportedTypes)) {
|
||||
$this->source = $src;
|
||||
$this->style = $this->setStyle(new ImageStyle(), $style, true);
|
||||
return $this;
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ class PreserveText extends AbstractElement
|
|||
$this->fontStyle = $this->setStyle(new Font('text'), $styleFont);
|
||||
$this->paragraphStyle = $this->setStyle(new Paragraph(), $styleParagraph);
|
||||
|
||||
$matches = preg_split('/({.*?})/', $text, null, \PREG_SPLIT_DELIM_CAPTURE | \PREG_SPLIT_NO_EMPTY);
|
||||
$matches = preg_split('/({.*?})/', $text, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
|
||||
if (isset($matches[0])) {
|
||||
$this->text = $matches;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ class PhpWord
|
|||
*/
|
||||
public function addSection($settings = null)
|
||||
{
|
||||
$section = new Section(\count($this->sections) + 1, $settings);
|
||||
$section = new Section(count($this->sections) + 1, $settings);
|
||||
$this->sections[] = $section;
|
||||
|
||||
return $section;
|
||||
|
|
|
|||
|
|
@ -101,22 +101,22 @@ class RTF extends AbstractWriter implements WriterInterface
|
|||
$sRTFContent .= '\deff0';
|
||||
// Set the default tab size (720 twips)
|
||||
$sRTFContent .= '\deftab720';
|
||||
$sRTFContent .= \PHP_EOL;
|
||||
$sRTFContent .= PHP_EOL;
|
||||
// Set the font tbl group
|
||||
$sRTFContent .= '{\fonttbl';
|
||||
foreach ($this->fontTable as $idx => $font) {
|
||||
$sRTFContent .= '{\f' . $idx . '\fnil\fcharset0 ' . $font . ';}';
|
||||
}
|
||||
$sRTFContent .= '}' . \PHP_EOL;
|
||||
$sRTFContent .= '}' . PHP_EOL;
|
||||
// Set the color tbl group
|
||||
$sRTFContent .= '{\colortbl ';
|
||||
foreach ($this->colorTable as $idx => $color) {
|
||||
$arrColor = Drawing::htmlToRGB($color);
|
||||
$sRTFContent .= ';\red' . $arrColor[0] . '\green' . $arrColor[1] . '\blue' . $arrColor[2] . '';
|
||||
}
|
||||
$sRTFContent .= ';}' . \PHP_EOL;
|
||||
$sRTFContent .= ';}' . PHP_EOL;
|
||||
// Set the generator
|
||||
$sRTFContent .= '{\*\generator PhpWord;}' . \PHP_EOL;
|
||||
$sRTFContent .= '{\*\generator PhpWord;}' . PHP_EOL;
|
||||
// Set the view mode of the document
|
||||
$sRTFContent .= '\viewkind4';
|
||||
// Set the numberof bytes that follows a unicode character
|
||||
|
|
@ -131,7 +131,7 @@ class RTF extends AbstractWriter implements WriterInterface
|
|||
$sRTFContent .= '\kerning1';
|
||||
// Set the font size in half-points
|
||||
$sRTFContent .= '\fs' . (PhpWord::DEFAULT_FONT_SIZE * 2);
|
||||
$sRTFContent .= \PHP_EOL;
|
||||
$sRTFContent .= PHP_EOL;
|
||||
// Body
|
||||
$sRTFContent .= $this->getDataContent();
|
||||
|
||||
|
|
@ -392,7 +392,7 @@ class RTF extends AbstractWriter implements WriterInterface
|
|||
}
|
||||
|
||||
if (!$withoutP) {
|
||||
$sRTFText .= '\par' . \PHP_EOL;
|
||||
$sRTFText .= '\par' . PHP_EOL;
|
||||
}
|
||||
return $sRTFText;
|
||||
}
|
||||
|
|
@ -407,15 +407,15 @@ class RTF extends AbstractWriter implements WriterInterface
|
|||
$sRTFText = '';
|
||||
$elements = $textrun->getElements();
|
||||
if (count($elements) > 0) {
|
||||
$sRTFText .= '\pard\nowidctlpar' . \PHP_EOL;
|
||||
$sRTFText .= '\pard\nowidctlpar' . PHP_EOL;
|
||||
foreach ($elements as $element) {
|
||||
if ($element instanceof Text) {
|
||||
$sRTFText .= '{';
|
||||
$sRTFText .= $this->getDataContentText($element, true);
|
||||
$sRTFText .= '}' . \PHP_EOL;
|
||||
$sRTFText .= '}' . PHP_EOL;
|
||||
}
|
||||
}
|
||||
$sRTFText .= '\par' . \PHP_EOL;
|
||||
$sRTFText .= '\par' . PHP_EOL;
|
||||
}
|
||||
return $sRTFText;
|
||||
}
|
||||
|
|
@ -429,7 +429,7 @@ class RTF extends AbstractWriter implements WriterInterface
|
|||
{
|
||||
$this->lastParagraphStyle = '';
|
||||
|
||||
return '\par' . \PHP_EOL;
|
||||
return '\par' . PHP_EOL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -440,9 +440,9 @@ class RTF extends AbstractWriter implements WriterInterface
|
|||
private function getDataContentUnsupportedElement($element)
|
||||
{
|
||||
$sRTFText = '';
|
||||
$sRTFText .= '\pard\nowidctlpar' . \PHP_EOL;
|
||||
$sRTFText .= '\pard\nowidctlpar' . PHP_EOL;
|
||||
$sRTFText .= "{$element}";
|
||||
$sRTFText .= '\par' . \PHP_EOL;
|
||||
$sRTFText .= '\par' . PHP_EOL;
|
||||
|
||||
return $sRTFText;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ class AutoloaderTest extends \PHPUnit_Framework_TestCase
|
|||
Autoloader::register();
|
||||
$this->assertContains(
|
||||
array('PhpOffice\\PhpWord\\Autoloader', 'autoload'),
|
||||
\spl_autoload_functions()
|
||||
spl_autoload_functions()
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -35,19 +35,19 @@ class AutoloaderTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testAutoload()
|
||||
{
|
||||
$declared = \get_declared_classes();
|
||||
$declaredCount = \count($declared);
|
||||
$declared = get_declared_classes();
|
||||
$declaredCount = count($declared);
|
||||
Autoloader::autoload('Foo');
|
||||
$this->assertEquals(
|
||||
$declaredCount,
|
||||
\count(get_declared_classes()),
|
||||
count(get_declared_classes()),
|
||||
'PhpOffice\\PhpWord\\Autoloader::autoload() is trying to load ' .
|
||||
'classes outside of the PhpOffice\\PhpWord namespace'
|
||||
);
|
||||
// TODO change this class to the main PhpWord class when it is namespaced
|
||||
Autoloader::autoload('PhpOffice\\PhpWord\\Exception\\InvalidStyleException');
|
||||
$this->assertTrue(
|
||||
\in_array('PhpOffice\\PhpWord\\Exception\\InvalidStyleException', \get_declared_classes()),
|
||||
in_array('PhpOffice\\PhpWord\\Exception\\InvalidStyleException', get_declared_classes()),
|
||||
'PhpOffice\\PhpWord\\Autoloader::autoload() failed to autoload the ' .
|
||||
'PhpOffice\\PhpWord\\Exception\\InvalidStyleException class'
|
||||
);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class PhpWordTest extends \PHPUnit_Framework_TestCase
|
|||
$phpWord = new PhpWord();
|
||||
$this->assertEquals(new Section(1), $phpWord->addSection());
|
||||
$phpWord->addSection();
|
||||
$this->assertEquals(2, \count($phpWord->getSections()));
|
||||
$this->assertEquals(2, count($phpWord->getSections()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -144,9 +144,9 @@ class PhpWordTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testLoadTemplateException()
|
||||
{
|
||||
$templateFqfn = \join(
|
||||
\DIRECTORY_SEPARATOR,
|
||||
array(\PHPWORD_TESTS_BASE_DIR, 'PhpWord', 'Tests', '_files', 'templates', 'blanks.docx')
|
||||
$templateFqfn = join(
|
||||
DIRECTORY_SEPARATOR,
|
||||
array(PHPWORD_TESTS_BASE_DIR, 'PhpWord', 'Tests', '_files', 'templates', 'blanks.docx')
|
||||
);
|
||||
$phpWord = new PhpWord();
|
||||
$phpWord->loadTemplate($templateFqfn);
|
||||
|
|
|
|||
|
|
@ -128,9 +128,9 @@ class ODTextTest extends \PHPUnit_Framework_TestCase
|
|||
public function testSetGetUseDiskCaching()
|
||||
{
|
||||
$object = new ODText();
|
||||
$object->setUseDiskCaching(true, \PHPWORD_TESTS_BASE_DIR);
|
||||
$object->setUseDiskCaching(true, PHPWORD_TESTS_BASE_DIR);
|
||||
$this->assertTrue($object->getUseDiskCaching());
|
||||
$this->assertEquals(\PHPWORD_TESTS_BASE_DIR, $object->getDiskCachingDirectory());
|
||||
$this->assertEquals(PHPWORD_TESTS_BASE_DIR, $object->getDiskCachingDirectory());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -140,9 +140,9 @@ class ODTextTest extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testSetUseDiskCachingException()
|
||||
{
|
||||
$dir = \join(
|
||||
\DIRECTORY_SEPARATOR,
|
||||
array(\PHPWORD_TESTS_BASE_DIR, 'foo')
|
||||
$dir = join(
|
||||
DIRECTORY_SEPARATOR,
|
||||
array(PHPWORD_TESTS_BASE_DIR, 'foo')
|
||||
);
|
||||
|
||||
$object = new ODText();
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ class Word2007Test extends \PHPUnit_Framework_TestCase
|
|||
$phpWord = new PhpWord();
|
||||
$section = $phpWord->addSection();
|
||||
$object = new Word2007($phpWord);
|
||||
$object->setUseDiskCaching(true, \PHPWORD_TESTS_BASE_DIR);
|
||||
$object->setUseDiskCaching(true, PHPWORD_TESTS_BASE_DIR);
|
||||
$writer = new Word2007($phpWord);
|
||||
$writer->save('php://output');
|
||||
|
||||
|
|
@ -183,9 +183,9 @@ class Word2007Test extends \PHPUnit_Framework_TestCase
|
|||
*/
|
||||
public function testSetUseDiskCachingException()
|
||||
{
|
||||
$dir = \join(
|
||||
\DIRECTORY_SEPARATOR,
|
||||
array(\PHPWORD_TESTS_BASE_DIR, 'foo')
|
||||
$dir = join(
|
||||
DIRECTORY_SEPARATOR,
|
||||
array(PHPWORD_TESTS_BASE_DIR, 'foo')
|
||||
);
|
||||
|
||||
$object = new Word2007();
|
||||
|
|
|
|||
|
|
@ -16,11 +16,11 @@ if (!defined('PHPWORD_TESTS_BASE_DIR')) {
|
|||
|
||||
$vendor = realpath(__DIR__ . '/../vendor');
|
||||
|
||||
if (\file_exists($vendor . "/autoload.php")) {
|
||||
if (file_exists($vendor . "/autoload.php")) {
|
||||
require $vendor . "/autoload.php";
|
||||
} else {
|
||||
$vendor = realpath(__DIR__ . '/../../../');
|
||||
if (\file_exists($vendor . "/autoload.php")) {
|
||||
if (file_exists($vendor . "/autoload.php")) {
|
||||
require $vendor . "/autoload.php";
|
||||
} else {
|
||||
throw new Exception("Unable to load dependencies");
|
||||
|
|
@ -35,7 +35,7 @@ spl_autoload_register(function ($class) {
|
|||
$class = join(DIRECTORY_SEPARATOR, array('PhpWord', 'Tests', '_includes')) .
|
||||
substr($class, strlen($prefix));
|
||||
$file = __DIR__ . DIRECTORY_SEPARATOR . $class . '.php';
|
||||
if (\file_exists($file)) {
|
||||
if (file_exists($file)) {
|
||||
require_once $file;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue