2014-03-06 22:07:09 +07:00
|
|
|
<?php
|
2014-03-15 22:39:57 +07:00
|
|
|
include_once 'Sample_Header.php';
|
2014-03-06 22:07:09 +07: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();
|
2015-01-01 20:41:42 +04:00
|
|
|
$filler = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. '
|
|
|
|
|
. 'Nulla fermentum, tortor id adipiscing adipiscing, tortor turpis commodo. '
|
|
|
|
|
. 'Donec vulputate iaculis metus, vel luctus dolor hendrerit ac. '
|
|
|
|
|
. 'Suspendisse congue congue leo sed pellentesque.';
|
2014-03-06 22:07:09 +07:00
|
|
|
|
|
|
|
|
// Normal
|
2014-04-02 11:02:56 +07:00
|
|
|
$section = $phpWord->addSection();
|
2016-06-04 20:06:37 +04:00
|
|
|
$section->addText("Normal paragraph. {$filler}");
|
2014-03-06 22:07:09 +07:00
|
|
|
|
|
|
|
|
// Two columns
|
2015-01-01 20:41:42 +04:00
|
|
|
$section = $phpWord->addSection(
|
|
|
|
|
array(
|
|
|
|
|
'colsNum' => 2,
|
|
|
|
|
'colsSpace' => 1440,
|
|
|
|
|
'breakType' => 'continuous',
|
|
|
|
|
)
|
|
|
|
|
);
|
2016-06-04 20:06:37 +04:00
|
|
|
$section->addText("Two columns, one inch (1440 twips) spacing. {$filler}");
|
2014-03-06 22:07:09 +07:00
|
|
|
|
|
|
|
|
// Normal
|
2014-04-02 11:02:56 +07:00
|
|
|
$section = $phpWord->addSection(array('breakType' => 'continuous'));
|
2016-06-04 20:06:37 +04:00
|
|
|
$section->addText("Normal paragraph again. {$filler}");
|
2014-03-06 22:07:09 +07:00
|
|
|
|
|
|
|
|
// Three columns
|
2015-01-01 20:41:42 +04:00
|
|
|
$section = $phpWord->addSection(
|
|
|
|
|
array(
|
|
|
|
|
'colsNum' => 3,
|
|
|
|
|
'colsSpace' => 720,
|
|
|
|
|
'breakType' => 'continuous',
|
|
|
|
|
)
|
|
|
|
|
);
|
2016-06-04 20:06:37 +04:00
|
|
|
$section->addText("Three columns, half inch (720 twips) spacing. {$filler}");
|
2014-03-06 22:07:09 +07:00
|
|
|
|
|
|
|
|
// Normal
|
2014-04-02 11:02:56 +07:00
|
|
|
$section = $phpWord->addSection(array('breakType' => 'continuous'));
|
2016-06-04 20:06:37 +04:00
|
|
|
$section->addText("Normal paragraph again. {$filler}");
|
2014-03-06 22:07:09 +07: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
|
|
|
}
|