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
|
|
|
|
2016-06-04 20:06:37 +04:00
|
|
|
// Define styles
|
|
|
|
|
$multipleTabsStyleName = 'multipleTab';
|
2015-01-01 20:41:42 +04:00
|
|
|
$phpWord->addParagraphStyle(
|
2016-06-04 20:06:37 +04:00
|
|
|
$multipleTabsStyleName,
|
2015-01-01 20:41:42 +04:00
|
|
|
array(
|
|
|
|
|
'tabs' => array(
|
|
|
|
|
new \PhpOffice\PhpWord\Style\Tab('left', 1550),
|
|
|
|
|
new \PhpOffice\PhpWord\Style\Tab('center', 3200),
|
|
|
|
|
new \PhpOffice\PhpWord\Style\Tab('right', 5300),
|
2017-11-04 22:44:12 +01:00
|
|
|
),
|
2015-01-01 20:41:42 +04:00
|
|
|
)
|
|
|
|
|
);
|
2016-06-04 20:06:37 +04:00
|
|
|
|
|
|
|
|
$rightTabStyleName = 'rightTab';
|
|
|
|
|
$phpWord->addParagraphStyle($rightTabStyleName, array('tabs' => array(new \PhpOffice\PhpWord\Style\Tab('right', 9090))));
|
|
|
|
|
|
|
|
|
|
$leftTabStyleName = 'centerTab';
|
|
|
|
|
$phpWord->addParagraphStyle($leftTabStyleName, 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
|
2016-06-04 20:06:37 +04:00
|
|
|
$section->addText("Multiple Tabs:\tOne\tTwo\tThree", null, $multipleTabsStyleName);
|
|
|
|
|
$section->addText("Left Aligned\tRight Aligned", null, $rightTabStyleName);
|
|
|
|
|
$section->addText("\tCenter Aligned", null, $leftTabStyleName);
|
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
|
|
|
}
|