PHP Класс PHPRtfLite

Автор: Denis Slaveckij ([email protected])
Автор: Steffen Zeidler ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_borderSurroundsFooter boolean
$_borderSurroundsHeader boolean
$_colorTable PHPRtfLite_DocHead_ColorTable color table instance
$_defaultFont PHPRtfLite_Font default font
$_fontTable PHPRtfLite_DocHead_FontTable font table instance
$_footers PHPRtfLite_Container_Footer[] rtf footers
$_headers PHPRtfLite_Container_Header[] rtf headers
$_properties array rtf properties
$_sections PHPRtfLite_Container_Section[] rtf sections

Открытые методы

Метод Описание
__construct ( )
addFooter ( string $type = PHPRtfLite_Container_Footer::TYPE_ALL, PHPRtfLite_Container_Footer $footer = null ) : PHPRtfLite_Container_Footer creates footer for the document
addHeader ( string $type = PHPRtfLite_Container_Header::TYPE_ALL, PHPRtfLite_Container_Header $header = null ) : PHPRtfLite_Container_Header creates header for the document
addSection ( PHPRtfLite_Container_Section $section = null ) : PHPRtfLite_Container_Section adds section to rtf document
borderSurroundsFooter ( ) : boolean checks, if border surrounds footer
borderSurroundsHeader ( ) : boolean checks, if border surrounds header
convertNewlinesToRtfCode ( string $text ) : string convert new lines to rtf line breaks
free ( )
getBorder ( ) : PHPRtfLite_Border gets border of document
getCharset ( ) : string gets charset for rtf text inputs
getColorTable ( ) : PHPRtfLite_DocHead_ColorTable gets color table
getContent ( boolean $free = true ) : string gets rtf document code
getDefaultFont ( ) : PHPRtfLite_Font gets default font
getDefaultFontForNotes ( ) : PHPRtfLite_Font gets default font for notes
getDefaultTabWidth ( ) : float sets default tab width of the document
getEndnoteNumberingType ( ) : integer gets endnote numbering type
getEndnoteStartNumber ( ) : integer gets endnote start number
getFontTable ( ) : PHPRtfLite_DocHead_FontTable gets font table
getFooters ( ) : array gets defined footers for document pages
getFootnoteNumberingType ( ) : integer gets footnote numbering type
getFootnoteStartNumber ( ) : integer gets footnote start number
getGutter ( ) : float gets the gutter width
getHeaders ( ) : array gets defined headers for document pages
getMarginBottom ( ) : float gets the bottom margin of document pages
getMarginLeft ( ) : float gets the left margin of document pages
getMarginRight ( ) : float gets the right margin of document pages
getMarginTop ( ) : float gets the top margin of document pages
getNoteDocHead ( ) : PHPRtfLite_DocHead_Note gets document head definition for notes
getPageNumberStart ( ) : integer gets the beginning page number
getPaperHeight ( ) : float gets the paper height of document
getPaperWidth ( ) : float gets the paper width of document
getProperty ( string $name ) : string gets rtf property
getSections ( ) : array gets sections
getViewMode ( ) : integer gets the view mode of the document
getWriter ( ) : PHPRtfLite_Writer_Interface gets writer
getZoomLevel ( ) : integer gets the zoom level (in percents) of the document
getZoomMode ( ) : integer gets the zoom mode of the document
hasSpecialLayoutForFirstPage ( ) : boolean returns true, if first page has special layout
isLandscape ( ) : boolean returns true, if landscape layout should be used
isMirrorMargins ( ) : boolean returns true, if use mirror margins should be used
isOddEvenDifferent ( ) : boolean gets if odd and even headers/footers are different
isRestartEndnoteNumberEachPage ( ) : boolean checks, if endnote numbering shall be started on each page
isRestartFootnoteNumberEachPage ( ) : boolean sets restart endnote number on each page
quoteRtfCode ( string $text, boolean $convertNewlines = true ) : string quotes rtf code
registerAutoloader ( ) : boolean registers autoloader for PHPRtfLite classes
registerFont ( PHPRtfLite_Font $font ) registers the font in color table and font table
registerParFormat ( PHPRtfLite_ParFormat $parFormat ) registers the par format in color table
save ( string $file, boolean $free = true ) saves rtf document to file
sendRtf ( string $filename = 'simple', $free = true ) sends rtf content as file attachment
setBorder ( PHPRtfLite_Border $border ) Sets border to rtf document. Sections may override this border.
setBorderSurroundsFooter ( boolean $borderSurroundsFooter = true ) : PHPRtfLite
setBorderSurroundsHeader ( boolean $borderSurroundsHeader = true ) : PHPRtfLite sets border surrounds header
setBorders ( PHPRtfLite_Border_Format $borderFormat, boolean $left = true, boolean $top = true, boolean $right = true, boolean $bottom = true ) Sets borders to rtf document. Sections may override this border.
setCharset ( string $charset ) sets charset for rtf text inputs
setDefaultFont ( PHPRtfLite_Font $font ) sets default font
setDefaultFontForNotes ( PHPRtfLite_Font $font ) sets default font for notes
setDefaultTabWidth ( float $defaultTabWidth ) sets default tab width of the document
setEndnoteNumberingType ( integer $numberingType ) sets endnote numbering type
setEndnoteStartNumber ( integer $startNumber ) sets endnote start number
setFootnoteNumberingType ( integer $numberingType ) sets footnote numbering type
setFootnoteStartNumber ( integer $startNumber ) sets footnote start number
setGutter ( float $gutter ) sets the gutter width.
NOTICE: Does not work with OpenOffice.
setHyphenation ( ) sets using hyphenation
setLandscape ( ) sets landscape orientation for the document
setMarginBottom ( float $margin ) sets the bottom margin of document pages
setMarginLeft ( float $margin ) sets the left margin of document pages
setMarginRight ( float $margin ) sets the right margin of document pages
setMarginTop ( float $margin ) sets the top margin of document pages
setMargins ( float $marginLeft, float $marginTop, float $marginRight, float $marginBottom ) sets the margins of document pages
setMirrorMargins ( ) sets the margin definitions on left and right pages.
NOTICE: Does not work with OpenOffice.
setOddEvenDifferent ( boolean $different = true ) sets if odd and even headers/footers are different
setPageNumberStart ( integer $pageNumber ) sets the beginning page number
setPaperFormat ( string $paperFormat ) Sets the paper format.
setPaperHeight ( float $height ) sets the paper height of document
setPaperWidth ( float $width ) sets the paper width of document
setProperty ( string $name, mixed $value ) sets document information properties
setRestartEndnoteNumberEachPage ( ) : boolean checks, if footnote numbering shall be started on each page
setRestartFootnoteNumberEachPage ( ) sets restart footnote number on each page
setSpecialLayoutForFirstPage ( boolean $specialLayout = true ) sets that first page has a special layout
setUseTemporaryFile ( boolean $flag = true ) set that a temporary file should be used for creating the output NOTE: is slowing down the rendering because of the io operations, but uses less memory
setViewMode ( integer $viewMode ) sets the view mode of the document
setWriter ( PHPRtfLite_Writer_Interface $writer ) sets writer
setZoomLevel ( integer $zoom ) sets the zoom level (in percents) of the document. By default word uses 100%.
NOTICE: if zoom mode is defined, zoom level is not used.
setZoomMode ( integer $zoomMode ) sets the zoom mode of the document
unregisterAutoloader ( ) : boolean unregisters autoloader for PHPRtfLite classes

