You are here

private static function PHPExcel_Reader_Excel2007_Chart::_parseRichText in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel2007/Chart.php \PHPExcel_Reader_Excel2007_Chart::_parseRichText()
1 call to PHPExcel_Reader_Excel2007_Chart::_parseRichText()
PHPExcel_Reader_Excel2007_Chart::_chartTitle in vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/Excel2007/Chart.php

File

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

Class

PHPExcel_Reader_Excel2007_Chart
PHPExcel_Reader_Excel2007_Chart

Code

private static function _parseRichText($titleDetailPart = null) {
  $value = new PHPExcel_RichText();
  foreach ($titleDetailPart as $titleDetailElementKey => $titleDetailElement) {
    if (isset($titleDetailElement->t)) {
      $objText = $value
        ->createTextRun((string) $titleDetailElement->t);
    }
    if (isset($titleDetailElement->rPr)) {
      if (isset($titleDetailElement->rPr->rFont["val"])) {
        $objText
          ->getFont()
          ->setName((string) $titleDetailElement->rPr->rFont["val"]);
      }
      $fontSize = self::_getAttribute($titleDetailElement->rPr, 'sz', 'integer');
      if (!is_null($fontSize)) {
        $objText
          ->getFont()
          ->setSize(floor($fontSize / 100));
      }
      $fontColor = self::_getAttribute($titleDetailElement->rPr, 'color', 'string');
      if (!is_null($fontColor)) {
        $objText
          ->getFont()
          ->setColor(new PHPExcel_Style_Color(self::_readColor($fontColor)));
      }
      $bold = self::_getAttribute($titleDetailElement->rPr, 'b', 'boolean');
      if (!is_null($bold)) {
        $objText
          ->getFont()
          ->setBold($bold);
      }
      $italic = self::_getAttribute($titleDetailElement->rPr, 'i', 'boolean');
      if (!is_null($italic)) {
        $objText
          ->getFont()
          ->setItalic($italic);
      }
      $baseline = self::_getAttribute($titleDetailElement->rPr, 'baseline', 'integer');
      if (!is_null($baseline)) {
        if ($baseline > 0) {
          $objText
            ->getFont()
            ->setSuperScript(true);
        }
        elseif ($baseline < 0) {
          $objText
            ->getFont()
            ->setSubScript(true);
        }
      }
      $underscore = self::_getAttribute($titleDetailElement->rPr, 'u', 'string');
      if (!is_null($underscore)) {
        if ($underscore == 'sng') {
          $objText
            ->getFont()
            ->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
        }
        elseif ($underscore == 'dbl') {
          $objText
            ->getFont()
            ->setUnderline(PHPExcel_Style_Font::UNDERLINE_DOUBLE);
        }
        else {
          $objText
            ->getFont()
            ->setUnderline(PHPExcel_Style_Font::UNDERLINE_NONE);
        }
      }
      $strikethrough = self::_getAttribute($titleDetailElement->rPr, 's', 'string');
      if (!is_null($strikethrough)) {
        if ($strikethrough == 'noStrike') {
          $objText
            ->getFont()
            ->setStrikethrough(false);
        }
        else {
          $objText
            ->getFont()
            ->setStrikethrough(true);
        }
      }
    }
  }
  return $value;
}