Source for file RichText.php
Documentation is available at RichText.php
* Copyright (c) 2006 - 2011 PHPExcel
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* @package PHPExcel_RichText
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.6, 2011-02-27
* @package PHPExcel_RichText
* @copyright Copyright (c) 2006 - 2011 PHPExcel (http://www.codeplex.com/PHPExcel)
* @var PHPExcel_RichText_ITextElement[]
private $_richTextElements;
* Create a new PHPExcel_RichText instance
* @param PHPExcel_Cell $pParent
public function __construct(PHPExcel_Cell $pCell = null)
$this->_richTextElements = array();
// Rich-Text string attached to cell?
// Add cell text and style
if ($pCell->getValue() != "") {
$objRun->setFont(clone $pCell->getParent()->getStyle($pCell->getCoordinate())->getFont());
* @param PHPExcel_RichText_ITextElement $pText Rich text element
* @return PHPExcel_RichText
public function addText(PHPExcel_RichText_ITextElement $pText = null)
$this->_richTextElements[] = $pText;
* @param string $pText Text
* @return PHPExcel_RichText_TextElement
* @param string $pText Text
* @return PHPExcel_RichText_Run
// Loop through all PHPExcel_RichText_ITextElement
foreach ($this->_richTextElements as $text) {
$returnValue .= $text->getText();
* @return PHPExcel_RichText_ITextElement[]
return $this->_richTextElements;
* @param PHPExcel_RichText_ITextElement[] $pElements Array of elements
* @return PHPExcel_RichText
$this->_richTextElements = $pElements;
throw new Exception("Invalid PHPExcel_RichText_ITextElement[] array passed.");
* @return string Hash code
foreach ($this->_richTextElements as $element) {
$hashElements .= $element->getHashCode();
* Implement PHP __clone to create a deep clone, not just a shallow copy.
foreach ($vars as $key => $value) {
$this->$key = clone $value;
|