Classtrees
 

rtfFile

rtfFile

private class rtfFile

This class provides an API for creating RTF (Rich Text Format) Files
It supports 5 standard font families, font formatting and tables,
page breaks and foreground and background colors

It supports the following HTML tags:

<b></b>
<i></i>
<u></u>
<br>
<a href='url'>link text</a>
<font [size='n'],[face='fontName'],[color='color'] >text</font>

Author Nicolas de Haen <mail@ndh-websolutions.de>
Version 0.7 alpha

 
 

Public Method Summary

object rtfFile

rtfFile()

Constructor
void

setFontSize([ integer $size ])

set the actual font size
void

setFontFamily(string $font)

set the actual FontFamily
void

setFontColor( $color)

set the actual font color
void

setBgColor()

set the actual background color
void

resetFontColor()

reset the font color to default value
void

resetBgColor()

reset the background color to default value
void

addText( $textString)

inserts a text string
object table

createTable( $cols)

create a new table object
string

getContent()

returns the whole content of the created RTF-File
boolean

createFile( $fileName)

stores the RTF file as "fileName"
void

newLine()

starts a new line
void

newPage()

starts a new page

Private Method Summary

void

getHeader()

for internal use
int

getFontNumber( $fontFace)

for internal use
int

addHexToColorTbl( $color)

for internal use
void

addColorToColorTbl( $red, $green, $blue)

for internal use
string

replaceTags( $content)

for internal use
void

parseTags( $string)

for internal use
void

getTagAttributes( $s)

for internal use
void

addTable( $table)

Public Field Summary

string

$fileName

fileName. The name of the generated RFT-File
string

$content

content. The string containing the RTF-File content
string

$actFontSize

actFontSize. The actual font size, starts with a default value
string

$actFontFamily

actFontFamily. The actual font family,as index number
array

$fontFamily

fontFamily.An array with possible values of font families
array

$colors

colors.An array with possible values of colors

Private Field Summary

string

$header

header. The header contains various informations about the document
integer

$pageWidth

pageWidth. The default pageWidth
string

$actFontColor

string

$defaultFontColor

Included files Summary, Type: include

tableClass.php

Public Method Details

rtfFile

public object rtfFile rtfFile( )

  Constructor

has no arguments

Returns object rtfFile

(an instance of this class)

 

setFontSize

public void setFontSize( [ integer $size ] )

Parameter
integer $size  
  set the actual font size
font size as argument

Returns void

 

setFontFamily

public void setFontFamily( string $font )

Parameter
string $font
values: Arial, Times New Roman, Verdana, Garamond, Courier
  set the actual FontFamily

Returns void

 

setFontColor

public void setFontColor( $color )

Parameter
$color
  set the actual font color

Returns void

 

setBgColor

public void setBgColor( )

  set the actual background color
expects 3 numbers (RGB) or one color value (HEX) as parameter

Returns void

 

resetFontColor

public void resetFontColor( )

  reset the font color to default value

Returns void

 

resetBgColor

public void resetBgColor( )

  reset the background color to default value

Returns void

 

addText

public void addText( $textString )

Parameter
$textString
  inserts a text string

possible params are (textString, [fontSize], [alignment], [fontColor], [fontFamily] )

Example: ->addText("My text string", 10, "center", "0000CC");

Returns void

 

createTable

public object table createTable( $cols, [$width], [$align], [$bgcolor])

Parameter
$cols
  create a new table object

createTable(cols, [width], [align], [bgcolor])

Returns object table

(an instance of the table class)

 

getContent

public string getContent( )

  returns the whole content of the created RTF-File

Returns string $content

 

createFile

public boolean createFile( $fileName )

Parameter
$fileName
  stores the RTF file as "fileName"

Returns boolean

if the file was created

 

newLine

public void newLine( )

  starts a new line

Returns void

 

newPage

public void newPage( )

  starts a new page

Returns void

 

Private Method Details

getHeader

private void getHeader( )

  for internal use
adds the new defined colors to the header and returns the whole header

Returns void

 

getFontNumber

private int getFontNumber( $fontFace )

Parameter
$fontFace
  for internal use

Returns int $index_of

fontFamily array possible values: Arial, Times New Roman, Verdana, Garamond, Courier

 

addHexToColorTbl

private int addHexToColorTbl( $color )

Parameter
$color
  for internal use

Returns int $index_of

colorTbl array

 

addColorToColorTbl

private void addColorToColorTbl( $red, $green, $blue )

Parameter
$red
$green
$blue
  for internal use

Returns void

 

replaceTags

private string replaceTags( $content )

Parameter
$content
  for internal use

Returns string

content

 

parseTags

private void parseTags( $string )

Parameter
$string
  for internal use

Returns void

 

getTagAttributes

private void getTagAttributes( $s )

Parameter
$s
  for internal use

reads attributes from a tag string and returns them in a hashtable

Returns void

 

addTable

private void addTable( $table )

Parameter
$table
 

Returns void

 

Public Field Details

$fileName

public string $fileName

 

$content

public string $content

 

$actFontSize

public string $actFontSize

 

$actFontFamily

public string $actFontFamily

 

$fontFamily

public array $fontFamily

 

$colors

public array $colors

 

Private Field Details

$header

private string $header

 

$pageWidth

private integer $pageWidth

 

$actFontColor

private string $actFontColor

 

$defaultFontColor

private string $defaultFontColor

 

Included Files, Type: include

tableClass.php

include( tableClass.php )
 
 
  Classtrees
PHPDoc 1.0alpha