Защищенные методы

Метод Описание
getInfoPart ( ) : string gets rtf info part
render ( ) prepares rtf contents

Приватные методы

Метод Описание
createWriter ( string $file = null ) creates writer

Описание методов

__construct() публичный Метод

public __construct ( )

addFooter() публичный Метод

creates footer for the document
public addFooter ( string $type = PHPRtfLite_Container_Footer::TYPE_ALL, PHPRtfLite_Container_Footer $footer = null ) : PHPRtfLite_Container_Footer
$type string Represented by class constants PHPRtfLite_Container_Footer::TYPE_*
Possible values:
PHPRtfLite_Container_Footer::TYPE_ALL all pages (different odd and even headers/footers must be not set)
PHPRtfLite_Container_Footer::TYPE_LEFT left pages (different odd and even headers/footers must be set)
PHPRtfLite_Container_Footer::TYPE_RIGHT right pages (different odd and even headers/footers must be set)
PHPRtfLite_Container_Footer::TYPE_FIRST first page
$footer PHPRtfLite_Container_Footer
Результат PHPRtfLite_Container_Footer

addHeader() публичный Метод

creates header for the document
public addHeader ( string $type = PHPRtfLite_Container_Header::TYPE_ALL, PHPRtfLite_Container_Header $header = null ) : PHPRtfLite_Container_Header
$type string Represented by class constants PHPRtfLite_Container_Header::TYPE_*
Possible values:
PHPRtfLite_Container_Header::TYPE_ALL all pages (different odd and even headers/footers must be not set)
PHPRtfLite_Container_Header::TYPE_LEFT left pages (different odd and even headers/footers must be set)
PHPRtfLite_Container_Header::TYPE_RIGHT right pages (different odd and even headers/footers must be set
PHPRtfLite_Container_Header::TYPE_FIRST first page
$header PHPRtfLite_Container_Header
Результат PHPRtfLite_Container_Header

addSection() публичный Метод

adds section to rtf document
public addSection ( PHPRtfLite_Container_Section $section = null ) : PHPRtfLite_Container_Section
$section PHPRtfLite_Container_Section
Результат PHPRtfLite_Container_Section

borderSurroundsFooter() публичный Метод

checks, if border surrounds footer
public borderSurroundsFooter ( ) : boolean
Результат boolean

borderSurroundsHeader() публичный Метод

checks, if border surrounds header
public borderSurroundsHeader ( ) : boolean
Результат boolean

convertNewlinesToRtfCode() публичный статический Метод

convert new lines to rtf line breaks
public static convertNewlinesToRtfCode ( string $text ) : string
$text string
Результат string

free() публичный Метод

public free ( )

getBorder() публичный Метод

gets border of document
public getBorder ( ) : PHPRtfLite_Border
Результат PHPRtfLite_Border

getCharset() публичный Метод

gets charset for rtf text inputs
public getCharset ( ) : string
Результат string

getColorTable() публичный Метод

gets color table
public getColorTable ( ) : PHPRtfLite_DocHead_ColorTable
Результат PHPRtfLite_DocHead_ColorTable

getContent() публичный Метод

gets rtf document code
public getContent ( boolean $free = true ) : string
$free boolean
Результат string

getDefaultFont() публичный Метод

gets default font
public getDefaultFont ( ) : PHPRtfLite_Font
Результат PHPRtfLite_Font

getDefaultFontForNotes() публичный Метод

gets default font for notes
public getDefaultFontForNotes ( ) : PHPRtfLite_Font
Результат PHPRtfLite_Font

getDefaultTabWidth() публичный Метод

sets default tab width of the document
public getDefaultTabWidth ( ) : float
Результат float $defaultTabWidth Default tab width

getEndnoteNumberingType() публичный Метод

gets endnote numbering type
public getEndnoteNumberingType ( ) : integer
Результат integer

getEndnoteStartNumber() публичный Метод

gets endnote start number
public getEndnoteStartNumber ( ) : integer
Результат integer

getFontTable() публичный Метод

gets font table
public getFontTable ( ) : PHPRtfLite_DocHead_FontTable
Результат PHPRtfLite_DocHead_FontTable

getFooters() публичный Метод

gets defined footers for document pages
public getFooters ( ) : array
Результат array contains PHPRtfLite_Container_FOOTER objects

getFootnoteNumberingType() публичный Метод

gets footnote numbering type
public getFootnoteNumberingType ( ) : integer
Результат integer

getFootnoteStartNumber() публичный Метод

gets footnote start number
public getFootnoteStartNumber ( ) : integer
Результат integer

getGutter() публичный Метод

gets the gutter width
public getGutter ( ) : float
Результат float $gutter gutter width

getHeaders() публичный Метод

gets defined headers for document pages
public getHeaders ( ) : array
Результат array contains PHPRtfLite_Container_Header objects

getInfoPart() защищенный Метод

gets rtf info part
protected getInfoPart ( ) : string
Результат string

getMarginBottom() публичный Метод

gets the bottom margin of document pages
public getMarginBottom ( ) : float
Результат float $margin

getMarginLeft() публичный Метод

gets the left margin of document pages
public getMarginLeft ( ) : float
Результат float $margin

getMarginRight() публичный Метод

gets the right margin of document pages
public getMarginRight ( ) : float
Результат float $margin

getMarginTop() публичный Метод

gets the top margin of document pages
public getMarginTop ( ) : float
Результат float $margin

getNoteDocHead() публичный Метод

gets document head definition for notes
public getNoteDocHead ( ) : PHPRtfLite_DocHead_Note
Результат PHPRtfLite_DocHead_Note

getPageNumberStart() публичный Метод

gets the beginning page number
public getPageNumberStart ( ) : integer
Результат integer

getPaperHeight() публичный Метод

gets the paper height of document
public getPaperHeight ( ) : float
Результат float $paperHeight paper height

getPaperWidth() публичный Метод

gets the paper width of document
public getPaperWidth ( ) : float
Результат float $paperWidth paper width

getProperty() публичный Метод

gets rtf property
public getProperty ( string $name ) : string
$name string
Результат string

getSections() публичный Метод

gets sections
public getSections ( ) : array
Результат array

getViewMode() публичный Метод

gets the view mode of the document
public getViewMode ( ) : integer
Результат integer view mode represented as class constants VIEW_MODE_*

getWriter() публичный Метод

gets writer
public getWriter ( ) : PHPRtfLite_Writer_Interface
Результат PHPRtfLite_Writer_Interface

getZoomLevel() публичный Метод

gets the zoom level (in percents) of the document
public getZoomLevel ( ) : integer
Результат integer $zoom zoom level

getZoomMode() публичный Метод

gets the zoom mode of the document
public getZoomMode ( ) : integer
Результат integer

hasSpecialLayoutForFirstPage() публичный Метод

returns true, if first page has special layout
public hasSpecialLayoutForFirstPage ( ) : boolean
Результат boolean

isLandscape() публичный Метод

returns true, if landscape layout should be used
public isLandscape ( ) : boolean
Результат boolean

isMirrorMargins() публичный Метод

returns true, if use mirror margins should be used
public isMirrorMargins ( ) : boolean
Результат boolean

isOddEvenDifferent() публичный Метод

gets if odd and even headers/footers are different
public isOddEvenDifferent ( ) : boolean
Результат boolean

isRestartEndnoteNumberEachPage() публичный Метод

checks, if endnote numbering shall be started on each page
public isRestartEndnoteNumberEachPage ( ) : boolean
Результат boolean

isRestartFootnoteNumberEachPage() публичный Метод

sets restart endnote number on each page
public isRestartFootnoteNumberEachPage ( ) : boolean
Результат boolean

quoteRtfCode() публичный статический Метод

quotes rtf code
public static quoteRtfCode ( string $text, boolean $convertNewlines = true ) : string
$text string
$convertNewlines boolean
Результат string

registerAutoloader() публичный статический Метод

registers autoloader for PHPRtfLite classes
public static registerAutoloader ( ) : boolean
Результат boolean

registerFont() публичный Метод

registers the font in color table and font table
public registerFont ( PHPRtfLite_Font $font )
$font PHPRtfLite_Font

registerParFormat() публичный Метод

registers the par format in color table
public registerParFormat ( PHPRtfLite_ParFormat $parFormat )
$parFormat PHPRtfLite_ParFormat

render() защищенный Метод

prepares rtf contents
protected render ( )

save() публичный Метод

saves rtf document to file
public save ( string $file, boolean $free = true )
$file string Name of file
$free boolean

sendRtf() публичный Метод

sends rtf content as file attachment
public sendRtf ( string $filename = 'simple', $free = true )
$filename string

setBorder() публичный Метод

Sets border to rtf document. Sections may override this border.
public setBorder ( PHPRtfLite_Border $border )
$border PHPRtfLite_Border

setBorderSurroundsFooter() публичный Метод

public setBorderSurroundsFooter ( boolean $borderSurroundsFooter = true ) : PHPRtfLite
$borderSurroundsFooter boolean
Результат PHPRtfLite

setBorderSurroundsHeader() публичный Метод

sets border surrounds header
public setBorderSurroundsHeader ( boolean $borderSurroundsHeader = true ) : PHPRtfLite
$borderSurroundsHeader boolean
Результат PHPRtfLite

setBorders() публичный Метод

Sets borders to rtf document. Sections may override this border.
public setBorders ( PHPRtfLite_Border_Format $borderFormat, boolean $left = true, boolean $top = true, boolean $right = true, boolean $bottom = true )
$borderFormat PHPRtfLite_Border_Format
$left boolean
$top boolean
$right boolean
$bottom boolean

setCharset() публичный Метод

sets charset for rtf text inputs
public setCharset ( string $charset )
$charset string

setDefaultFont() публичный Метод

sets default font
public setDefaultFont ( PHPRtfLite_Font $font )
$font PHPRtfLite_Font

setDefaultFontForNotes() публичный Метод

sets default font for notes
public setDefaultFontForNotes ( PHPRtfLite_Font $font )
$font PHPRtfLite_Font

setDefaultTabWidth() публичный Метод

sets default tab width of the document
public setDefaultTabWidth ( float $defaultTabWidth )
$defaultTabWidth float Default tab width

setEndnoteNumberingType() публичный Метод

sets endnote numbering type
public setEndnoteNumberingType ( integer $numberingType )
$numberingType integer

setEndnoteStartNumber() публичный Метод

sets endnote start number
public setEndnoteStartNumber ( integer $startNumber )
$startNumber integer

setFootnoteNumberingType() публичный Метод

sets footnote numbering type
public setFootnoteNumberingType ( integer $numberingType )
$numberingType integer

setFootnoteStartNumber() публичный Метод

sets footnote start number
public setFootnoteStartNumber ( integer $startNumber )
$startNumber integer

setGutter() публичный Метод

sets the gutter width.
NOTICE: Does not work with OpenOffice.
public setGutter ( float $gutter )
$gutter float gutter width

setHyphenation() публичный Метод

sets using hyphenation
public setHyphenation ( )

setLandscape() публичный Метод

sets landscape orientation for the document
public setLandscape ( )

setMarginBottom() публичный Метод

sets the bottom margin of document pages
public setMarginBottom ( float $margin )
$margin float

setMarginLeft() публичный Метод

sets the left margin of document pages
public setMarginLeft ( float $margin )
$margin float

setMarginRight() публичный Метод

sets the right margin of document pages
public setMarginRight ( float $margin )
$margin float

setMarginTop() публичный Метод

sets the top margin of document pages
public setMarginTop ( float $margin )
$margin float

setMargins() публичный Метод

sets the margins of document pages
public setMargins ( float $marginLeft, float $marginTop, float $marginRight, float $marginBottom )
$marginLeft float Margin left (default 3 cm)
$marginTop float Margin top (default 1 cm)
$marginRight float Margin right (default 3 cm)
$marginBottom float Margin bottom (default 2 cm)

setMirrorMargins() публичный Метод

sets the margin definitions on left and right pages.
NOTICE: Does not work with OpenOffice.
public setMirrorMargins ( )

setOddEvenDifferent() публичный Метод

sets if odd and even headers/footers are different
public setOddEvenDifferent ( boolean $different = true )
$different boolean

setPageNumberStart() публичный Метод

sets the beginning page number
public setPageNumberStart ( integer $pageNumber )
$pageNumber integer Beginning page number (if not defined, Word uses 1)

setPaperFormat() публичный Метод

Sets the paper format.
public setPaperFormat ( string $paperFormat )
$paperFormat string

setPaperHeight() публичный Метод

sets the paper height of document
public setPaperHeight ( float $height )
$height float paper height

setPaperWidth() публичный Метод

sets the paper width of document
public setPaperWidth ( float $width )
$width float pager width

setProperty() публичный Метод

sets document information properties
public setProperty ( string $name, mixed $value )
$name string Property of document. Possible properties:
'title' => title of the document (value string)
'subject' => subject of the document (value string)
'author' => author of the document (value string)
'manager' => manager of the document (value string)
'company' => company of author (value string)
'operator' => operator of document. Operator is a person who last made changes to the document. (value string)
'category' => category of document (value string)
'keywords' => keywords of document (value string)
'doccomm' => comments of document (value string)
'creatim' => creation time (value int)
'revtim' => last revision time (value int)
'buptim' => last backup time (value int)
'printim' => last print time (value int)
$value mixed Value

setRestartEndnoteNumberEachPage() публичный Метод

checks, if footnote numbering shall be started on each page
public setRestartEndnoteNumberEachPage ( ) : boolean
Результат boolean

setRestartFootnoteNumberEachPage() публичный Метод

sets restart footnote number on each page

setSpecialLayoutForFirstPage() публичный Метод

sets that first page has a special layout
public setSpecialLayoutForFirstPage ( boolean $specialLayout = true )
$specialLayout boolean

setUseTemporaryFile() публичный Метод

set that a temporary file should be used for creating the output NOTE: is slowing down the rendering because of the io operations, but uses less memory
public setUseTemporaryFile ( boolean $flag = true )
$flag boolean default is true

setViewMode() публичный Метод

sets the view mode of the document
public setViewMode ( integer $viewMode )
$viewMode integer View Mode. Represented as class constants VIEW_MODE_*
Possible values:
VIEW_MODE_NONE => 0 - None
VIEW_MODE_PAGE_LAYOUT => 1 - Page Layout view
VIEW_MODE_OUTLINE => 2 - Outline view
VIEW_MODE_MASTER => 3 - Master Document view
VIEW_MODE_NORMAL => 4 - Normal view
VIEW_MODE_ONLINE_LAYOUT => 5 - Online Layout view

setWriter() публичный Метод

sets writer
public setWriter ( PHPRtfLite_Writer_Interface $writer )
$writer PHPRtfLite_Writer_Interface

setZoomLevel() публичный Метод

sets the zoom level (in percents) of the document. By default word uses 100%.
NOTICE: if zoom mode is defined, zoom level is not used.
public setZoomLevel ( integer $zoom )
$zoom integer zoom level

setZoomMode() публичный Метод

sets the zoom mode of the document
public setZoomMode ( integer $zoomMode )
$zoomMode integer zoom mode. Represented as class constants. Possible values:
ZOOM_MODE_NONE => 0 - None
ZOOM_MODE_FULL_PAGE => 1 - Full Page
ZOOM_MODE_BEST_FIT => 2 - Best Fit

unregisterAutoloader() публичный статический Метод

unregisters autoloader for PHPRtfLite classes
public static unregisterAutoloader ( ) : boolean
Результат boolean

Описание свойств

$_borderSurroundsFooter защищенное свойство

protected bool $_borderSurroundsFooter
Результат boolean

$_borderSurroundsHeader защищенное свойство

protected bool $_borderSurroundsHeader
Результат boolean

$_colorTable защищенное свойство

color table instance
protected PHPRtfLite_DocHead_ColorTable $_colorTable
Результат PHPRtfLite_DocHead_ColorTable

$_defaultFont защищенное свойство

default font
protected PHPRtfLite_Font $_defaultFont
Результат PHPRtfLite_Font

$_fontTable защищенное свойство

font table instance
protected PHPRtfLite_DocHead_FontTable $_fontTable
Результат PHPRtfLite_DocHead_FontTable

$_footers защищенное свойство

rtf footers
protected PHPRtfLite_Container_Footer[] $_footers
Результат PHPRtfLite_Container_Footer[]

$_headers защищенное свойство

rtf headers
protected PHPRtfLite_Container_Header[] $_headers
Результат PHPRtfLite_Container_Header[]

$_properties защищенное свойство

rtf properties
protected array $_properties
Результат array

$_sections защищенное свойство

rtf sections
protected PHPRtfLite_Container_Section[] $_sections
Результат PHPRtfLite_Container_Section[]