示例#1
0
 /**
  * Create a new RichText instance
  *
  * @param Cell $pCell
  * @throws Exception
  */
 public function __construct(Cell $pCell = null)
 {
     // Initialise variables
     $this->richTextElements = array();
     // Rich-Text string attached to cell?
     if ($pCell !== null) {
         // Add cell text and style
         if ($pCell->getValue() != "") {
             $objRun = new RichText\Run($pCell->getValue());
             $objRun->setFont(clone $pCell->getParent()->getStyle($pCell->getCoordinate())->getFont());
             $this->addText($objRun);
         }
         // Set parent value
         $pCell->setValueExplicit($this, Cell\DataType::TYPE_STRING);
     }
 }
 /**
  * Parse row
  * @return array
  */
 protected function parseRow()
 {
     $content = [];
     if ($this->reader->hasHeader) {
         $this->initHeader();
     }
     $cells = $this->row->getCellIterator();
     $i = 0;
     foreach ($cells as $this->cell) {
         $header = $this->reader->hasHeader ? $this->header[$i] : $i;
         if ($this->needParsed($header, $i)) {
             $content[$header] = $this->cell->getValue();
         }
         $i++;
     }
     return $content;
 }