2013-12-15 14:35:18 +01:00
|
|
|
<?php
|
2014-03-15 22:39:57 +07:00
|
|
|
include_once 'Sample_Header.php';
|
2013-12-15 14:35:18 +01:00
|
|
|
|
|
|
|
|
// New Word Document
|
2015-01-01 20:41:42 +04:00
|
|
|
echo date('H:i:s'), ' Create new PhpWord object', EOL;
|
2014-03-23 10:32:08 +04:00
|
|
|
$phpWord = new \PhpOffice\PhpWord\PhpWord();
|
2013-12-15 14:35:18 +01:00
|
|
|
|
|
|
|
|
// Ads styles
|
2015-01-01 20:41:42 +04:00
|
|
|
$phpWord->addParagraphStyle(
|
|
|
|
|
'multipleTab',
|
|
|
|
|
array(
|
|
|
|
|
'tabs' => array(
|
|
|
|
|
new \PhpOffice\PhpWord\Style\Tab('left', 1550),
|
|
|
|
|
new \PhpOffice\PhpWord\Style\Tab('center', 3200),
|
|
|
|
|
new \PhpOffice\PhpWord\Style\Tab('right', 5300),
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
$phpWord->addParagraphStyle(
|
|
|
|
|
'rightTab',
|
|
|
|
|
array('tabs' => array(new \PhpOffice\PhpWord\Style\Tab('right', 9090)))
|
|
|
|
|
);
|
|
|
|
|
$phpWord->addParagraphStyle(
|
|
|
|
|
'centerTab',
|
|
|
|
|
array('tabs' => array(new \PhpOffice\PhpWord\Style\Tab('center', 4680)))
|
|
|
|
|
);
|
2013-12-15 14:35:18 +01:00
|
|
|
|
|
|
|
|
// New portrait section
|
2014-04-02 11:02:56 +07:00
|
|
|
$section = $phpWord->addSection();
|
2013-12-15 14:35:18 +01:00
|
|
|
|
|
|
|
|
// Add listitem elements
|
2015-01-01 20:41:42 +04:00
|
|
|
$section->addText(htmlspecialchars("Multiple Tabs:\tOne\tTwo\tThree"), null, 'multipleTab');
|
|
|
|
|
$section->addText(htmlspecialchars("Left Aligned\tRight Aligned"), null, 'rightTab');
|
|
|
|
|
$section->addText(htmlspecialchars("\tCenter Aligned"), null, 'centerTab');
|
2013-12-15 14:35:18 +01:00
|
|
|
|
2014-03-12 21:55:20 +07:00
|
|
|
// Save file
|
2014-04-12 10:12:24 +07:00
|
|
|
echo write($phpWord, basename(__FILE__, '.php'), $writers);
|
|
|
|
|
if (!CLI) {
|
|
|
|
|
include_once 'Sample_Footer.php';
|
2014-03-12 21:55:20 +07:00
|
|
|
}
|