Sample 16 Object

04:26:30 Create new PhpWord object
04:26:30 Write to Word2007 format
04:26:30 Write to ODText format
04:26:30 Write to RTF format
04:26:30 Write to HTML format
04:26:30 Write to PDF format
04:26:30 Done writing file(s)
04:26:30 Peak memory usage: 6 MB

 

Results: docx odt rtf html pdf


<?php

include_once 'Sample_Header.php';

// New Word document
echo date('H:i:s'), ' Create new PhpWord object'EOL;
$phpWord = new \PhpOffice\PhpWord\PhpWord();

// Begin code
$section $phpWord->addSection();
$section->addText('You can open this OLE object by double clicking on the icon:');
$section->addTextBreak(2);
$section->addOLEObject('resources/_sheet.xls');

// Save file
echo write($phpWordbasename(__FILE__'.php'), $writers);
if (!
CLI) {
    include_once 
'Sample_Footer.php';
}