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
|
2014-04-08 21:56:18 +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();
|
2014-03-06 22:07:09 +07: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.';
|
|
|
|
|
|
|
|
|
|
// Normal
|
2014-04-02 11:02:56 +07:00
|
|
|
$section = $phpWord->addSection();
|
2014-03-06 22:07:09 +07:00
|
|
|
$section->addText('Normal paragraph. ' . $filler);
|
|
|
|
|
|
|
|
|
|
// Two columns
|
2014-04-02 11:02:56 +07:00
|
|
|
$section = $phpWord->addSection(array(
|
2014-03-06 22:07:09 +07:00
|
|
|
'colsNum' => 2,
|
|
|
|
|
'colsSpace' => 1440,
|
|
|
|
|
'breakType' => 'continuous'));
|
|
|
|
|
$section->addText('Three columns, one inch (1440 twips) spacing. ' . $filler);
|
|
|
|
|
|
|
|
|
|
// Normal
|
2014-04-02 11:02:56 +07:00
|
|
|
$section = $phpWord->addSection(array('breakType' => 'continuous'));
|
2014-03-06 22:07:09 +07:00
|
|
|
$section->addText('Normal paragraph again. ' . $filler);
|
|
|
|
|
|
|
|
|
|
// Three columns
|
2014-04-02 11:02:56 +07:00
|
|
|
$section = $phpWord->addSection(array(
|
2014-03-06 22:07:09 +07:00
|
|
|
'colsNum' => 3,
|
|
|
|
|
'colsSpace' => 720,
|
|
|
|
|
'breakType' => 'continuous'));
|
|
|
|
|
$section->addText('Three columns, half inch (720 twips) spacing. ' . $filler);
|
|
|
|
|
|
|
|
|
|
// Normal
|
2014-04-02 11:02:56 +07:00
|
|
|
$section = $phpWord->addSection(array('breakType' => 'continuous'));
|
2014-03-06 22:07:09 +07:00
|
|
|
$section->addText('Normal paragraph again.');
|
|
|
|
|
|
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
|
|
|
}
|