当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPExcel_Shared_Date::isDateTimeFormat方法代码示例

本文整理汇总了PHP中PHPExcel_Shared_Date::isDateTimeFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPExcel_Shared_Date::isDateTimeFormat方法的具体用法?PHP PHPExcel_Shared_Date::isDateTimeFormat怎么用?PHP PHPExcel_Shared_Date::isDateTimeFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPExcel_Shared_Date的用法示例。


在下文中一共展示了PHPExcel_Shared_Date::isDateTimeFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: load


//.........这里部分代码省略.........
                                                 $helper = PHPExcel_ReferenceHelper::getInstance();
                                                 $x = $helper->updateFormulaReferences($sharedFormulas[$instance]['formula'], 'A1', $difference[0], $difference[1]);
                                                 $value = $x;
                                             }
                                         }
                                     }
                                     break;
                             }
                             // Check for numeric values
                             if (is_numeric($value) && $cellDataType != 's') {
                                 if ($value == (int) $value) {
                                     $value = (int) $value;
                                 } elseif ($value == (double) $value) {
                                     $value = (double) $value;
                                 } elseif ($value == (double) $value) {
                                     $value = (double) $value;
                                 }
                             }
                             // Rich text?
                             if ($value instanceof PHPExcel_RichText && $this->_readDataOnly) {
                                 $value = $value->getPlainText();
                             }
                             // Assign value
                             if ($cellDataType != '') {
                                 $docSheet->setCellValueExplicit($r, $value, $cellDataType);
                             } else {
                                 $docSheet->setCellValue($r, $value);
                             }
                             // Style information?
                             if ($c["s"] && !$this->_readDataOnly) {
                                 if (isset($styles[intval($c["s"])])) {
                                     $this->_readStyle($docSheet->getStyle($r), $styles[intval($c["s"])]);
                                 }
                                 if ($cellDataType != 's' && PHPExcel_Shared_Date::isDateTimeFormat($docSheet->getStyle($r)->getNumberFormat())) {
                                     if (preg_match("/^([0-9.,-]+)\$/", $value)) {
                                         $docSheet->setCellValue($r, PHPExcel_Shared_Date::ExcelToPHP($value));
                                     }
                                 }
                             }
                             // Set rich text parent
                             if ($value instanceof PHPExcel_RichText && !$this->_readDataOnly) {
                                 $value->setParent($docSheet->getCell($r));
                             }
                         }
                     }
                     $conditionals = array();
                     if (!$this->_readDataOnly) {
                         foreach ($xmlSheet->conditionalFormatting as $conditional) {
                             foreach ($conditional->cfRule as $cfRule) {
                                 if (((string) $cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_NONE || (string) $cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CELLIS || (string) $cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT) && isset($dxfs[intval($cfRule["dxfId"])])) {
                                     $conditionals[(string) $conditional["sqref"]][intval($cfRule["priority"])] = $cfRule;
                                 }
                             }
                         }
                         foreach ($conditionals as $ref => $cfRules) {
                             ksort($cfRules);
                             $conditionalStyles = array();
                             foreach ($cfRules as $cfRule) {
                                 $objConditional = new PHPExcel_Style_Conditional();
                                 $objConditional->setConditionType((string) $cfRule["type"]);
                                 $objConditional->setOperatorType((string) $cfRule["operator"]);
                                 if ((string) $cfRule["text"] != '') {
                                     $objConditional->setText((string) $cfRule["text"]);
                                 }
                                 if (count($cfRule->formula) > 1) {
                                     foreach ($cfRule->formula as $formula) {
开发者ID:eficklin,项目名称:Spreadsheet,代码行数:67,代码来源:Excel2007.php

示例2: load


//.........这里部分代码省略.........
                             $docSheet->getRowDimension(intval($row["r"]))->setOutlineLevel(intval($row["outlineLevel"]));
                         }
                         foreach ($row->c as $c) {
                             $r = (string) $c["r"];
                             switch ($c["t"]) {
                                 case "s":
                                     $value = $sharedStrings[intval($c->v)];
                                     if ($value instanceof PHPExcel_RichText) {
                                         $value = clone $value;
                                     }
                                     break;
                                 case "b":
                                     $value = (bool) $c->v;
                                     break;
                                 case "inlineStr":
                                     $value = $this->_parseRichText($c->is);
                                     $value->setParent($docSheet->getCell($r));
                                     break;
                                 default:
                                     if (!isset($c->f)) {
                                         $value = (string) $c->v;
                                     } else {
                                         $value = "={$c->f}";
                                     }
                                     break;
                             }
                             if ($value) {
                                 $docSheet->setCellValue($r, $value);
                             }
                             if ($c["s"] && !$this->_readDataOnly) {
                                 if (isset($styles[intval($c["s"])])) {
                                     $this->_readStyle($docSheet->getStyle($r), $styles[intval($c["s"])]);
                                 }
                                 if (PHPExcel_Shared_Date::isDateTimeFormat($docSheet->getStyle($r)->getNumberFormat())) {
                                     if (preg_match("/^([0-9.,-]+)\$/", $value)) {
                                         $docSheet->setCellValue($r, PHPExcel_Shared_Date::ExcelToPHP($value));
                                     }
                                 }
                             }
                         }
                     }
                     $conditionals = array();
                     if (!$this->_readDataOnly) {
                         foreach ($xmlSheet->conditionalFormatting as $conditional) {
                             foreach ($conditional->cfRule as $cfRule) {
                                 if (((string) $cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_NONE || (string) $cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CELLIS || (string) $cfRule["type"] == PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT) && isset($dxfs[intval($cfRule["dxfId"])])) {
                                     $conditionals[(string) $conditional["sqref"]][intval($cfRule["priority"])] = $cfRule;
                                 }
                             }
                         }
                         foreach ($conditionals as $ref => $cfRules) {
                             ksort($cfRules);
                             $conditionalStyles = array();
                             foreach ($cfRules as $cfRule) {
                                 $objConditional = new PHPExcel_Style_Conditional();
                                 $objConditional->setConditionType((string) $cfRule["type"]);
                                 $objConditional->setOperatorType((string) $cfRule["operator"]);
                                 $objConditional->setCondition((string) $cfRule->formula);
                                 $objConditional->setStyle(clone $dxfs[intval($cfRule["dxfId"])]);
                                 $conditionalStyles[] = $objConditional;
                             }
                             // Extract all cell references in $ref
                             $aReferences = PHPExcel_Cell::extractAllCellReferencesInRange($ref);
                             foreach ($aReferences as $reference) {
                                 $docSheet->getStyle($reference)->setConditionalStyles($conditionalStyles);
                             }
开发者ID:hostellerie,项目名称:nexpro,代码行数:67,代码来源:Excel2007.php


注:本文中的PHPExcel_Shared_Date::isDateTimeFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。