Formatting *************** Fonts --------------- Size, Font family, Font color, Background color ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ To format text, you can use the ``PHPRtfLite_Font``. Example sets size to 12pt, font family to Arial, font color to red, and background color to blue: .. code-block:: php addSection(); $font = new PHPRtfLite_Font(12, 'Arial', '#FF0000', '#0000FF'); $section->writeText('Lorem ipsum', $font); Text formatting ~~~~~~~~~~~~~~~ .. code-block:: php addSection(); $font = new PHPRtfLite_Font(); $font->setBold(); // bold font $font->setItalic(); // italic font $font->setUnderline(); // underline font $font->setStriked(); // strike text $font->setDoubleStriked(); // double strike text $section->writeText('Lorem ipsum', $font); HTML-Tags as text formatting ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ You can use HTML-Tags in your text to format text: .. code-block:: php addSection(); // text will be displayed as bold $section->writeText('text'); $section->writeText('text'); // text will be displayed as italic $section->writeText('text'); $section->writeText('text'); // text will be displayed as underlined $section->writeText('text'); // text will start with a bullet $section->writeText(' text'); // text will have a line break after $section->writeText('text
'); // text will have a horizontal rule after $section->writeText('text
'); // tabulator will be displayed between text $section->writeText('texttext'); // will display section number before "hello world" $section->writeText(' hello world'); // will display page number before "hello world" $section->writeText(' hello world'); Text animation ~~~~~~~~~~~~~~ Class constants for text animation: - ``ANIMATE_LAS_VEGAS_LIGHTS`` - ``ANIMATE_BLINKING_BACKGROUND`` - ``ANIMATE_SPARKLE_TEXT`` - ``ANIMATE_MARCHING_BLACK_ANTS`` - ``ANIMATE_MARCHING_RED_ANTS`` - ``ANIMATE_SHIMMER`` .. code-block:: php addSection(); $font = new PHPRtfLite_Font(); // text with marching black ants around $font->setAnimation(PHPRtfLite_Font::ANIMATE_MARCHING_BLACK_ANTS); $section->writeText('Lorem ipsum', $font); Paragraph formatting -------------------- Text alignment ~~~~~~~~~~~~~~~~~~~~ Class constants for text alignment: - ``TEXT_ALIGN_LEFT`` - ``TEXT_ALIGN_RIGHT`` - ``TEXT_ALIGN_CENTER`` - ``TEXT_ALIGN_JUSTIFY`` .. code-block:: php addSection(); // centered text $parFormat = new PHPRtfLite_ParFormat(PHPRtfLite_ParFormat::TEXT_ALIGN_CENTER); $section->writeText('Lorem ipsum', null, $parFormat); Paragraph indention ~~~~~~~~~~~~~~~~~~~~ First line indention: .. code-block:: php addSection(); $parFormat = new PHPRtfLite_ParFormat(); // first line of paragraph will be indented by 1cm $parFormat->setIndentFirstLine(1); $section->writeText('Lorem ipsum', null, $parFormat); Indent the whole paragraph left or/and right: .. code-block:: php setIndentLeft(1); $parFormat->setIndentRight(1); Space between paragraphs ~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: php setSpaceAfter(1); // spaces in lines before the paragraph $parFormat->setSpaceBefore(1); Space between lines ~~~~~~~~~~~~~~~~~~~~~~~~~ .. code-block:: php setSpaceBetweenLines(1); Background color ~~~~~~~~~~~~~~~~~~~~~~~~ Paragraph background color: .. code-block:: php setBackgroundColor('#FF0000'); .. _borders: Borders ~~~~~~~~~~~~~~~~ .. code-block:: php setBorder($border); There are some alternative ways to create borders: .. code-block:: php setBorders(new PHPRtfLite_Border_Format(2, '#00FF00')); Border style types ^^^^^^^^^^^^^^^^^^ Border style types represented as class constants of ``PHPRtfLite_Border_Format`` are: - ``TYPE_SINGLE`` - ``TYPE_DOT`` - ``TYPE_DASH`` - ``TYPE_DOTDASH``