ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
PHPExcel_RichText Class Reference
+ Inheritance diagram for PHPExcel_RichText:
+ Collaboration diagram for PHPExcel_RichText:

Public Member Functions

 __construct (PHPExcel_Cell $pCell=null)
 Create a new PHPExcel_RichText instance. More...
 
 addText (PHPExcel_RichText_ITextElement $pText=null)
 Add text. More...
 
 createText ($pText='')
 Create text. More...
 
 createTextRun ($pText='')
 Create text run. More...
 
 getPlainText ()
 Get plain text. More...
 
 __toString ()
 Convert to string. More...
 
 getRichTextElements ()
 Get Rich Text elements. More...
 
 setRichTextElements ($pElements=null)
 Set Rich Text elements. More...
 
 getHashCode ()
 Get hash code. More...
 
 __clone ()
 Implement PHP __clone to create a deep clone, not just a shallow copy. More...
 

Private Attributes

 $_richTextElements
 

Detailed Description

Definition at line 36 of file RichText.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_RichText::__construct ( PHPExcel_Cell  $pCell = null)

Create a new PHPExcel_RichText instance.

Parameters
PHPExcel_Cell$pCell
Exceptions
PHPExcel_Exception

Definition at line 51 of file RichText.php.

References addText(), array, PHPExcel_RichText_Run\setFont(), and PHPExcel_Cell_DataType\TYPE_STRING.

52  {
53  // Initialise variables
54  $this->_richTextElements = array();
55 
56  // Rich-Text string attached to cell?
57  if ($pCell !== NULL) {
58  // Add cell text and style
59  if ($pCell->getValue() != "") {
60  $objRun = new PHPExcel_RichText_Run($pCell->getValue());
61  $objRun->setFont(clone $pCell->getParent()->getStyle($pCell->getCoordinate())->getFont());
62  $this->addText($objRun);
63  }
64 
65  // Set parent value
67  }
68  }
setFont(PHPExcel_Style_Font $pFont=null)
Set font.
Definition: Run.php:71
addText(PHPExcel_RichText_ITextElement $pText=null)
Add text.
Definition: RichText.php:77
getCoordinate()
Get cell coordinate.
Definition: Cell.php:171
getValue()
Get cell value.
Definition: Cell.php:181
Create styles array
The data for the language used.
setValueExplicit($pValue=NULL, $pDataType=PHPExcel_Cell_DataType::TYPE_STRING)
Set the value for a cell, with the explicit data type passed to the method (bypassing any use of the ...
Definition: Cell.php:225
getParent()
Get parent worksheet.
Definition: Cell.php:479
+ Here is the call graph for this function:

Member Function Documentation

◆ __clone()

PHPExcel_RichText::__clone ( )

Implement PHP __clone to create a deep clone, not just a shallow copy.

Definition at line 188 of file RichText.php.

189  {
190  $vars = get_object_vars($this);
191  foreach ($vars as $key => $value) {
192  if (is_object($value)) {
193  $this->$key = clone $value;
194  } else {
195  $this->$key = $value;
196  }
197  }
198  }

◆ __toString()

PHPExcel_RichText::__toString ( )

Convert to string.

Returns
string

Definition at line 135 of file RichText.php.

References getPlainText().

136  {
137  return $this->getPlainText();
138  }
getPlainText()
Get plain text.
Definition: RichText.php:116
+ Here is the call graph for this function:

◆ addText()

PHPExcel_RichText::addText ( PHPExcel_RichText_ITextElement  $pText = null)

Add text.

Parameters
PHPExcel_RichText_ITextElement$pTextRich text element
Exceptions
PHPExcel_Exception
Returns
PHPExcel_RichText

Definition at line 77 of file RichText.php.

Referenced by __construct(), createText(), and createTextRun().

78  {
79  $this->_richTextElements[] = $pText;
80  return $this;
81  }
+ Here is the caller graph for this function:

◆ createText()

PHPExcel_RichText::createText (   $pText = '')

Create text.

Parameters
string$pTextText
Returns
PHPExcel_RichText_TextElement
Exceptions
PHPExcel_Exception

Definition at line 90 of file RichText.php.

References addText().

91  {
92  $objText = new PHPExcel_RichText_TextElement($pText);
93  $this->addText($objText);
94  return $objText;
95  }
addText(PHPExcel_RichText_ITextElement $pText=null)
Add text.
Definition: RichText.php:77
+ Here is the call graph for this function:

◆ createTextRun()

PHPExcel_RichText::createTextRun (   $pText = '')

Create text run.

Parameters
string$pTextText
Returns
PHPExcel_RichText_Run
Exceptions
PHPExcel_Exception

Definition at line 104 of file RichText.php.

References addText().

105  {
106  $objText = new PHPExcel_RichText_Run($pText);
107  $this->addText($objText);
108  return $objText;
109  }
addText(PHPExcel_RichText_ITextElement $pText=null)
Add text.
Definition: RichText.php:77
+ Here is the call graph for this function:

◆ getHashCode()

PHPExcel_RichText::getHashCode ( )

Get hash code.

Returns
string Hash code

Implements PHPExcel_IComparable.

Definition at line 172 of file RichText.php.

173  {
174  $hashElements = '';
175  foreach ($this->_richTextElements as $element) {
176  $hashElements .= $element->getHashCode();
177  }
178 
179  return md5(
180  $hashElements
181  . __CLASS__
182  );
183  }

◆ getPlainText()

PHPExcel_RichText::getPlainText ( )

Get plain text.

Returns
string

Definition at line 116 of file RichText.php.

References $text.

Referenced by __toString().

117  {
118  // Return value
119  $returnValue = '';
120 
121  // Loop through all PHPExcel_RichText_ITextElement
122  foreach ($this->_richTextElements as $text) {
123  $returnValue .= $text->getText();
124  }
125 
126  // Return
127  return $returnValue;
128  }
$text
+ Here is the caller graph for this function:

◆ getRichTextElements()

PHPExcel_RichText::getRichTextElements ( )

Get Rich Text elements.

Returns
PHPExcel_RichText_ITextElement[]

Definition at line 145 of file RichText.php.

References $_richTextElements.

146  {
148  }

◆ setRichTextElements()

PHPExcel_RichText::setRichTextElements (   $pElements = null)

Set Rich Text elements.

Parameters
PHPExcel_RichText_ITextElement[]$pElements Array of elements
Exceptions
PHPExcel_Exception
Returns
PHPExcel_RichText

Definition at line 157 of file RichText.php.

158  {
159  if (is_array($pElements)) {
160  $this->_richTextElements = $pElements;
161  } else {
162  throw new PHPExcel_Exception("Invalid PHPExcel_RichText_ITextElement[] array passed.");
163  }
164  return $this;
165  }

Field Documentation

◆ $_richTextElements

PHPExcel_RichText::$_richTextElements
private

Definition at line 43 of file RichText.php.

Referenced by getRichTextElements().


The documentation for this class was generated from the following file: