lists.php
1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
$dir = dirname(__FILE__);
require_once $dir . '/../lib/PHPRtfLite.php';
// register PHPRtfLite class loader
PHPRtfLite::registerAutoloader();
$rtf = new PHPRtfLite();
$sect = $rtf->addSection();
$sect->writeText('Text before the list');
$enum = new PHPRtfLite_List_Enumeration($rtf);
$enum->addItem('hello world');
$enum->addItem('foo');
$enum->addItem('bar');
$subEnum = new PHPRtfLite_List_Enumeration($rtf);
$subEnum->addItem('hello world');
$subEnum->addItem('foo');
$subEnum->addItem('bar');
$enum->addList($subEnum);
$sect->addEnumeration($enum);
$subSubNumList = new PHPRtfLite_List_Numbering($rtf);
$subSubNumList->addItem('hello world');
$subSubNumList->addItem('foo');
$subSubNumList->addItem('bar');
$subNumList = new PHPRtfLite_List_Numbering($rtf);
$subNumList->addItem('hello world');
$subNumList->addItem('foo');
$subNumList->addItem('bar');
$subNumList->addList($subSubNumList);
$font = new PHPRtfLite_Font('26', 'Tahoma', '#f00');
$numList = new PHPRtfLite_List_Numbering($rtf, null, $font);
$numList->addItem('hello world');
$numList->addItem('foo');
$numList->addItem('bar');
$numList->addList($subNumList);
$numList->addItem('foobar');
$sect->addNumbering($numList);
// save rtf document
$rtf->save($dir . '/generated/' . basename(__FILE__, '.php') . '.rtf');