PHP 클래스 PHPRtfLite_Table

저자: Denis Slaveckij ([email protected])
저자: Steffen Zeidler ([email protected])
파일 보기 프로젝트 열기: phprtflite/phprtflite 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_alignment string
$_columns PHPRtfLite_Table_Column[] array of PHPRtfLite_Table_Column instances
$_container PHPRtfLite_Container
$_firstRowIsHeader boolean
$_leftPosition integer
$_nestDepth integer .. and so on ..
$_preventEmptyParagraph boolean flag for preventing an empty paragraph after table
$_preventPageBreak boolean
$_repeatFirstRowHeader boolean
$_rows PHPRtfLite_Table_Row[] array of PHPRtfLite_Table_Row instances

공개 메소드들

메소드 설명
__construct ( PHPRtfLite_Container_Base $container, string $alignment = self::ALIGN_LEFT, integer $nestDepth = 1 ) constructor
addColumn ( float $width ) : PHPRtfLite_Table_Column adds column
addColumnsList ( $columnWidths ) adds list of columns
addImageFromStringToCell ( integer $rowIndex, integer $columnIndex, string $imageString, string $type, PHPRtfLite_ParFormat $parFormat = null, float $width = null, float $height = null ) : PHPRtfLite_Image adds image to cell
addImageToCell ( integer $rowIndex, integer $columnIndex, string $file, PHPRtfLite_ParFormat $parFormat = null, float $width = null, float $height = null ) : PHPRtfLite_Image adds image to cell
addRow ( float $height = null ) : PHPRtfLite_Table_Row adds row
addRowList ( array $heights ) adds list of rows to a table.
addRows ( integer $rowCnt, float $height = null ) adds rows
checkColumnIndex ( integer $colIndex ) : boolean returns true, if column index is valid
checkIfCellExists ( integer $rowIndex, integer $columnIndex ) : boolean returns true, if rowIndex and columnIndex do exists in table
checkRowIndex ( integer $rowIndex ) : boolean returns true, if row index is valid
free ( )
getAlignment ( ) : string gets alignment
getCell ( integer $rowIndex, integer $columnIndex ) : PHPRtfLite_Table_Cell gets the instance of cell
getColumn ( integer $colIndex ) : PHPRtfLite_Table_Column gets column
getColumns ( ) : PHPRtfLite_Table_Column[] gets table columns
getColumnsCount ( ) : integer gets number of columns in table
getContainer ( ) : PHPRtfLite_Container gets rtf container instance
getLeftPosition ( ) : float gets left position of table
getNestDepth ( ) : integer gets nested depth
getPreventEmptyParagraph ( ) : boolean returns true, if no empty paragraph should be added after table
getRow ( integer $rowIndex ) : PHPRtfLite_Table_Row gets row instance
getRows ( ) : PHPRtfLite_Table_Row[] gets table rows
getRowsCount ( ) : integer gets number of rows in table
getRtf ( ) : PHPRtfLite gets rtf instance
isFirstRowHeader ( ) : boolean Returns true, if first row should be used as header. First row will be repeated at the top of each page.
isNestedTable ( ) : boolean checks, if table is a nested table
isPreventPageBreak ( ) : boolean returns true, if a table should not be splited by a page break
mergeCellRange ( integer $startRow, integer $startColumn, integer $endRow, integer $endColumn ) merges cells of a given cell range
preventEmptyParagraph ( $value = true ) prevents adding an empty paragraph after table
render ( ) : string gets rtf code for table
renderRowDefinition ( PHPRtfLite_Table_Row $row ) renders row definition
rotateCellRange ( string $rotateTo, integer $startRow, integer $startColumn, integer $endRow = null, integer $endColumn = null ) rotates cells of a given cell range
setBackgroundForCellRange ( string $backgroundColor, integer $startRow, integer $startColumn, integer $endRow = null, integer $endColumn = null ) sets background color of cells of a given cell range
setBorderForCellRange ( PHPRtfLite_Border $border, integer $startRow, integer $startColumn, integer $endRow = null, integer $endColumn = null ) sets border to cells of a given cell range
setBordersForCellRange ( PHPRtfLite_Border_Format $borderFormat, integer $startRow, integer $startColumn, integer $endRow = null, integer $endColumn = null, boolean $left = true, boolean $top = true, boolean $right = true, boolean $bottom = true )
setFirstRowAsHeader ( ) Sets first row as header row. First row will be repeated at the top of each page.
setFontForCellRange ( PHPRtfLite_Font $font, integer $startRow, integer $startColumn, integer $endRow = null, integer $endColumn = null ) sets font to empty cells of a given cell range
setLeftPosition ( float $leftPosition ) sets left position of table
setPreventPageBreak ( ) Sets that table won't be splited by a page break. By default page break splits table.
setTextAlignmentForCellRange ( string $alignment, integer $startRow, integer $startColumn, integer $endRow = null, integer $endColumn = null ) sets alignments to empty cells of a given cell range
setVerticalAlignmentForCellRange ( string $verticalAlignment, integer $startRow, integer $startColumn, integer $endRow = null, integer $endColumn = null ) sets vertical alignment to cells of a given cell range
writeToCell ( integer $rowIndex, integer $columnIndex, string $text, PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null, boolean $convertTagsToRtf = true ) : PHPRtfLite_Element writes text to cell

보호된 메소드들

메소드 설명
renderRowCells ( PHPRtfLite_Table_Row $row ) renders row cells

비공개 메소드들

메소드 설명
getCellsByCellRange ( integer $startRow, integer $startColumn, integer $endRow, integer $endColumn ) : PHPRtfLite_Table_Cell[]
getValidCellRange ( integer $startRow, integer $startColumn, integer $endRow, integer $endColumn ) : array corrects cell range to be valid

메소드 상세

__construct() 공개 메소드

constructor
public __construct ( PHPRtfLite_Container_Base $container, string $alignment = self::ALIGN_LEFT, integer $nestDepth = 1 )
$container PHPRtfLite_Container_Base
$alignment string
$nestDepth integer

addColumn() 공개 메소드

adds column
public addColumn ( float $width ) : PHPRtfLite_Table_Column
$width float column width
리턴 PHPRtfLite_Table_Column

addColumnsList() 공개 메소드

adds list of columns
public addColumnsList ( $columnWidths )

addImageFromStringToCell() 공개 메소드

adds image to cell
public addImageFromStringToCell ( integer $rowIndex, integer $columnIndex, string $imageString, string $type, PHPRtfLite_ParFormat $parFormat = null, float $width = null, float $height = null ) : PHPRtfLite_Image
$rowIndex integer row index of cell
$columnIndex integer column index of cell
$imageString string image source code
$type string image type (GD, WMF)
$parFormat PHPRtfLite_ParFormat paragraph format
$width float if null image is displayed by it's original height.
$height float if null image is displayed by it's original width. If boths parameters are null, image is displayed as it is.
리턴 PHPRtfLite_Image

addImageToCell() 공개 메소드

adds image to cell
public addImageToCell ( integer $rowIndex, integer $columnIndex, string $file, PHPRtfLite_ParFormat $parFormat = null, float $width = null, float $height = null ) : PHPRtfLite_Image
$rowIndex integer row index of cell
$columnIndex integer column index of cell
$file string image file.
$parFormat PHPRtfLite_ParFormat paragraph format
$width float if null image is displayed by it's original height.
$height float if null image is displayed by it's original width. If boths parameters are null, image is displayed as it is.
리턴 PHPRtfLite_Image

addRow() 공개 메소드

adds row
public addRow ( float $height = null ) : PHPRtfLite_Table_Row
$height float row height. When 0, the height is sufficient for all the text in the line; when positive, the height is guaranteed to be at least the specified height; when negative, the absolute value of the height is used, regardless of the height of the text in the line.
리턴 PHPRtfLite_Table_Row

