PHP Class PHPRtfLite_Container_Base

Author: Steffen Zeidler ([email protected])
Show file Open project: phprtflite/phprtflite Class Usage Examples

Protected Properties

Property Type Description
$_elements PHPRtfLite_Table_Cell[] | PHPRtfLite_Element[] | PHPRtfLite_Image[] | PHPRtfLite_FormField[]
$_pard string
$_rtf PHPRtfLite

Public Methods

Method Description
__construct ( PHPRtfLite $rtf ) constructor
addElement ( $element ) adds element
addEmptyParagraph ( PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null ) : PHPRtfLite_Element adds empty paragraph to container.
addImage ( string $fileName, PHPRtfLite_ParFormat $parFormat = null, float $width = null, float $height = null ) : PHPRtfLite_Image adds image to element container.
addImageFromString ( string $string, string $type, PHPRtfLite_ParFormat $parFormat = null, float $width = null, float $height = null ) : PHPRtfLite_Image adds image to element container.
addTable ( string $alignment = PHPRtfLite_Table::ALIGN_LEFT ) : PHPRtfLite_Table adds table to element container.
countElements ( ) : integer counts container elements
free ( )
getElements ( ) : array gets container elements
getRtf ( ) : PHPRtfLite gets rtf object
render ( ) : string renders rtf code for that container
writeHyperLink ( string $hyperlink, string $text, PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null, boolean $convertTagsToRtf = true ) : PHPRtfLite_Element writes hyperlink to container.
writePlainRtfCode ( string $code ) : PHPRtfLite_Element adds element with plain rtf code directly (no converting will be made by PHPRtfLite - even no opening and closing curly brackets)
writeRtfCode ( string $code, PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null ) : PHPRtfLite_Element adds element with rtf code directly (no converting will be made by PHPRtfLite)
writeText ( string $text, PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null, boolean $convertTagsToRtf = true ) : PHPRtfLite_Element writes text to container.

Private Methods

Method Description
getCellFont ( PHPRtfLite_Table $element ) : PHPRtfLite_Font gets font if container is a cell
needToAddParagraphEnd ( integer $key ) : boolean checks, if a \par has to be added

Method Details

__construct() public method

constructor
public __construct ( PHPRtfLite $rtf )
$rtf PHPRtfLite

addElement() public method

adds element
public addElement ( $element )
$element

addEmptyParagraph() public method

adds empty paragraph to container.
public addEmptyParagraph ( PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null ) : PHPRtfLite_Element
$font PHPRtfLite_Font
$parFormat PHPRtfLite_ParFormat
return PHPRtfLite_Element

addImage() public method

adds image to element container.
public addImage ( string $fileName, PHPRtfLite_ParFormat $parFormat = null, float $width = null, float $height = null ) : PHPRtfLite_Image
$fileName string name of image file.
$parFormat PHPRtfLite_ParFormat paragraph format, ff null image will appear in the same paragraph.
$width float if null image is displayed by it's height.
$height float if null image is displayed by it's width. If boths parameters are null, image is displayed as it is.
return PHPRtfLite_Image

addImageFromString() public method

adds image to element container.
public addImageFromString ( string $string, string $type, PHPRtfLite_ParFormat $parFormat = null, float $width = null, float $height = null ) : PHPRtfLite_Image
$string string name of image file.
$type string class constants of PHPRtfLite_Image: TYPE_JPEG, TYPE_PNG, TYPE_WMF
$parFormat PHPRtfLite_ParFormat paragraph format, ff null image will appear in the same paragraph.
$width float if null image is displayed by it's height.
$height float if null image is displayed by it's width. If boths parameters are null, image is displayed as it is.
return PHPRtfLite_Image

addTable() public method

adds table to element container.
public addTable ( string $alignment = PHPRtfLite_Table::ALIGN_LEFT ) : PHPRtfLite_Table
$alignment string Alingment of table. Represented by class constants PHPRtfLite_Table::ALIGN_*
Possible values:
PHPRtfLite_Table::ALIGN_LEFT => 'left',
PHPRtfLite_Table::ALIGN_CENTER => 'center',
PHPRtfLite_Table::ALIGN_RIGHT => 'right'
return PHPRtfLite_Table

countElements() public method

counts container elements
public countElements ( ) : integer
return integer

free() public method

public free ( )

getElements() public method

gets container elements
public getElements ( ) : array
return array

getRtf() public method

gets rtf object
public getRtf ( ) : PHPRtfLite
return PHPRtfLite

render() public method

renders rtf code for that container
public render ( ) : string
return string rtf code

writePlainRtfCode() public method

adds element with plain rtf code directly (no converting will be made by PHPRtfLite - even no opening and closing curly brackets)
public writePlainRtfCode ( string $code ) : PHPRtfLite_Element
$code string
return PHPRtfLite_Element

writeRtfCode() public method

adds element with rtf code directly (no converting will be made by PHPRtfLite)
public writeRtfCode ( string $code, PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null ) : PHPRtfLite_Element
$code string
$font PHPRtfLite_Font
$parFormat PHPRtfLite_ParFormat
return PHPRtfLite_Element

writeText() public method

writes text to container.
public writeText ( string $text, PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null, boolean $convertTagsToRtf = true ) : PHPRtfLite_Element
$text string Text. Also you can use html style tags. Possible tags:
strong, b- bold;
em - ;
i - italic;
u - underline;
br - line break;
chdate - current date;
chdpl - current date in long format;
chdpa - current date in abbreviated format;
chtime - current time;
chpgn, pagenum - page number ;
tab - tab sectnum - section number;
line - line break;
page - page break;
sect - section break;
$font PHPRtfLite_Font font of text
$parFormat PHPRtfLite_ParFormat paragraph format, if null, text is written in the same paragraph.
$convertTagsToRtf boolean if false, then html style tags are not replaced with rtf code
return PHPRtfLite_Element

Property Details

$_elements protected property

protected PHPRtfLite_Table_Cell[]|PHPRtfLite_Element[]|PHPRtfLite_Image[]|PHPRtfLite_FormField[] $_elements
return PHPRtfLite_Table_Cell[] | PHPRtfLite_Element[] | PHPRtfLite_Image[] | PHPRtfLite_FormField[]

$_pard protected property

protected string $_pard
return string

$_rtf protected property

protected PHPRtfLite $_rtf
return PHPRtfLite