enumerations-numberings.txt 2.15 KB
Enumerations / Numberings
*************************

Enumerations and numberings can be added to table cells and sections. They can be nested.


Enumerations
=============

Enumeration example:

.. code-block:: php

    <?php
    // first level enumeration
    $enum = new PHPRtfLite_List_Enumeration($rtf);
    $enum->addItem('hello world');
    $enum->addItem('foo');
    $enum->addItem('bar');
    // second level enumeration
    $subEnum = new PHPRtfLite_List_Enumeration($rtf);
    $subEnum->addItem('hello world');
    $subEnum->addItem('foo');
    $subEnum->addItem('bar');
    $enum->addList($subEnum);
    
    $section = $rtf->addSection();
    // add enumeration to a section
    $section->addList($enum);


For enumerations the following types are supported:

- TYPE_BULLET   uses bullets as enumeration characters (default)
- TYPE_ARROW    uses arrows as enumeration characters
- TYPE_CIRCLE   uses circles as enumeration characters
- TYPE_SQUARE   uses squares as enumeration characters
- TYPE_DIAMOND  uses diamonds as enumeration characters

The bullet character are the default character for enumerations.
    

Numberings
=============

Numbering example:

.. code-block:: php

    <?php
    // first level numbering
    $numList = new PHPRtfLite_List_Numbering($rtf);
    $numList->addItem('hello world');
    $numList->addItem('foo');
    $numList->addItem('bar');

    // second level numbering
    $subNumList = new PHPRtfLite_List_Numbering($rtf);
    $subNumList->addItem('hello world');
    $subNumList->addItem('foo');
    $subNumList->addItem('bar');
    $numList->addList($subNumList);
    // add item in the first level
    $numList->addItem('foobar');

    $section = $rtf->addSection();
    // add numbering to a section
    $section->addList($numList);


For numberings the following types are supported:

- TYPE_ARABIC_NUM   counting in arabic numbers (default)
- TYPE_ALPHA_UPPER  counting in alphanumeric characters in upper case
- TYPE_ALPHA_LOWER  counting in alphanumeric characters in lower case
- TYPE_ROMAN_UPPER  counting in roman characters in upper case
- TYPE_ROMAN_LOWER  counting in roman characters in lower case

Arabic numbering is the default type.