addRowList() 공개 메소드

adds list of rows to a table.
public addRowList ( array $heights )
$heights array array of heights for each row to add. When height is null, the height is sufficient for all the text in the line; when positive, the height is guaranteed to be at least the specified height; when negative, the absolute value of the height is used, regardless of the height of the text in the line.

addRows() 공개 메소드

adds rows
public addRows ( integer $rowCnt, float $height = null )
$rowCnt integer
$height float row height. When null, the height is sufficient for all the text in the line; when positive, the height is guaranteed to be at least the specified height; when negative, the absolute value of the height is used, regardless of the height of the text in the line.

checkColumnIndex() 공개 메소드

returns true, if column index is valid
public checkColumnIndex ( integer $colIndex ) : boolean
$colIndex integer
리턴 boolean

checkIfCellExists() 공개 메소드

returns true, if rowIndex and columnIndex do exists in table
public checkIfCellExists ( integer $rowIndex, integer $columnIndex ) : boolean
$rowIndex integer
$columnIndex integer
리턴 boolean

checkRowIndex() 공개 메소드

returns true, if row index is valid
public checkRowIndex ( integer $rowIndex ) : boolean
$rowIndex integer
리턴 boolean

free() 공개 메소드

public free ( )

getAlignment() 공개 메소드

gets alignment
public getAlignment ( ) : string
리턴 string

getCell() 공개 메소드

gets the instance of cell
public getCell ( integer $rowIndex, integer $columnIndex ) : PHPRtfLite_Table_Cell
$rowIndex integer
$columnIndex integer
리턴 PHPRtfLite_Table_Cell

getColumn() 공개 메소드

gets column
public getColumn ( integer $colIndex ) : PHPRtfLite_Table_Column
$colIndex integer
리턴 PHPRtfLite_Table_Column

getColumns() 공개 메소드

gets table columns
public getColumns ( ) : PHPRtfLite_Table_Column[]
리턴 PHPRtfLite_Table_Column[]

getColumnsCount() 공개 메소드

gets number of columns in table
public getColumnsCount ( ) : integer
리턴 integer

getContainer() 공개 메소드

gets rtf container instance
public getContainer ( ) : PHPRtfLite_Container
리턴 PHPRtfLite_Container

getLeftPosition() 공개 메소드

gets left position of table
public getLeftPosition ( ) : float
리턴 float

getNestDepth() 공개 메소드

gets nested depth
public getNestDepth ( ) : integer
리턴 integer

getPreventEmptyParagraph() 공개 메소드

returns true, if no empty paragraph should be added after table

getRow() 공개 메소드

gets row instance
public getRow ( integer $rowIndex ) : PHPRtfLite_Table_Row
$rowIndex integer
리턴 PHPRtfLite_Table_Row

getRows() 공개 메소드

gets table rows
public getRows ( ) : PHPRtfLite_Table_Row[]
리턴 PHPRtfLite_Table_Row[]

getRowsCount() 공개 메소드

gets number of rows in table
public getRowsCount ( ) : integer
리턴 integer

getRtf() 공개 메소드

gets rtf instance
public getRtf ( ) : PHPRtfLite
리턴 PHPRtfLite

isFirstRowHeader() 공개 메소드

Returns true, if first row should be used as header. First row will be repeated at the top of each page.
public isFirstRowHeader ( ) : boolean
리턴 boolean

isNestedTable() 공개 메소드

checks, if table is a nested table
public isNestedTable ( ) : boolean
리턴 boolean

isPreventPageBreak() 공개 메소드

returns true, if a table should not be splited by a page break
public isPreventPageBreak ( ) : boolean
리턴 boolean

mergeCellRange() 공개 메소드

merges cells of a given cell range
public mergeCellRange ( integer $startRow, integer $startColumn, integer $endRow, integer $endColumn )
$startRow integer start row
$startColumn integer start column
$endRow integer end row
$endColumn integer end column

preventEmptyParagraph() 공개 메소드

prevents adding an empty paragraph after table
public preventEmptyParagraph ( $value = true )

render() 공개 메소드

gets rtf code for table
public render ( ) : string
리턴 string rtf code

renderRowCells() 보호된 메소드

renders row cells
protected renderRowCells ( PHPRtfLite_Table_Row $row )
$row PHPRtfLite_Table_Row

renderRowDefinition() 공개 메소드

renders row definition
public renderRowDefinition ( PHPRtfLite_Table_Row $row )
$row PHPRtfLite_Table_Row

rotateCellRange() 공개 메소드

rotates cells of a given cell range
public rotateCellRange ( string $rotateTo, integer $startRow, integer $startColumn, integer $endRow = null, integer $endColumn = null )
$rotateTo string direction of rotation
Possible values (represented by PHPRtfLite_Table_Cell::ROTATE_*):
PHPRtfLite_Table_Cell::ROTATE_RIGHT => 'right'
PHPRtfLite_Table_Cell::ROTATE_LEFT => 'left'
$startRow integer start row
$startColumn integer start column
$endRow integer end row, if null, then rotation is set only to the row range.
$endColumn integer end column, if null, then rotation is set just to the column range.

setBackgroundForCellRange() 공개 메소드

sets background color of cells of a given cell range
public setBackgroundForCellRange ( string $backgroundColor, integer $startRow, integer $startColumn, integer $endRow = null, integer $endColumn = null )
$backgroundColor string background color
$startRow integer start row
$startColumn integer start column
$endRow integer end row, if null, then rotation is set only to the row range.
$endColumn integer end column, if null, then rotation is set just to the column range.

setBorderForCellRange() 공개 메소드

sets border to cells of a given cell range
public setBorderForCellRange ( PHPRtfLite_Border $border, integer $startRow, integer $startColumn, integer $endRow = null, integer $endColumn = null )
$border PHPRtfLite_Border border
$startRow integer start row
$startColumn integer start column
$endRow integer end row, if null, then border is set only to the row range.
$endColumn integer end column, if null, then border is set just to the column range.

setBordersForCellRange() 공개 메소드

사용 중단: use setBorderForCellRange() instead
public setBordersForCellRange ( PHPRtfLite_Border_Format $borderFormat, integer $startRow, integer $startColumn, integer $endRow = null, integer $endColumn = null, boolean $left = true, boolean $top = true, boolean $right = true, boolean $bottom = true )
$borderFormat PHPRtfLite_Border_Format border format
$startRow integer start row
$startColumn integer start column
$endRow integer end row, if null, then border is set only to the row range.
$endColumn integer end column, if null, then border is set just to the column range.
$left boolean if false, left border is not set (default true)
$top boolean if false, top border is not set (default true)
$right boolean if false, right border is not set (default true)
$bottom boolean if false, bottom border is not set (default true)

setFirstRowAsHeader() 공개 메소드

Sets first row as header row. First row will be repeated at the top of each page.
public setFirstRowAsHeader ( )

setFontForCellRange() 공개 메소드

sets font to empty cells of a given cell range
public setFontForCellRange ( PHPRtfLite_Font $font, integer $startRow, integer $startColumn, integer $endRow = null, integer $endColumn = null )
$font PHPRtfLite_Font font for empty cells. The method PHPRtfLite_Table_Cell->writeToCell() overrides it with another PHPRtfLite_Font.
$startRow integer start row
$startColumn integer start column
$endRow integer end row, if null, then font is set only to the row range.
$endColumn integer end column, if null, then font is set just to the column range.

setLeftPosition() 공개 메소드

sets left position of table
public setLeftPosition ( float $leftPosition )
$leftPosition float left position of table.

setPreventPageBreak() 공개 메소드

Sets that table won't be splited by a page break. By default page break splits table.
public setPreventPageBreak ( )

setTextAlignmentForCellRange() 공개 메소드

