add exmpales
[pear-examples] / Document_Word_Writer / Examples / Section.php
1 <?php
2 ini_set('include_path', __DIR__  . '/../../..:.');
3 require_once __DIR__ . '/../Writer.php';
4
5 // New Word Document
6 $PHPWord = new Document_Word_Writer();
7
8 // New portrait section
9 $section = $PHPWord->createSection(array('borderColor'=>'00FF00', 'borderSize'=>12));
10 $section->addText('I am placed on a default section.');
11
12 // New landscape section
13 $section = $PHPWord->createSection(array('orientation'=>'landscape'));
14 $section->addText('I am placed on a landscape section. Every page starting from this section will be landscape style.');
15 $section->addPageBreak();
16 $section->addPageBreak();
17
18 // New portrait section
19 $section = $PHPWord->createSection(array('marginLeft'=>600, 'marginRight'=>600, 'marginTop'=>600, 'marginBottom'=>600));
20 $section->addText('This section uses other margins.');
21
22
23
24 // Save File
25 require_once __DIR__ . '/../Writer/IOFactory.php';
26 $objWriter = Document_Word_Writer_IOFactory::createWriter($PHPWord, 'Word2007');
27 $objWriter->save('/tmp/Section.docx');
28 ?>