You are here

private function PHPExcel_Reader_Excel2007::_parseRichText in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel2007.php \PHPExcel_Reader_Excel2007::_parseRichText()
1 call to PHPExcel_Reader_Excel2007::_parseRichText()
PHPExcel_Reader_Excel2007::load in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel2007.php
* Loads PHPExcel from file * *

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel2007.php, line 1931

Class

PHPExcel_Reader_Excel2007
PHPExcel_Reader_Excel2007

Code

private function _parseRichText($is = null) {
  $value = new PHPExcel_RichText();
  if (isset($is->t)) {
    $value
      ->createText(PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $is->t));
  }
  else {
    if (is_object($is->r)) {
      foreach ($is->r as $run) {
        if (!isset($run->rPr)) {
          $objText = $value
            ->createText(PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $run->t));
        }
        else {
          $objText = $value
            ->createTextRun(PHPExcel_Shared_String::ControlCharacterOOXML2PHP((string) $run->t));
          if (isset($run->rPr->rFont["val"])) {
            $objText
              ->getFont()
              ->setName((string) $run->rPr->rFont["val"]);
          }
          if (isset($run->rPr->sz["val"])) {
            $objText
              ->getFont()
              ->setSize((string) $run->rPr->sz["val"]);
          }
          if (isset($run->rPr->color)) {
            $objText
              ->getFont()
              ->setColor(new PHPExcel_Style_Color(self::_readColor($run->rPr->color)));
          }
          if (isset($run->rPr->b["val"]) && self::boolean((string) $run->rPr->b["val"]) || isset($run->rPr->b) && !isset($run->rPr->b["val"])) {
            $objText
              ->getFont()
              ->setBold(TRUE);
          }
          if (isset($run->rPr->i["val"]) && self::boolean((string) $run->rPr->i["val"]) || isset($run->rPr->i) && !isset($run->rPr->i["val"])) {
            $objText
              ->getFont()
              ->setItalic(TRUE);
          }
          if (isset($run->rPr->vertAlign) && isset($run->rPr->vertAlign["val"])) {
            $vertAlign = strtolower((string) $run->rPr->vertAlign["val"]);
            if ($vertAlign == 'superscript') {
              $objText
                ->getFont()
                ->setSuperScript(TRUE);
            }
            if ($vertAlign == 'subscript') {
              $objText
                ->getFont()
                ->setSubScript(TRUE);
            }
          }
          if (isset($run->rPr->u) && !isset($run->rPr->u["val"])) {
            $objText
              ->getFont()
              ->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
          }
          else {
            if (isset($run->rPr->u) && isset($run->rPr->u["val"])) {
              $objText
                ->getFont()
                ->setUnderline((string) $run->rPr->u["val"]);
            }
          }
          if (isset($run->rPr->strike["val"]) && self::boolean((string) $run->rPr->strike["val"]) || isset($run->rPr->strike) && !isset($run->rPr->strike["val"])) {
            $objText
              ->getFont()
              ->setStrikethrough(TRUE);
          }
        }
      }
    }
  }
  return $value;
}