sets alignments to empty cells of a given cell range
public setTextAlignmentForCellRange ( string $alignment, integer $startRow, integer $startColumn, integer $endRow = null, integer $endColumn = null )
$alignment string alignment of cell. The method PHPRtfLite_Table_Cell->writeToCell() overrides it with PHPRtfLite_ParFormat alignment.
Alignment is represented by class constants PHPRtfLite_Container::TEXT_ALIGN_*
Possible values:
PHPRtfLite_Container::TEXT_ALIGN_LEFT => 'left' - left alignment
PHPRtfLite_Container::TEXT_ALIGN_RIGHT => 'right' - right alignment
PHPRtfLite_Container::TEXT_ALIGN_CENTER => 'center' - center alignment
PHPRtfLite_Container::TEXT_ALIGN_JUSTIFY => 'justify' - justify alignment
$startRow integer start row
$startColumn integer start column
$endRow integer end row, if null, then text alignment is set only to the row range.
$endColumn integer end column, if null, then text alignment is set just to the column range.

setVerticalAlignmentForCellRange() 공개 메소드

sets vertical alignment to cells of a given cell range
public setVerticalAlignmentForCellRange ( string $verticalAlignment, integer $startRow, integer $startColumn, integer $endRow = null, integer $endColumn = null )
$verticalAlignment string Vertical alignment of cell (default top). Represented by PHPRtfLite_Container::VERTICAL_ALIGN_*
Possible values:
PHPRtfLite_Container::VERTICAL_ALIGN_TOP => 'top' - top alignment;
PHPRtfLite_Container::VERTICAL_ALIGN_CENTER => 'center' - center alignment;
PHPRtfLite_Container::VERTICAL_ALIGN_BOTTOM => 'bottom' - bottom alignment.
$startRow integer start row
$startColumn integer start column
$endRow integer end row, if null, then vertical alignment is set only to the row range.
$endColumn integer end column, if null, then vertical alignment is set just to the column range.

writeToCell() 공개 메소드

writes text to cell
public writeToCell ( integer $rowIndex, integer $columnIndex, string $text, PHPRtfLite_Font $font = null, PHPRtfLite_ParFormat $parFormat = null, boolean $convertTagsToRtf = true ) : PHPRtfLite_Element
$rowIndex integer row index of cell
$columnIndex integer column index of cell
$text string Text. Also you can use html style tags. @see PHPRtfLite_Container#writeText()
$font PHPRtfLite_Font Font of text
$parFormat PHPRtfLite_ParFormat Paragraph format
$convertTagsToRtf boolean If false, then html style tags are not replaced with rtf code.
리턴 PHPRtfLite_Element

프로퍼티 상세

$_alignment 보호되어 있는 프로퍼티

protected string $_alignment
리턴 string

$_columns 보호되어 있는 프로퍼티

array of PHPRtfLite_Table_Column instances
protected PHPRtfLite_Table_Column[] $_columns
리턴 PHPRtfLite_Table_Column[]

$_container 보호되어 있는 프로퍼티

protected PHPRtfLite_Container $_container
리턴 PHPRtfLite_Container

$_firstRowIsHeader 보호되어 있는 프로퍼티

protected bool $_firstRowIsHeader
리턴 boolean

$_leftPosition 보호되어 있는 프로퍼티

protected int $_leftPosition
리턴 integer

$_nestDepth 보호되어 있는 프로퍼티

.. and so on ..
protected int $_nestDepth
리턴 integer

$_preventEmptyParagraph 보호되어 있는 프로퍼티

flag for preventing an empty paragraph after table
protected bool $_preventEmptyParagraph
리턴 boolean

$_preventPageBreak 보호되어 있는 프로퍼티

protected bool $_preventPageBreak
리턴 boolean

$_repeatFirstRowHeader 보호되어 있는 프로퍼티

protected bool $_repeatFirstRowHeader
리턴 boolean

$_rows 보호되어 있는 프로퍼티

array of PHPRtfLite_Table_Row instances
protected PHPRtfLite_Table_Row[] $_rows
리턴 PHPRtfLite_Table_Row[]