34        define(
'PHPEXCEL_ROOT', dirname(__FILE__) . 
'/../../');
 
   35        require(PHPEXCEL_ROOT . 
'PHPExcel/Autoloader.php');
 
   81                if (!file_exists($pFilename)) {
 
   95                if ($zip->open($pFilename) === 
true) {
 
   98                        if ($rels !== 
false) {
 
   99                                foreach ($rels->Relationship as $rel) {
 
  100                                        switch ($rel[
"Type"]) {
 
  101                                                case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
 
  102                                                        if (basename($rel[
"Target"]) == 
'workbook.xml') {
 
  126                if (!file_exists($pFilename)) {
 
  130                $worksheetNames = array();
 
  134                $zip = 
new $zipClass;
 
  135                $zip->open($pFilename);
 
  138                $rels = simplexml_load_string(
 
  141                foreach ($rels->Relationship as $rel) {
 
  142                        switch ($rel[
"Type"]) {
 
  143                                case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
 
  144                                        $xmlWorkbook = simplexml_load_string(
 
  148                                        if ($xmlWorkbook->sheets) {
 
  149                                                foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
 
  151                                                        $worksheetNames[] = (string) $eleSheet[
"name"];
 
  159                return $worksheetNames;
 
  172                if (!file_exists($pFilename)) {
 
  176                $worksheetInfo = array();
 
  180                $zip = 
new $zipClass;
 
  181                $zip->open($pFilename);
 
  184                foreach ($rels->Relationship as $rel) {
 
  185                        if ($rel[
"Type"] == 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument") {
 
  186                                $dir = dirname($rel[
"Target"]);
 
  188                                $relsWorkbook->registerXPathNamespace(
"rel", 
"http://schemas.openxmlformats.org/package/2006/relationships");
 
  190                                $worksheets = array();
 
  191                                foreach ($relsWorkbook->Relationship as $ele) {
 
  192                                        if ($ele[
"Type"] == 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet") {
 
  193                                                $worksheets[(string) $ele[
"Id"]] = $ele[
"Target"];
 
  198                                if ($xmlWorkbook->sheets) {
 
  199                                        $dir = dirname($rel[
"Target"]);
 
  200                                        foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
 
  202                                                        'worksheetName' => (
string) $eleSheet[
"name"],
 
  203                                                        'lastColumnLetter' => 
'A',
 
  204                                                        'lastColumnIndex' => 0,
 
  209                                                $fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships"), 
"id")];
 
  211                                                $xml = 
new XMLReader();
 
  213                                                $xml->setParserProperty(2,
true);
 
  216                                                while (
$xml->read()) {
 
  217                                                        if (
$xml->name == 
'row' && 
$xml->nodeType == XMLReader::ELEMENT) {
 
  219                                                                $tmpInfo[
'totalRows'] = 
$row;
 
  220                                                                $tmpInfo[
'totalColumns'] = max($tmpInfo[
'totalColumns'],$currCells);
 
  222                                                        } elseif (
$xml->name == 
'c' && 
$xml->nodeType == XMLReader::ELEMENT) {
 
  226                                                $tmpInfo[
'totalColumns'] = max($tmpInfo[
'totalColumns'],$currCells);
 
  229                                                $tmpInfo[
'lastColumnIndex'] = $tmpInfo[
'totalColumns'] - 1;
 
  232                                                $worksheetInfo[] = $tmpInfo;
 
  240                return $worksheetInfo;
 
  246                $value = isset($c->v) ? (string) $c->v : NULL;
 
  249                } elseif ($value == 
'1') {
 
  260                return isset($c->v) ? (string) $c->v : NULL;
 
  266                return isset($c->v) ? (string) $c->v : NULL;
 
  270        private function _castToFormula($c,
$r,&$cellDataType,&$value,&$calculatedValue,&$sharedFormulas,$castBaseType) {
 
  275                $calculatedValue        = self::$castBaseType($c);
 
  278                if (isset($c->f[
't']) && strtolower((
string)$c->f[
't']) == 
'shared') {
 
  280                        $instance = (string)$c->f[
'si'];
 
  286                        if (!isset($sharedFormulas[(
string)$c->f[
'si']])) {
 
  290                                $sharedFormulas[$instance] = array(     
'master' => 
$r,
 
  302                                $difference = array(0, 0);
 
  304                                $difference[1] = 
$current[1] - $master[1];
 
  306                                $value = $this->_referenceHelper->updateFormulaReferences(      $sharedFormulas[$instance][
'formula'],
 
  320                if (strpos($fileName, 
'//') !== 
false)
 
  322                        $fileName = substr($fileName, strpos($fileName, 
'//') + 1);
 
  327                $contents = $archive->getFromName($fileName);
 
  330                        $contents = $archive->getFromName(substr($fileName, 1));
 
  344        public function load($pFilename)
 
  347                if (!file_exists($pFilename)) {
 
  353                $excel->removeSheetByIndex(0);
 
  354                if (!$this->_readDataOnly) {
 
  355                        $excel->removeCellStyleXfByIndex(0); 
 
  356                        $excel->removeCellXfByIndex(0); 
 
  361                $zip = 
new $zipClass;
 
  362                $zip->open($pFilename);
 
  366                foreach ($wbRels->Relationship as $rel) {
 
  367                        switch ($rel[
"Type"]) {
 
  368                                case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme":
 
  369                                        $themeOrderArray = array(
'lt1',
'dk1',
'lt2',
'dk2');
 
  370                                        $themeOrderAdditional = count($themeOrderArray);
 
  373                                        if (is_object($xmlTheme)) {
 
  374                                                $xmlThemeName = $xmlTheme->attributes();
 
  375                                                $xmlTheme = $xmlTheme->children(
"http://schemas.openxmlformats.org/drawingml/2006/main");
 
  376                                                $themeName = (string)$xmlThemeName[
'name'];
 
  378                                                $colourScheme = $xmlTheme->themeElements->clrScheme->attributes();
 
  379                                                $colourSchemeName = (string)$colourScheme[
'name'];
 
  380                                                $colourScheme = $xmlTheme->themeElements->clrScheme->children(
"http://schemas.openxmlformats.org/drawingml/2006/main");
 
  382                                                $themeColours = array();
 
  383                                                foreach ($colourScheme as $k => $xmlColour) {
 
  384                                                        $themePos = array_search($k,$themeOrderArray);
 
  385                                                        if ($themePos === 
false) {
 
  386                                                                $themePos = $themeOrderAdditional++;
 
  388                                                        if (isset($xmlColour->sysClr)) {
 
  389                                                                $xmlColourData = $xmlColour->sysClr->attributes();
 
  390                                                                $themeColours[$themePos] = $xmlColourData[
'lastClr'];
 
  391                                                        } elseif (isset($xmlColour->srgbClr)) {
 
  392                                                                $xmlColourData = $xmlColour->srgbClr->attributes();
 
  393                                                                $themeColours[$themePos] = $xmlColourData[
'val'];
 
  403                foreach ($rels->Relationship as $rel) {
 
  404                        switch ($rel[
"Type"]) {
 
  405                                case "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties":
 
  407                                        if (is_object($xmlCore)) {
 
  408                                                $xmlCore->registerXPathNamespace(
"dc", 
"http://purl.org/dc/elements/1.1/");
 
  409                                                $xmlCore->registerXPathNamespace(
"dcterms", 
"http://purl.org/dc/terms/");
 
  410                                                $xmlCore->registerXPathNamespace(
"cp", 
"http://schemas.openxmlformats.org/package/2006/metadata/core-properties");
 
  411                                                $docProps = $excel->getProperties();
 
  412                                                $docProps->setCreator((
string) self::array_item($xmlCore->xpath(
"dc:creator")));
 
  413                                                $docProps->setLastModifiedBy((
string) self::array_item($xmlCore->xpath(
"cp:lastModifiedBy")));
 
  414                                                $docProps->setCreated(strtotime(self::array_item($xmlCore->xpath(
"dcterms:created")))); 
 
  415                                                $docProps->setModified(strtotime(self::array_item($xmlCore->xpath(
"dcterms:modified")))); 
 
  416                                                $docProps->setTitle((
string) self::array_item($xmlCore->xpath(
"dc:title")));
 
  417                                                $docProps->setDescription((
string) self::array_item($xmlCore->xpath(
"dc:description")));
 
  418                                                $docProps->setSubject((
string) self::array_item($xmlCore->xpath(
"dc:subject")));
 
  419                                                $docProps->setKeywords((
string) self::array_item($xmlCore->xpath(
"cp:keywords")));
 
  420                                                $docProps->setCategory((
string) self::array_item($xmlCore->xpath(
"cp:category")));
 
  424                                case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties":
 
  426                                        if (is_object($xmlCore)) {
 
  427                                                $docProps = $excel->getProperties();
 
  428                                                if (isset($xmlCore->Company))
 
  429                                                        $docProps->setCompany((
string) $xmlCore->Company);
 
  430                                                if (isset($xmlCore->Manager))
 
  431                                                        $docProps->setManager((
string) $xmlCore->Manager);
 
  435                                case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties":
 
  437                                        if (is_object($xmlCore)) {
 
  438                                                $docProps = $excel->getProperties();
 
  439                                                foreach ($xmlCore as $xmlProperty) {
 
  440                                                        $cellDataOfficeAttributes = $xmlProperty->attributes();
 
  441                                                        if (isset($cellDataOfficeAttributes[
'name'])) {
 
  442                                                                $propertyName = (string) $cellDataOfficeAttributes[
'name'];
 
  443                                                                $cellDataOfficeChildren = $xmlProperty->children(
'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');
 
  444                                                                $attributeType = $cellDataOfficeChildren->getName();
 
  445                                                                $attributeValue = (string) $cellDataOfficeChildren->{$attributeType};
 
  448                                                                $docProps->setCustomProperty($propertyName,$attributeValue,$attributeType);
 
  454                                case "http://schemas.microsoft.com/office/2006/relationships/ui/extensibility":
 
  455                                        $customUI = $rel[
'Target'];
 
  456                                        if(!is_null($customUI)){
 
  460                                case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
 
  461                                        $dir = dirname($rel[
"Target"]);
 
  463                                        $relsWorkbook->registerXPathNamespace(
"rel", 
"http://schemas.openxmlformats.org/package/2006/relationships");
 
  465                                        $sharedStrings = array();
 
  466                                        $xpath = 
self::array_item($relsWorkbook->xpath(
"rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']"));
 
  468                                        if (isset($xmlStrings) && isset($xmlStrings->si)) {
 
  469                                                foreach ($xmlStrings->si as $val) {
 
  470                                                        if (isset($val->t)) {
 
  472                                                        } elseif (isset($val->r)) {
 
  478                                        $worksheets = array();
 
  479                    $macros = $customUI = NULL;
 
  480                                        foreach ($relsWorkbook->Relationship as $ele) {
 
  481                                                switch($ele[
'Type']){
 
  482                                                case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet":
 
  483                                                        $worksheets[(string) $ele[
"Id"]] = $ele[
"Target"];
 
  486                                                case "http://schemas.microsoft.com/office/2006/relationships/vbaProject":
 
  487                                                        $macros = $ele[
"Target"];
 
  492                                        if(!is_null($macros)){
 
  494                                                if($macrosCode !== 
false){
 
  495                                                        $excel->setMacrosCode($macrosCode);
 
  496                                                        $excel->setHasMacros(
true);
 
  499                                                        if($Certificate !== 
false)
 
  500                                                                $excel->setMacrosCertificate($Certificate);
 
  504                                        $cellStyles = array();
 
  505                                        $xpath = 
self::array_item($relsWorkbook->xpath(
"rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']"));
 
  508                                        if ($xmlStyles && $xmlStyles->numFmts[0]) {
 
  509                                                $numFmts = $xmlStyles->numFmts[0];
 
  511                                        if (isset($numFmts) && ($numFmts !== NULL)) {
 
  512                                                $numFmts->registerXPathNamespace(
"sml", 
"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
 
  514                                        if (!$this->_readDataOnly && $xmlStyles) {
 
  515                                                foreach ($xmlStyles->cellXfs->xf as $xf) {
 
  518                                                        if ($xf[
"numFmtId"]) {
 
  519                                                                if (isset($numFmts)) {
 
  520                                                                        $tmpNumFmt = 
self::array_item($numFmts->xpath(
"sml:numFmt[@numFmtId=$xf[numFmtId]]"));
 
  522                                                                        if (isset($tmpNumFmt[
"formatCode"])) {
 
  523                                                                                $numFmt = (string) $tmpNumFmt[
"formatCode"];
 
  527                                                                if ((
int)$xf[
"numFmtId"] < 164) {
 
  531                            $quotePrefix = 
false;
 
  532                                                        if (isset($xf[
"quotePrefix"])) {
 
  533                                $quotePrefix = (
boolean) $xf[
"quotePrefix"];
 
  540                                                                "font" => $xmlStyles->fonts->font[intval($xf[
"fontId"])],
 
  541                                                                "fill" => $xmlStyles->fills->fill[intval($xf[
"fillId"])],
 
  542                                                                "border" => $xmlStyles->borders->border[intval($xf[
"borderId"])],
 
  543                                                                "alignment" => $xf->alignment,
 
  544                                                                "protection" => $xf->protection,
 
  545                                                                "quotePrefix" => $quotePrefix,
 
  552                                                        $excel->addCellXf($objStyle);
 
  555                                                foreach ($xmlStyles->cellStyleXfs->xf as $xf) {
 
  557                                                        if ($numFmts && $xf[
"numFmtId"]) {
 
  558                                                                $tmpNumFmt = 
self::array_item($numFmts->xpath(
"sml:numFmt[@numFmtId=$xf[numFmtId]]"));
 
  559                                                                if (isset($tmpNumFmt[
"formatCode"])) {
 
  560                                                                        $numFmt = (string) $tmpNumFmt[
"formatCode"];
 
  561                                                                } 
else if ((
int)$xf[
"numFmtId"] < 165) {
 
  566                                                        $cellStyle = (object) array(
 
  568                                                                "font" => $xmlStyles->fonts->font[intval($xf[
"fontId"])],
 
  569                                                                "fill" => $xmlStyles->fills->fill[intval($xf[
"fillId"])],
 
  570                                                                "border" => $xmlStyles->borders->border[intval($xf[
"borderId"])],
 
  571                                                                "alignment" => $xf->alignment,
 
  572                                                                "protection" => $xf->protection,
 
  573                                                                "quotePrefix" => $quotePrefix,
 
  575                                                        $cellStyles[] = $cellStyle;
 
  580                                                        $excel->addCellStyleXf($objStyle);
 
  585                                        if (!$this->_readDataOnly && $xmlStyles) {
 
  587                                                if ($xmlStyles->dxfs) {
 
  588                                                        foreach ($xmlStyles->dxfs->dxf as $dxf) {
 
  595                                                if ($xmlStyles->cellStyles) {
 
  596                                                        foreach ($xmlStyles->cellStyles->cellStyle as $cellStyle) {
 
  597                                                                if (intval($cellStyle[
'builtinId']) == 0) {
 
  598                                                                        if (isset($cellStyles[intval($cellStyle[
'xfId'])])) {
 
  613                                        if ($xmlWorkbook->workbookPr) {
 
  615                                                if (isset($xmlWorkbook->workbookPr[
'date1904'])) {
 
  616                                                        if (self::boolean((
string) $xmlWorkbook->workbookPr[
'date1904'])) {
 
  624                                        $countSkippedSheets = 0; 
 
  625                                        $mapSheetId = array(); 
 
  628                                        $charts = $chartDetails = array();
 
  630                                        if ($xmlWorkbook->sheets) {
 
  631                                                foreach ($xmlWorkbook->sheets->sheet as $eleSheet) {
 
  635                                                        if (isset($this->_loadSheetsOnly) && !in_array((
string) $eleSheet[
"name"], $this->_loadSheetsOnly)) {
 
  636                                                                ++$countSkippedSheets;
 
  637                                                                $mapSheetId[$oldSheetId] = 
null;
 
  643                                                        $mapSheetId[$oldSheetId] = $oldSheetId - $countSkippedSheets;
 
  646                                                        $docSheet = $excel->createSheet();
 
  651                                                        $docSheet->setTitle((
string) $eleSheet[
"name"],
false);
 
  652                                                        $fileWorksheet = $worksheets[(string) self::array_item($eleSheet->attributes(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships"), 
"id")];
 
  655                                                        $sharedFormulas = array();
 
  657                                                        if (isset($eleSheet[
"state"]) && (
string) $eleSheet[
"state"] != 
'') {
 
  658                                                                $docSheet->setSheetState( (
string) $eleSheet[
"state"] );
 
  661                                                        if (isset($xmlSheet->sheetViews) && isset($xmlSheet->sheetViews->sheetView)) {
 
  662                                                            if (isset($xmlSheet->sheetViews->sheetView[
'zoomScale'])) {
 
  663                                                                    $docSheet->getSheetView()->setZoomScale( intval($xmlSheet->sheetViews->sheetView[
'zoomScale']) );
 
  666                                                            if (isset($xmlSheet->sheetViews->sheetView[
'zoomScaleNormal'])) {
 
  667                                                                    $docSheet->getSheetView()->setZoomScaleNormal( intval($xmlSheet->sheetViews->sheetView[
'zoomScaleNormal']) );
 
  670                                                            if (isset($xmlSheet->sheetViews->sheetView[
'view'])) {
 
  671                                                                    $docSheet->getSheetView()->setView((
string) $xmlSheet->sheetViews->sheetView[
'view']);
 
  674                                                                if (isset($xmlSheet->sheetViews->sheetView[
'showGridLines'])) {
 
  675                                                                        $docSheet->setShowGridLines(self::boolean((
string)$xmlSheet->sheetViews->sheetView[
'showGridLines']));
 
  678                                                                if (isset($xmlSheet->sheetViews->sheetView[
'showRowColHeaders'])) {
 
  679                                                                        $docSheet->setShowRowColHeaders(self::boolean((
string)$xmlSheet->sheetViews->sheetView[
'showRowColHeaders']));
 
  682                                                                if (isset($xmlSheet->sheetViews->sheetView[
'rightToLeft'])) {
 
  683                                                                        $docSheet->setRightToLeft(self::boolean((
string)$xmlSheet->sheetViews->sheetView[
'rightToLeft']));
 
  686                                                                if (isset($xmlSheet->sheetViews->sheetView->pane)) {
 
  687                                                                    if (isset($xmlSheet->sheetViews->sheetView->pane[
'topLeftCell'])) {
 
  688                                                                        $docSheet->freezePane( (
string)$xmlSheet->sheetViews->sheetView->pane[
'topLeftCell'] );
 
  693                                                                        if (isset($xmlSheet->sheetViews->sheetView->pane[
'xSplit'])) {
 
  694                                                                            $xSplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane[
'xSplit']);
 
  697                                                                        if (isset($xmlSheet->sheetViews->sheetView->pane[
'ySplit'])) {
 
  698                                                                            $ySplit = 1 + intval($xmlSheet->sheetViews->sheetView->pane[
'ySplit']);
 
  701                                                                        $docSheet->freezePaneByColumnAndRow($xSplit, $ySplit);
 
  705                                                                if (isset($xmlSheet->sheetViews->sheetView->selection)) {
 
  706                                                                        if (isset($xmlSheet->sheetViews->sheetView->selection[
'sqref'])) {
 
  707                                                                                $sqref = (string)$xmlSheet->sheetViews->sheetView->selection[
'sqref'];
 
  708                                                                                $sqref = explode(
' ', $sqref);
 
  710                                                                                $docSheet->setSelectedCells($sqref);
 
  716                                                        if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->tabColor)) {
 
  717                                                                if (isset($xmlSheet->sheetPr->tabColor[
'rgb'])) {
 
  718                                                                        $docSheet->getTabColor()->setARGB( (
string)$xmlSheet->sheetPr->tabColor[
'rgb'] );
 
  721                                                        if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr[
'codeName'])) {
 
  722                                                                $docSheet->setCodeName((
string) $xmlSheet->sheetPr[
'codeName']);
 
  724                                                        if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->outlinePr)) {
 
  725                                                                if (isset($xmlSheet->sheetPr->outlinePr[
'summaryRight']) &&
 
  726                                                                        !
self::boolean((
string) $xmlSheet->sheetPr->outlinePr[
'summaryRight'])) {
 
  727                                                                        $docSheet->setShowSummaryRight(FALSE);
 
  729                                                                        $docSheet->setShowSummaryRight(TRUE);
 
  732                                                                if (isset($xmlSheet->sheetPr->outlinePr[
'summaryBelow']) &&
 
  733                                                                        !
self::boolean((
string) $xmlSheet->sheetPr->outlinePr[
'summaryBelow'])) {
 
  734                                                                        $docSheet->setShowSummaryBelow(FALSE);
 
  736                                                                        $docSheet->setShowSummaryBelow(TRUE);
 
  740                                                        if (isset($xmlSheet->sheetPr) && isset($xmlSheet->sheetPr->pageSetUpPr)) {
 
  741                                                                if (isset($xmlSheet->sheetPr->pageSetUpPr[
'fitToPage']) &&
 
  742                                                                        !
self::boolean((
string) $xmlSheet->sheetPr->pageSetUpPr[
'fitToPage'])) {
 
  743                                                                        $docSheet->getPageSetup()->setFitToPage(FALSE);
 
  745                                                                        $docSheet->getPageSetup()->setFitToPage(TRUE);
 
  749                                                        if (isset($xmlSheet->sheetFormatPr)) {
 
  750                                                                if (isset($xmlSheet->sheetFormatPr[
'customHeight']) &&
 
  751                                                                        self::boolean((
string) $xmlSheet->sheetFormatPr[
'customHeight']) &&
 
  752                                                                        isset($xmlSheet->sheetFormatPr[
'defaultRowHeight'])) {
 
  753                                                                        $docSheet->getDefaultRowDimension()->setRowHeight( (
float)$xmlSheet->sheetFormatPr[
'defaultRowHeight'] );
 
  755                                                                if (isset($xmlSheet->sheetFormatPr[
'defaultColWidth'])) {
 
  756                                                                        $docSheet->getDefaultColumnDimension()->setWidth( (
float)$xmlSheet->sheetFormatPr[
'defaultColWidth'] );
 
  758                                                                if (isset($xmlSheet->sheetFormatPr[
'zeroHeight']) &&
 
  759                                                                        ((string)$xmlSheet->sheetFormatPr[
'zeroHeight'] == 
'1')) {
 
  760                                                                        $docSheet->getDefaultRowDimension()->setZeroHeight(
true);
 
  765                                                                foreach ($xmlSheet->cols->col as $col) {
 
  766                                    for (
$i = intval($col[
"min"]) - 1; 
$i < intval($col[
"max"]); ++
$i) {
 
  767                                                                                if ($col[
"style"] && !$this->_readDataOnly) {
 
  770                                                                                if (self::boolean($col[
"bestFit"])) {
 
  773                                                                                if (self::boolean($col[
"hidden"])) {
 
  777                                                                                if (self::boolean($col[
"collapsed"])) {
 
  780                                                                                if ($col[
"outlineLevel"] > 0) {
 
  785                                                                                if (intval($col[
"max"]) == 16384) {
 
  793                                                                if (self::boolean((
string) $xmlSheet->printOptions[
'gridLinesSet'])) {
 
  794                                                                        $docSheet->setShowGridlines(TRUE);
 
  797                                                                if (self::boolean((
string) $xmlSheet->printOptions[
'gridLines'])) {
 
  798                                                                        $docSheet->setPrintGridlines(TRUE);
 
  801                                                                if (self::boolean((
string) $xmlSheet->printOptions[
'horizontalCentered'])) {
 
  802                                                                        $docSheet->getPageSetup()->setHorizontalCentered(TRUE);
 
  804                                                                if (self::boolean((
string) $xmlSheet->printOptions[
'verticalCentered'])) {
 
  805                                                                        $docSheet->getPageSetup()->setVerticalCentered(TRUE);
 
  809                                                        if ($xmlSheet && $xmlSheet->sheetData && $xmlSheet->sheetData->row) {
 
  810                                                                foreach ($xmlSheet->sheetData->row as 
$row) {
 
  811                                                                        if (
$row[
"ht"] && !$this->_readDataOnly) {
 
  812                                                                                $docSheet->getRowDimension(intval(
$row[
"r"]))->setRowHeight(floatval(
$row[
"ht"]));
 
  815                                                                                $docSheet->getRowDimension(intval(
$row[
"r"]))->setVisible(FALSE);
 
  817                                                                        if (self::boolean(
$row[
"collapsed"])) {
 
  818                                                                                $docSheet->getRowDimension(intval(
$row[
"r"]))->setCollapsed(TRUE);
 
  820                                                                        if (
$row[
"outlineLevel"] > 0) {
 
  821                                                                                $docSheet->getRowDimension(intval(
$row[
"r"]))->setOutlineLevel(intval(
$row[
"outlineLevel"]));
 
  823                                                                        if (
$row[
"s"] && !$this->_readDataOnly) {
 
  824                                                                                $docSheet->getRowDimension(intval(
$row[
"r"]))->setXfIndex(intval(
$row[
"s"]));
 
  827                                                                        foreach (
$row->c as $c) {
 
  828                                                                                $r                                      = (string) $c[
"r"];
 
  829                                                                                $cellDataType           = (string) $c[
"t"];
 
  831                                                                                $calculatedValue        = 
null;
 
  837                                                                                        if (!$this->
getReadFilter()->readCell($coordinates[0], $coordinates[1], $docSheet->getTitle())) {
 
  848                                                                                switch ($cellDataType) {
 
  851                                                                                                if ((
string)$c->v != 
'') {
 
  852                                                                                                        $value = $sharedStrings[intval($c->v)];
 
  855                                                                                                                $value = clone $value;
 
  868                                                                                                        $this->
_castToFormula($c,
$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,
'_castToBool');
 
  869                                                                                                        if (isset($c->f[
't'])) {
 
  872                                                                                                                $docSheet->getCell(
$r)->setFormulaAttributes($att);
 
  888                                                                                                        $this->
_castToFormula($c,
$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,
'_castToError');
 
  902                                                                                                        $this->
_castToFormula($c,
$r,$cellDataType,$value,$calculatedValue,$sharedFormulas,
'_castToString');
 
  911                                                                                if (is_numeric($value) && $cellDataType != 
's') {
 
  912                                                                                        if ($value == (
int)$value) $value = (int)$value;
 
  913                                                                                        elseif ($value == (
float)$value) $value = (float)$value;
 
  914                                                                                        elseif ($value == (
double)$value) $value = (double)$value;
 
  919                                                                                        $value = $value->getPlainText();
 
  922                                                                                $cell = $docSheet->getCell(
$r);
 
  924                                                                                if ($cellDataType != 
'') {
 
  925                                                                                        $cell->setValueExplicit($value, $cellDataType);
 
  927                                                                                        $cell->setValue($value);
 
  929                                                                                if ($calculatedValue !== NULL) {
 
  930                                                                                        $cell->setCalculatedValue($calculatedValue);
 
  934                                                                                if ($c[
"s"] && !$this->_readDataOnly) {
 
  936                                                                                        $cell->setXfIndex(isset(
$styles[intval($c[
"s"])]) ?
 
  937                                                                                                intval($c[
"s"]) : 0);
 
  943                                                        $conditionals = array();
 
  944                                                        if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->conditionalFormatting) {
 
  945                                                                foreach ($xmlSheet->conditionalFormatting as $conditional) {
 
  946                                                                        foreach ($conditional->cfRule as $cfRule) {
 
  953                                                                                        ) && isset($dxfs[intval($cfRule[
"dxfId"])])
 
  955                                                                                        $conditionals[(string) $conditional[
"sqref"]][intval($cfRule[
"priority"])] = $cfRule;
 
  960                                                                foreach ($conditionals as $ref => $cfRules) {
 
  963                                                                        foreach ($cfRules as $cfRule) {
 
  965                                                                                $objConditional->setConditionType((
string)$cfRule[
"type"]);
 
  966                                                                                $objConditional->setOperatorType((
string)$cfRule[
"operator"]);
 
  968                                                                                if ((
string)$cfRule[
"text"] != 
'') {
 
  969                                                                                        $objConditional->setText((
string)$cfRule[
"text"]);
 
  972                                                                                if (count($cfRule->formula) > 1) {
 
  973                                                                                        foreach ($cfRule->formula as $formula) {
 
  974                                                                                                $objConditional->addCondition((
string)$formula);
 
  977                                                                                        $objConditional->addCondition((
string)$cfRule->formula);
 
  979                                                                                $objConditional->setStyle(clone $dxfs[intval($cfRule[
"dxfId"])]);
 
  985                                                                        foreach ($aReferences as $reference) {
 
  991                                                        $aKeys = array(
"sheet", 
"objects", 
"scenarios", 
"formatCells", 
"formatColumns", 
"formatRows", 
"insertColumns", 
"insertRows", 
"insertHyperlinks", 
"deleteColumns", 
"deleteRows", 
"selectLockedCells", 
"sort", 
"autoFilter", 
"pivotTables", 
"selectUnlockedCells");
 
  992                                                        if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) {
 
  993                                                                foreach ($aKeys as 
$key) {
 
  994                                                                        $method = 
"set" . ucfirst(
$key);
 
  995                                                                        $docSheet->getProtection()->$method(self::boolean((
string) $xmlSheet->sheetProtection[
$key]));
 
  999                                                        if (!$this->_readDataOnly && $xmlSheet && $xmlSheet->sheetProtection) {
 
 1000                                                                $docSheet->getProtection()->setPassword((
string) $xmlSheet->sheetProtection[
"password"], TRUE);
 
 1001                                                                if ($xmlSheet->protectedRanges->protectedRange) {
 
 1002                                                                        foreach ($xmlSheet->protectedRanges->protectedRange as $protectedRange) {
 
 1003                                                                                $docSheet->protectCells((
string) $protectedRange[
"sqref"], (
string) $protectedRange[
"password"], 
true);
 
 1008                                                        if ($xmlSheet && $xmlSheet->autoFilter && !$this->_readDataOnly) {
 
 1009                                $autoFilterRange = (string) $xmlSheet->autoFilter[
"ref"];
 
 1010                                if (strpos($autoFilterRange, 
':') !== 
false) {
 
 1014                                    foreach ($xmlSheet->autoFilter->filterColumn as $filterColumn) {
 
 1017                                        if ($filterColumn->filters) {
 
 1019                                            $filters = $filterColumn->filters;
 
 1020                                            if ((isset($filters[
"blank"])) && ($filters[
"blank"] == 1)) {
 
 1021                                                $column->createRule()->setRule(
 
 1029                                            foreach ($filters->filter as $filterRule) {
 
 1030                                                $column->createRule()->setRule(
 
 1032                                                    (
string) $filterRule[
"val"]
 
 1037                                            foreach ($filters->dateGroupItem as $dateGroupItem) {
 
 1038                                                $column->createRule()->setRule(
 
 1041                                                        'year' => (
string) $dateGroupItem[
"year"],
 
 1042                                                        'month' => (string) $dateGroupItem[
"month"],
 
 1043                                                        'day' => (
string) $dateGroupItem[
"day"],
 
 1044                                                        'hour' => (string) $dateGroupItem[
"hour"],
 
 1045                                                        'minute' => (
string) $dateGroupItem[
"minute"],
 
 1046                                                        'second' => (string) $dateGroupItem[
"second"],
 
 1048                                                    (string) $dateGroupItem[
"dateTimeGrouping"]
 
 1054                                        if ($filterColumn->customFilters) {
 
 1056                                            $customFilters = $filterColumn->customFilters;
 
 1059                                            if ((isset($customFilters[
"and"])) && ($customFilters[
"and"] == 1)) {
 
 1062                                            foreach ($customFilters->customFilter as $filterRule) {
 
 1063                                                $column->createRule()->setRule(
 
 1064                                                    (
string) $filterRule[
"operator"],
 
 1065                                                    (string) $filterRule[
"val"]
 
 1071                                        if ($filterColumn->dynamicFilter) {
 
 1074                                            foreach ($filterColumn->dynamicFilter as $filterRule) {
 
 1075                                                $column->createRule()->setRule(
 
 1077                                                    (
string) $filterRule[
"val"],
 
 1078                                                    (string) $filterRule[
"type"]
 
 1081                                                if (isset($filterRule[
"val"])) {
 
 1082                                                    $column->setAttribute(
'val',(
string) $filterRule[
"val"]);
 
 1084                                                if (isset($filterRule[
"maxVal"])) {
 
 1085                                                    $column->setAttribute(
'maxVal',(
string) $filterRule[
"maxVal"]);
 
 1090                                        if ($filterColumn->top10) {
 
 1093                                            foreach ($filterColumn->top10 as $filterRule) {
 
 1094                                                $column->createRule()->setRule(
 
 1095                                                    (((isset($filterRule[
"percent"])) && ($filterRule[
"percent"] == 1))
 
 1099                                                    (string) $filterRule[
"val"],
 
 1100                                                    (((isset($filterRule[
"top"])) && ($filterRule[
"top"] == 1))
 
 1112                                                        if ($xmlSheet && $xmlSheet->mergeCells && $xmlSheet->mergeCells->mergeCell && !$this->_readDataOnly) {
 
 1113                                                                foreach ($xmlSheet->mergeCells->mergeCell as $mergeCell) {
 
 1114                                                                        $mergeRef = (string) $mergeCell[
"ref"];
 
 1115                                                                        if (strpos($mergeRef,
':') !== FALSE) {
 
 1116                                                                                $docSheet->mergeCells((
string) $mergeCell[
"ref"]);
 
 1121                                                        if ($xmlSheet && $xmlSheet->pageMargins && !$this->_readDataOnly) {
 
 1122                                                                $docPageMargins = $docSheet->getPageMargins();
 
 1123                                                                $docPageMargins->setLeft(floatval($xmlSheet->pageMargins[
"left"]));
 
 1124                                                                $docPageMargins->setRight(floatval($xmlSheet->pageMargins[
"right"]));
 
 1125                                                                $docPageMargins->setTop(floatval($xmlSheet->pageMargins[
"top"]));
 
 1126                                                                $docPageMargins->setBottom(floatval($xmlSheet->pageMargins[
"bottom"]));
 
 1127                                                                $docPageMargins->setHeader(floatval($xmlSheet->pageMargins[
"header"]));
 
 1128                                                                $docPageMargins->setFooter(floatval($xmlSheet->pageMargins[
"footer"]));
 
 1131                                                        if ($xmlSheet && $xmlSheet->pageSetup && !$this->_readDataOnly) {
 
 1132                                                                $docPageSetup = $docSheet->getPageSetup();
 
 1134                                                                if (isset($xmlSheet->pageSetup[
"orientation"])) {
 
 1135                                                                        $docPageSetup->setOrientation((
string) $xmlSheet->pageSetup[
"orientation"]);
 
 1137                                                                if (isset($xmlSheet->pageSetup[
"paperSize"])) {
 
 1138                                                                        $docPageSetup->setPaperSize(intval($xmlSheet->pageSetup[
"paperSize"]));
 
 1140                                                                if (isset($xmlSheet->pageSetup[
"scale"])) {
 
 1141                                                                        $docPageSetup->setScale(intval($xmlSheet->pageSetup[
"scale"]), FALSE);
 
 1143                                                                if (isset($xmlSheet->pageSetup[
"fitToHeight"]) && intval($xmlSheet->pageSetup[
"fitToHeight"]) >= 0) {
 
 1144                                                                        $docPageSetup->setFitToHeight(intval($xmlSheet->pageSetup[
"fitToHeight"]), FALSE);
 
 1146                                                                if (isset($xmlSheet->pageSetup[
"fitToWidth"]) && intval($xmlSheet->pageSetup[
"fitToWidth"]) >= 0) {
 
 1147                                                                        $docPageSetup->setFitToWidth(intval($xmlSheet->pageSetup[
"fitToWidth"]), FALSE);
 
 1149                                                                if (isset($xmlSheet->pageSetup[
"firstPageNumber"]) && isset($xmlSheet->pageSetup[
"useFirstPageNumber"]) &&
 
 1150                                                                        self::boolean((
string) $xmlSheet->pageSetup[
"useFirstPageNumber"])) {
 
 1151                                                                        $docPageSetup->setFirstPageNumber(intval($xmlSheet->pageSetup[
"firstPageNumber"]));
 
 1155                                                        if ($xmlSheet && $xmlSheet->headerFooter && !$this->_readDataOnly) {
 
 1156                                                                $docHeaderFooter = $docSheet->getHeaderFooter();
 
 1158                                                                if (isset($xmlSheet->headerFooter[
"differentOddEven"]) &&
 
 1159                                                                        self::boolean((
string)$xmlSheet->headerFooter[
"differentOddEven"])) {
 
 1160                                                                        $docHeaderFooter->setDifferentOddEven(TRUE);
 
 1162                                                                        $docHeaderFooter->setDifferentOddEven(FALSE);
 
 1164                                                                if (isset($xmlSheet->headerFooter[
"differentFirst"]) &&
 
 1165                                                                        self::boolean((
string)$xmlSheet->headerFooter[
"differentFirst"])) {
 
 1166                                                                        $docHeaderFooter->setDifferentFirst(TRUE);
 
 1168                                                                        $docHeaderFooter->setDifferentFirst(FALSE);
 
 1170                                                                if (isset($xmlSheet->headerFooter[
"scaleWithDoc"]) &&
 
 1171                                                                        !
self::boolean((
string)$xmlSheet->headerFooter[
"scaleWithDoc"])) {
 
 1172                                                                        $docHeaderFooter->setScaleWithDocument(FALSE);
 
 1174                                                                        $docHeaderFooter->setScaleWithDocument(TRUE);
 
 1176                                                                if (isset($xmlSheet->headerFooter[
"alignWithMargins"]) &&
 
 1177                                                                        !
self::boolean((
string)$xmlSheet->headerFooter[
"alignWithMargins"])) {
 
 1178                                                                        $docHeaderFooter->setAlignWithMargins(FALSE);
 
 1180                                                                        $docHeaderFooter->setAlignWithMargins(TRUE);
 
 1183                                                                $docHeaderFooter->setOddHeader((
string) $xmlSheet->headerFooter->oddHeader);
 
 1184                                                                $docHeaderFooter->setOddFooter((
string) $xmlSheet->headerFooter->oddFooter);
 
 1185                                                                $docHeaderFooter->setEvenHeader((
string) $xmlSheet->headerFooter->evenHeader);
 
 1186                                                                $docHeaderFooter->setEvenFooter((
string) $xmlSheet->headerFooter->evenFooter);
 
 1187                                                                $docHeaderFooter->setFirstHeader((
string) $xmlSheet->headerFooter->firstHeader);
 
 1188                                                                $docHeaderFooter->setFirstFooter((
string) $xmlSheet->headerFooter->firstFooter);
 
 1191                                                        if ($xmlSheet && $xmlSheet->rowBreaks && $xmlSheet->rowBreaks->brk && !$this->_readDataOnly) {
 
 1192                                                                foreach ($xmlSheet->rowBreaks->brk as $brk) {
 
 1198                                                        if ($xmlSheet && $xmlSheet->colBreaks && $xmlSheet->colBreaks->brk && !$this->_readDataOnly) {
 
 1199                                                                foreach ($xmlSheet->colBreaks->brk as $brk) {
 
 1206                                                        if ($xmlSheet && $xmlSheet->dataValidations && !$this->_readDataOnly) {
 
 1207                                                                foreach ($xmlSheet->dataValidations->dataValidation as $dataValidation) {
 
 1209                                                                $range = strtoupper($dataValidation[
"sqref"]);
 
 1210                                                                        $rangeSet = explode(
' ',$range);
 
 1211                                                                        foreach($rangeSet as $range) {
 
 1212                                                                                $stRange = $docSheet->shrinkRangeToFit($range);
 
 1216                                                                                foreach ($aReferences as $reference) {
 
 1218                                                                                        $docValidation = $docSheet->getCell($reference)->getDataValidation();
 
 1219                                                                                        $docValidation->setType((
string) $dataValidation[
"type"]);
 
 1220                                                                                        $docValidation->setErrorStyle((
string) $dataValidation[
"errorStyle"]);
 
 1221                                                                                        $docValidation->setOperator((
string) $dataValidation[
"operator"]);
 
 1222                                                                                        $docValidation->setAllowBlank($dataValidation[
"allowBlank"] != 0);
 
 1223                                                                                        $docValidation->setShowDropDown($dataValidation[
"showDropDown"] == 0);
 
 1224                                                                                        $docValidation->setShowInputMessage($dataValidation[
"showInputMessage"] != 0);
 
 1225                                                                                        $docValidation->setShowErrorMessage($dataValidation[
"showErrorMessage"] != 0);
 
 1226                                                                                        $docValidation->setErrorTitle((
string) $dataValidation[
"errorTitle"]);
 
 1227                                                                                        $docValidation->setError((
string) $dataValidation[
"error"]);
 
 1228                                                                                        $docValidation->setPromptTitle((
string) $dataValidation[
"promptTitle"]);
 
 1229                                                                                        $docValidation->setPrompt((
string) $dataValidation[
"prompt"]);
 
 1230                                                                                        $docValidation->setFormula1((
string) $dataValidation->formula1);
 
 1231                                                                                        $docValidation->setFormula2((
string) $dataValidation->formula2);
 
 1238                                                        $hyperlinks = array();
 
 1239                                                        if (!$this->_readDataOnly) {
 
 1241                                                                if ($zip->locateName(dirname(
"$dir/$fileWorksheet") . 
"/_rels/" . basename($fileWorksheet) . 
".rels")) {
 
 1243                                                                        foreach ($relsWorksheet->Relationship as $ele) {
 
 1244                                                                                if ($ele[
"Type"] == 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink") {
 
 1245                                                                                        $hyperlinks[(string)$ele[
"Id"]] = (
string)$ele[
"Target"];
 
 1251                                                                if ($xmlSheet && $xmlSheet->hyperlinks) {
 
 1252                                                                        foreach ($xmlSheet->hyperlinks->hyperlink as $hyperlink) {
 
 1254                                                                                $linkRel = $hyperlink->attributes(
'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
 
 1257                                                                                        $cell = $docSheet->getCell( $cellReference );
 
 1258                                                                                        if (isset($linkRel[
'id'])) {
 
 1259                                                                                                $hyperlinkUrl = $hyperlinks[ (string)$linkRel[
'id'] ];
 
 1260                                                                                                if (isset($hyperlink[
'location'])) {
 
 1261                                                                                                        $hyperlinkUrl .= 
'#' . (string) $hyperlink[
'location'];
 
 1263                                                                                                $cell->getHyperlink()->setUrl($hyperlinkUrl);
 
 1264                                                                                        } elseif (isset($hyperlink[
'location'])) {
 
 1265                                                                                                $cell->getHyperlink()->setUrl( 
'sheet://' . (
string)$hyperlink[
'location'] );
 
 1269                                                                                        if (isset($hyperlink[
'tooltip'])) {
 
 1270                                                                                                $cell->getHyperlink()->setTooltip( (
string)$hyperlink[
'tooltip'] );
 
 1278                                                        $comments = array();
 
 1279                                                        $vmlComments = array();
 
 1280                                                        if (!$this->_readDataOnly) {
 
 1282                                                                if ($zip->locateName(dirname(
"$dir/$fileWorksheet") . 
"/_rels/" . basename($fileWorksheet) . 
".rels")) {
 
 1284                                                                        foreach ($relsWorksheet->Relationship as $ele) {
 
 1285                                                                            if ($ele[
"Type"] == 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments") {
 
 1286                                                                                        $comments[(string)$ele[
"Id"]] = (
string)$ele[
"Target"];
 
 1288                                                                            if ($ele[
"Type"] == 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing") {
 
 1289                                                                                        $vmlComments[(string)$ele[
"Id"]] = (
string)$ele[
"Target"];
 
 1295                                                                foreach ($comments as $relName => $relPath) {
 
 1304                                                                        foreach ($commentsFile->authors->author as $author) {
 
 1305                                                                                $authors[] = (string)$author;
 
 1309                                                                        foreach ($commentsFile->commentList->comment as 
$comment) {
 
 1311                                                                                        $docSheet->getComment( (
string)
$comment[
'ref'] )->setAuthor( $authors[(
string)
$comment[
'authorId']] );
 
 1317                                                            foreach ($vmlComments as $relName => $relPath) {
 
 1321                                                                        $vmlCommentsFile->registerXPathNamespace(
'v', 
'urn:schemas-microsoft-com:vml');
 
 1323                                                                        $shapes = $vmlCommentsFile->xpath(
'//v:shape');
 
 1324                                                                        foreach ($shapes as $shape) {
 
 1325                                                                                $shape->registerXPathNamespace(
'v', 
'urn:schemas-microsoft-com:vml');
 
 1327                                                                                if (isset($shape[
'style'])) {
 
 1328                                                                                $style        = (string)$shape[
'style'];
 
 1329                                                                                $fillColor    = strtoupper( substr( (
string)$shape[
'fillcolor'], 1 ) );
 
 1333                                                                                $clientData   = $shape->xpath(
'.//x:ClientData');
 
 1334                                                                                if (is_array($clientData) && !empty($clientData)) {
 
 1335                                                                                        $clientData   = $clientData[0];
 
 1337                                                                                        if ( isset($clientData[
'ObjectType']) && (
string)$clientData[
'ObjectType'] == 
'Note' ) {
 
 1338                                                                                            $temp = $clientData->xpath(
'.//x:Row');
 
 1339                                                                                            if (is_array($temp)) 
$row = $temp[0];
 
 1341                                                                                            $temp = $clientData->xpath(
'.//x:Column');
 
 1342                                                                                            if (is_array($temp)) 
$column = $temp[0];
 
 1349                                                                                    $comment->getFillColor()->setRGB( $fillColor );
 
 1352                                                                                    $styleArray = explode(
';', str_replace(
' ', 
'', 
$style));
 
 1353                                                                                    foreach ($styleArray as $stylePair) {
 
 1354                                                                                        $stylePair = explode(
':', $stylePair);
 
 1356                                                                                        if ($stylePair[0] == 
'margin-left')     
$comment->setMarginLeft($stylePair[1]);
 
 1357                                                                                        if ($stylePair[0] == 
'margin-top')      
$comment->setMarginTop($stylePair[1]);
 
 1358                                                                                        if ($stylePair[0] == 
'width')           
$comment->setWidth($stylePair[1]);
 
 1359                                                                                        if ($stylePair[0] == 
'height')          
$comment->setHeight($stylePair[1]);
 
 1360                                                                                        if ($stylePair[0] == 
'visibility')      
$comment->setVisible( $stylePair[1] == 
'visible' );
 
 1369                                                                if ($xmlSheet && $xmlSheet->legacyDrawingHF && !$this->_readDataOnly) {
 
 1370                                                                        if ($zip->locateName(dirname(
"$dir/$fileWorksheet") . 
"/_rels/" . basename($fileWorksheet) . 
".rels")) {
 
 1372                                                                                $vmlRelationship = 
'';
 
 1374                                                                                foreach ($relsWorksheet->Relationship as $ele) {
 
 1375                                                                                        if ($ele[
"Type"] == 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing") {
 
 1376                                                                                                $vmlRelationship = 
self::dir_add(
"$dir/$fileWorksheet", $ele[
"Target"]);
 
 1380                                                                                if ($vmlRelationship != 
'') {
 
 1383                                                                                        $drawings = array();
 
 1384                                                                                        foreach ($relsVML->Relationship as $ele) {
 
 1385                                                                                                if ($ele[
"Type"] == 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
 
 1386                                                                                                        $drawings[(string) $ele[
"Id"]] = self::dir_add($vmlRelationship, $ele[
"Target"]);
 
 1392                                                                                        $vmlDrawing->registerXPathNamespace(
'v', 
'urn:schemas-microsoft-com:vml');
 
 1394                                                                                        $hfImages = array();
 
 1396                                                                                        $shapes = $vmlDrawing->xpath(
'//v:shape');
 
 1397                                                                                        foreach ($shapes as $idx => $shape) {
 
 1398                                                                                                $shape->registerXPathNamespace(
'v', 
'urn:schemas-microsoft-com:vml');
 
 1399                                                                                                $imageData = $shape->xpath(
'//v:imagedata');
 
 1400                                                                                                $imageData = $imageData[$idx];
 
 1402                                                                                                $imageData = $imageData->attributes(
'urn:schemas-microsoft-com:office:office');
 
 1406                                                                                                if (isset($imageData[
'title'])) {
 
 1407                                                                                                        $hfImages[ (string)$shape[
'id'] ]->setName( (
string)$imageData[
'title'] );
 
 1410                                                                                                $hfImages[ (string)$shape[
'id'] ]->setPath(
"zip://".
PHPExcel_Shared_File::realpath($pFilename).
"#" . $drawings[(string)$imageData[
'relid']], 
false);
 
 1411                                                                                                $hfImages[ (string)$shape[
'id'] ]->setResizeProportional(
false);
 
 1412                                                                                                $hfImages[ (string)$shape[
'id'] ]->setWidth(
$style[
'width']);
 
 1413                                                                                                $hfImages[ (string)$shape[
'id'] ]->setHeight(
$style[
'height']);
 
 1414                                                                                                if (isset(
$style[
'margin-left'])) {
 
 1415                                                                                                        $hfImages[ (string)$shape[
'id'] ]->setOffsetX(
$style[
'margin-left']);
 
 1417                                                                                                $hfImages[ (string)$shape[
'id'] ]->setOffsetY(
$style[
'margin-top']);
 
 1418                                                                                                $hfImages[ (string)$shape[
'id'] ]->setResizeProportional(
true);
 
 1421                                                                                        $docSheet->getHeaderFooter()->setImages($hfImages);
 
 1429                                                        if ($zip->locateName(dirname(
"$dir/$fileWorksheet") . 
"/_rels/" . basename($fileWorksheet) . 
".rels")) {
 
 1431                                                                $drawings = array();
 
 1432                                                                foreach ($relsWorksheet->Relationship as $ele) {
 
 1433                                                                        if ($ele[
"Type"] == 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing") {
 
 1434                                                                                $drawings[(string) $ele[
"Id"]] = self::dir_add(
"$dir/$fileWorksheet", $ele[
"Target"]);
 
 1437                                                                if ($xmlSheet->drawing && !$this->_readDataOnly) {
 
 1438                                                                        foreach ($xmlSheet->drawing as $drawing) {
 
 1439                                                                                $fileDrawing = $drawings[(string) self::array_item($drawing->attributes(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships"), 
"id")];
 
 1443                                                                                if ($relsDrawing && $relsDrawing->Relationship) {
 
 1444                                                                                        foreach ($relsDrawing->Relationship as $ele) {
 
 1445                                                                                                if ($ele[
"Type"] == 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image") {
 
 1446                                                                                                        $images[(string) $ele[
"Id"]] = self::dir_add($fileDrawing, $ele[
"Target"]);
 
 1447                                                                                                } elseif ($ele[
"Type"] == 
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart") {
 
 1448                                                                                                        if ($this->_includeCharts) {
 
 1449                                                                                                                $charts[
self::dir_add($fileDrawing, $ele[
"Target"])] = array(
'id'               => (
string) $ele[
"Id"],
 
 1450                                                                                                                                                                                                                                         'sheet'        => $docSheet->getTitle()
 
 1458                                                                                if ($xmlDrawing->oneCellAnchor) {
 
 1459                                                                                        foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor) {
 
 1460                                                                                                if ($oneCellAnchor->pic->blipFill) {
 
 1461                                                                                                        $blip = $oneCellAnchor->pic->blipFill->children(
"http://schemas.openxmlformats.org/drawingml/2006/main")->blip;
 
 1462                                                                                                        $xfrm = $oneCellAnchor->pic->spPr->children(
"http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm;
 
 1463                                                                                                        $outerShdw = $oneCellAnchor->pic->spPr->children(
"http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw;
 
 1465                                                                                                        $objDrawing->setName((
string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), 
"name"));
 
 1466                                                                                                        $objDrawing->setDescription((
string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes(), 
"descr"));
 
 1467                                                                                                        $objDrawing->setPath(
"zip://".
PHPExcel_Shared_File::realpath($pFilename).
"#" . $images[(
string) self::array_item($blip->attributes(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships"), 
"embed")], 
false);
 
 1479                                                                                                                $shadow->setVisible(
true);
 
 1480                                                                                                                $shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), 
"blurRad")));
 
 1481                                                                                                                $shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), 
"dist")));
 
 1483                                                                                                                $shadow->setAlignment((
string) self::array_item($outerShdw->attributes(), 
"algn"));
 
 1484                                                                                                                $shadow->getColor()->setRGB(self::array_item($outerShdw->srgbClr->attributes(), 
"val"));
 
 1485                                                                                                                $shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), 
"val") / 1000);
 
 1498                                                                                if ($xmlDrawing->twoCellAnchor) {
 
 1499                                                                                        foreach ($xmlDrawing->twoCellAnchor as $twoCellAnchor) {
 
 1500                                                                                                if ($twoCellAnchor->pic->blipFill) {
 
 1501                                                                                                        $blip = $twoCellAnchor->pic->blipFill->children(
"http://schemas.openxmlformats.org/drawingml/2006/main")->blip;
 
 1502                                                                                                        $xfrm = $twoCellAnchor->pic->spPr->children(
"http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm;
 
 1503                                                                                                        $outerShdw = $twoCellAnchor->pic->spPr->children(
"http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw;
 
 1505                                                                                                        $objDrawing->setName((
string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), 
"name"));
 
 1506                                                                                                        $objDrawing->setDescription((
string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes(), 
"descr"));
 
 1507                                                                                                        $objDrawing->setPath(
"zip://".
PHPExcel_Shared_File::realpath($pFilename).
"#" . $images[(
string) self::array_item($blip->attributes(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships"), 
"embed")], 
false);
 
 1520                                                                                                                $shadow->setVisible(
true);
 
 1521                                                                                                                $shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), 
"blurRad")));
 
 1522                                                                                                                $shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes(), 
"dist")));
 
 1524                                                                                                                $shadow->setAlignment((
string) self::array_item($outerShdw->attributes(), 
"algn"));
 
 1525                                                                                                                $shadow->getColor()->setRGB(self::array_item($outerShdw->srgbClr->attributes(), 
"val"));
 
 1526                                                                                                                $shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes(), 
"val") / 1000);
 
 1529                                                                                                } elseif(($this->_includeCharts) && ($twoCellAnchor->graphicFrame)) {
 
 1536                                                                                                        $graphic                = $twoCellAnchor->graphicFrame->children(
"http://schemas.openxmlformats.org/drawingml/2006/main")->graphic;
 
 1537                                                                                                        $chartRef               = $graphic->graphicData->children(
"http://schemas.openxmlformats.org/drawingml/2006/chart")->chart;
 
 1538                                                                                                        $thisChart              = (string) $chartRef->attributes(
"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
 
 1540                                                                                                        $chartDetails[$docSheet->getTitle().
'!'.$thisChart] =
 
 1541                                                                                                                        array(  
'fromCoordinate'        => $fromCoordinate,
 
 1542                                                                                                                                        'fromOffsetX'           => $fromOffsetX,
 
 1543                                                                                                                                        'fromOffsetY'           => $fromOffsetY,
 
 1544                                                                                                                                        'toCoordinate'          => $toCoordinate,
 
 1545                                                                                                                                        'toOffsetX'                     => $toOffsetX,
 
 1546                                                                                                                                        'toOffsetY'                     => $toOffsetY,
 
 1547                                                                                                                                        'worksheetTitle'        => $docSheet->getTitle()
 
 1558                                                        if ($xmlWorkbook->definedNames) {
 
 1559                                                                foreach ($xmlWorkbook->definedNames->definedName as $definedName) {
 
 1561                                                                        $extractedRange = (string)$definedName;
 
 1562                                                                        $extractedRange = preg_replace(
'/\'(\w+)\'\!/', 
'', $extractedRange);
 
 1563                                                                        if (($spos = strpos($extractedRange,
'!')) !== 
false) {
 
 1564                                                                                $extractedRange = substr($extractedRange,0,$spos).str_replace(
'$', 
'', substr($extractedRange,$spos));
 
 1566                                                                                $extractedRange = str_replace(
'$', 
'', $extractedRange);
 
 1570                                                                        if (stripos((
string)$definedName, 
'#REF!') !== FALSE || $extractedRange == 
'') {
 
 1575                                                                        if ((
string)$definedName[
'localSheetId'] != 
'' && (
string)$definedName[
'localSheetId'] == $sheetId) {
 
 1577                                                                                switch ((
string)$definedName[
'name']) {
 
 1579                                                                                        case '_xlnm._FilterDatabase':
 
 1580                                                                                                if ((
string)$definedName[
'hidden'] !== 
'1') {
 
 1581                                                    $extractedRange = explode(
',', $extractedRange);
 
 1582                                                    foreach ($extractedRange as $range) {
 
 1583                                                        $autoFilterRange = $range;
 
 1584                                                        if (strpos($autoFilterRange, 
':') !== 
false) {
 
 1585                                                            $docSheet->getAutoFilter()->setRange($autoFilterRange);
 
 1591                                                                                        case '_xlnm.Print_Titles':
 
 1593                                                                                                $extractedRange = explode(
',', $extractedRange);
 
 1596                                                                                                foreach ($extractedRange as $range) {
 
 1598                                                                                                        $range = str_replace(
'$', 
'', $range);
 
 1601                                                                                                        if (preg_match(
'/!?([A-Z]+)\:([A-Z]+)$/', $range, $matches)) {
 
 1602                                                                                                                $docSheet->getPageSetup()->setColumnsToRepeatAtLeft(array($matches[1], $matches[2]));
 
 1605                                                                                                        elseif (preg_match(
'/!?(\d+)\:(\d+)$/', $range, $matches)) {
 
 1606                                                                                                                $docSheet->getPageSetup()->setRowsToRepeatAtTop(array($matches[1], $matches[2]));
 
 1611                                                                                        case '_xlnm.Print_Area':
 
 1612                                                                                                $rangeSets = explode(
',', $extractedRange);             
 
 1613                                                                                                $newRangeSets = array();
 
 1614                                                                                                foreach($rangeSets as $rangeSet) {
 
 1615                                                                                                        $range = explode(
'!', $rangeSet);       
 
 1616                                                                                                        $rangeSet = isset($range[1]) ? $range[1] : $range[0];
 
 1617                                                                                                        if (strpos($rangeSet, 
':') === FALSE) {
 
 1618                                                                                                                $rangeSet = $rangeSet . 
':' . $rangeSet;
 
 1620                                                                                                        $newRangeSets[] = str_replace(
'$', 
'', $rangeSet);
 
 1622                                                                                                $docSheet->getPageSetup()->setPrintArea(implode(
',',$newRangeSets));
 
 1637                                                if ($xmlWorkbook->definedNames) {
 
 1638                                                        foreach ($xmlWorkbook->definedNames->definedName as $definedName) {
 
 1640                                                                $extractedRange = (string)$definedName;
 
 1641                                                                $extractedRange = preg_replace(
'/\'(\w+)\'\!/', 
'', $extractedRange);
 
 1642                                                                if (($spos = strpos($extractedRange,
'!')) !== 
false) {
 
 1643                                                                        $extractedRange = substr($extractedRange,0,$spos).str_replace(
'$', 
'', substr($extractedRange,$spos));
 
 1645                                                                        $extractedRange = str_replace(
'$', 
'', $extractedRange);
 
 1649                                                                if (stripos((
string)$definedName, 
'#REF!') !== 
false || $extractedRange == 
'') {
 
 1654                                                                if ((
string)$definedName[
'localSheetId'] != 
'') {
 
 1657                                                                        switch ((
string)$definedName[
'name']) {
 
 1659                                                                                case '_xlnm._FilterDatabase':
 
 1660                                                                                case '_xlnm.Print_Titles':
 
 1661                                                                                case '_xlnm.Print_Area':
 
 1665                                                                                        if ($mapSheetId[(integer) $definedName[
'localSheetId']] !== 
null) {
 
 1666                                                                                                $range = explode(
'!', (
string)$definedName);
 
 1667                                                                                                if (count($range) == 2) {
 
 1668                                                                                                        $range[0] = str_replace(
"''", 
"'", $range[0]);
 
 1669                                                                                                        $range[0] = str_replace(
"'", 
"", $range[0]);
 
 1670                                                                                                        if (
$worksheet = $docSheet->getParent()->getSheetByName($range[0])) {
 
 1671                                                                                                                $extractedRange = str_replace(
'$', 
'', $range[1]);
 
 1672                                                                                                                $scope = $docSheet->getParent()->getSheet($mapSheetId[(integer) $definedName[
'localSheetId']]);
 
 1679                                                                } 
else if (!isset($definedName[
'localSheetId'])) {
 
 1681                                                                        $locatedSheet = 
null;
 
 1682                                                                        $extractedSheetName = 
'';
 
 1683                                                                        if (strpos( (
string)$definedName, 
'!' ) !== 
false) {
 
 1686                                                                                $extractedSheetName = $extractedSheetName[0];
 
 1689                                                                                $locatedSheet = $excel->getSheetByName($extractedSheetName);
 
 1692                                                                                $range = explode(
'!', $extractedRange);
 
 1693                                                                                $extractedRange = isset($range[1]) ? $range[1] : $range[0];
 
 1696                                                                        if ($locatedSheet !== NULL) {
 
 1697                                                                                $excel->addNamedRange( 
new PHPExcel_NamedRange((
string)$definedName[
'name'], $locatedSheet, $extractedRange, 
false) );
 
 1704                                        if ((!$this->_readDataOnly) || (!empty($this->_loadSheetsOnly))) {
 
 1706                                                $activeTab = intval($xmlWorkbook->bookViews->workbookView[
"activeTab"]); 
 
 1709                                                if (isset($mapSheetId[$activeTab]) && $mapSheetId[$activeTab] !== 
null) {
 
 1710                                                        $excel->setActiveSheetIndex($mapSheetId[$activeTab]);
 
 1712                                                        if ($excel->getSheetCount() == 0) {
 
 1713                                                                $excel->createSheet();
 
 1715                                                        $excel->setActiveSheetIndex(0);
 
 1724                if (!$this->_readDataOnly) {
 
 1728                                        case "application/vnd.openxmlformats-officedocument.drawingml.chart+xml":
 
 1729                                                if ($this->_includeCharts) {
 
 1737                                                        if (isset($charts[$chartEntryRef])) {
 
 1738                                                                $chartPositionRef = $charts[$chartEntryRef][
'sheet'].
'!'.$charts[$chartEntryRef][
'id'];
 
 1740                                                                if (isset($chartDetails[$chartPositionRef])) {
 
 1743                                                                        $excel->getSheetByName($charts[$chartEntryRef][
'sheet'])->addChart($objChart);
 
 1744                                                                        $objChart->setWorksheet($excel->getSheetByName($charts[$chartEntryRef][
'sheet']));
 
 1745                                                                        $objChart->setTopLeftPosition( $chartDetails[$chartPositionRef][
'fromCoordinate'],
 
 1746                                                                                                                                   $chartDetails[$chartPositionRef][
'fromOffsetX'],
 
 1747                                                                                                                                   $chartDetails[$chartPositionRef][
'fromOffsetY']
 
 1749                                                                        $objChart->setBottomRightPosition( $chartDetails[$chartPositionRef][
'toCoordinate'],
 
 1750                                                                                                                                           $chartDetails[$chartPositionRef][
'toOffsetX'],
 
 1751                                                                                                                                           $chartDetails[$chartPositionRef][
'toOffsetY']
 
 1767                if (isset($color[
"rgb"])) {
 
 1768                        return (
string)$color[
"rgb"];
 
 1769                } 
else if (isset($color[
"indexed"])) {
 
 1771                } 
else if (isset($color[
"theme"])) {
 
 1772                        if (self::$_theme !== NULL) {
 
 1773                                $returnColour = self::$_theme->getColourByIndex((
int)$color[
"theme"]);
 
 1774                                if (isset($color[
"tint"])) {
 
 1775                                        $tintAdjust = (float) $color[
"tint"];
 
 1778                                return 'FF'.$returnColour;
 
 1795                                $docStyle->getNumberFormat()->setFormatCode(
$style->numFmt);
 
 1800                if (isset(
$style->font)) {
 
 1801                        $docStyle->getFont()->setName((
string) 
$style->font->name[
"val"]);
 
 1802                        $docStyle->getFont()->setSize((
string) 
$style->font->sz[
"val"]);
 
 1803                        if (isset(
$style->font->b)) {
 
 1804                                $docStyle->getFont()->setBold(!isset(
$style->font->b[
"val"]) || self::boolean((
string) 
$style->font->b[
"val"]));
 
 1806                        if (isset(
$style->font->i)) {
 
 1807                                $docStyle->getFont()->setItalic(!isset(
$style->font->i[
"val"]) || self::boolean((
string) 
$style->font->i[
"val"]));
 
 1809                        if (isset(
$style->font->strike)) {
 
 1810                                $docStyle->getFont()->setStrikethrough(!isset(
$style->font->strike[
"val"]) || self::boolean((
string) 
$style->font->strike[
"val"]));
 
 1812                        $docStyle->getFont()->getColor()->setARGB(self::_readColor(
$style->font->color));
 
 1814                        if (isset(
$style->font->u) && !isset(
$style->font->u[
"val"])) {
 
 1816                        } 
else if (isset(
$style->font->u) && isset(
$style->font->u[
"val"])) {
 
 1817                                $docStyle->getFont()->setUnderline((
string)
$style->font->u[
"val"]);
 
 1820                        if (isset(
$style->font->vertAlign) && isset(
$style->font->vertAlign[
"val"])) {
 
 1821                                $vertAlign = strtolower((
string)
$style->font->vertAlign[
"val"]);
 
 1822                                if ($vertAlign == 
'superscript') {
 
 1823                                        $docStyle->getFont()->setSuperScript(
true);
 
 1825                                if ($vertAlign == 
'subscript') {
 
 1826                                        $docStyle->getFont()->setSubScript(
true);
 
 1832                if (isset(
$style->fill)) {
 
 1833                        if (
$style->fill->gradientFill) {
 
 1834                                $gradientFill = 
$style->fill->gradientFill[0];
 
 1835                                if(!empty($gradientFill[
"type"])) {
 
 1836                                        $docStyle->getFill()->setFillType((
string) $gradientFill[
"type"]);
 
 1838                                $docStyle->getFill()->setRotation(floatval($gradientFill[
"degree"]));
 
 1839                                $gradientFill->registerXPathNamespace(
"sml", 
"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
 
 1840                                $docStyle->getFill()->getStartColor()->setARGB(self::_readColor( self::array_item($gradientFill->xpath(
"sml:stop[@position=0]"))->color) );
 
 1841                                $docStyle->getFill()->getEndColor()->setARGB(self::_readColor( self::array_item($gradientFill->xpath(
"sml:stop[@position=1]"))->color) );
 
 1842                        } elseif (
$style->fill->patternFill) {
 
 1843                                $patternType = (string)
$style->fill->patternFill[
"patternType"] != 
'' ? (
string)
$style->fill->patternFill[
"patternType"] : 
'solid';
 
 1844                                $docStyle->getFill()->setFillType($patternType);
 
 1845                                if (
$style->fill->patternFill->fgColor) {
 
 1846                                        $docStyle->getFill()->getStartColor()->setARGB(self::_readColor(
$style->fill->patternFill->fgColor,
true));
 
 1848                                        $docStyle->getFill()->getStartColor()->setARGB(
'FF000000');
 
 1850                                if (
$style->fill->patternFill->bgColor) {
 
 1851                                        $docStyle->getFill()->getEndColor()->setARGB(self::_readColor(
$style->fill->patternFill->bgColor,
true));
 
 1857                if (isset(
$style->border)) {
 
 1858                        $diagonalUp = self::boolean((
string) 
$style->border[
"diagonalUp"]);
 
 1859                        $diagonalDown = self::boolean((
string) 
$style->border[
"diagonalDown"]);
 
 1860                        if (!$diagonalUp && !$diagonalDown) {
 
 1862                        } elseif ($diagonalUp && !$diagonalDown) {
 
 1864                        } elseif (!$diagonalUp && $diagonalDown) {
 
 1869                        self::_readBorder($docStyle->getBorders()->getLeft(), 
$style->border->left);
 
 1870                        self::_readBorder($docStyle->getBorders()->getRight(), 
$style->border->right);
 
 1871                        self::_readBorder($docStyle->getBorders()->getTop(), 
$style->border->top);
 
 1872                        self::_readBorder($docStyle->getBorders()->getBottom(), 
$style->border->bottom);
 
 1873                        self::_readBorder($docStyle->getBorders()->getDiagonal(), 
$style->border->diagonal);
 
 1877                if (isset(
$style->alignment)) {
 
 1878                        $docStyle->getAlignment()->setHorizontal((
string) 
$style->alignment[
"horizontal"]);
 
 1879                        $docStyle->getAlignment()->setVertical((
string) 
$style->alignment[
"vertical"]);
 
 1882                        if ((
int)
$style->alignment[
"textRotation"] <= 90) {
 
 1883                                $textRotation = (int)
$style->alignment[
"textRotation"];
 
 1884                        } 
else if ((
int)
$style->alignment[
"textRotation"] > 90) {
 
 1885                                $textRotation = 90 - (int)
$style->alignment[
"textRotation"];
 
 1888                        $docStyle->getAlignment()->setTextRotation(intval($textRotation));
 
 1889                        $docStyle->getAlignment()->setWrapText(self::boolean((
string) 
$style->alignment[
"wrapText"]));
 
 1890                        $docStyle->getAlignment()->setShrinkToFit(self::boolean((
string) 
$style->alignment[
"shrinkToFit"]));
 
 1891                        $docStyle->getAlignment()->setIndent( intval((
string)
$style->alignment[
"indent"]) > 0 ? intval((
string)
$style->alignment[
"indent"]) : 0 );
 
 1892                        $docStyle->getAlignment()->setReadorder( intval((
string)
$style->alignment[
"readingOrder"]) > 0 ? intval((
string)
$style->alignment[
"readingOrder"]) : 0 );
 
 1896                if (isset(
$style->protection)) {
 
 1897                        if (isset(
$style->protection[
'locked'])) {
 
 1898                                if (self::boolean((
string) 
$style->protection[
'locked'])) {
 
 1905                        if (isset(
$style->protection[
'hidden'])) {
 
 1906                                if (self::boolean((
string) 
$style->protection[
'hidden'])) {
 
 1915                if (isset(
$style->quotePrefix)) {
 
 1916                        $docStyle->setQuotePrefix(
$style->quotePrefix);
 
 1922                if (isset($eleBorder[
"style"])) {
 
 1923                        $docBorder->setBorderStyle((
string) $eleBorder[
"style"]);
 
 1925                if (isset($eleBorder->color)) {
 
 1926                        $docBorder->getColor()->setARGB(self::_readColor($eleBorder->color));
 
 1934                if (isset($is->t)) {
 
 1937                        if(is_object($is->r)) {
 
 1938                        foreach ($is->r as $run) {
 
 1939                                if (!isset($run->rPr)) {
 
 1945                                        if (isset($run->rPr->rFont[
"val"])) {
 
 1946                                                $objText->getFont()->setName((
string) $run->rPr->rFont[
"val"]);
 
 1949                                        if (isset($run->rPr->sz[
"val"])) {
 
 1950                                                $objText->getFont()->setSize((
string) $run->rPr->sz[
"val"]);
 
 1953                                        if (isset($run->rPr->color)) {
 
 1954                                                $objText->getFont()->setColor( 
new PHPExcel_Style_Color( self::_readColor($run->rPr->color) ) );
 
 1957                                        if ((isset($run->rPr->b[
"val"]) && self::boolean((
string) $run->rPr->b[
"val"])) ||
 
 1958                                                (isset($run->rPr->b) && !isset($run->rPr->b[
"val"]))) {
 
 1959                                                $objText->getFont()->setBold(TRUE);
 
 1962                                        if ((isset($run->rPr->i[
"val"]) && self::boolean((
string) $run->rPr->i[
"val"])) ||
 
 1963                                                (isset($run->rPr->i) && !isset($run->rPr->i[
"val"]))) {
 
 1964                                                $objText->getFont()->setItalic(TRUE);
 
 1967                                        if (isset($run->rPr->vertAlign) && isset($run->rPr->vertAlign[
"val"])) {
 
 1968                                                $vertAlign = strtolower((
string)$run->rPr->vertAlign[
"val"]);
 
 1969                                                if ($vertAlign == 
'superscript') {
 
 1970                                                        $objText->getFont()->setSuperScript(TRUE);
 
 1972                                                if ($vertAlign == 
'subscript') {
 
 1973                                                        $objText->getFont()->setSubScript(TRUE);
 
 1977                                        if (isset($run->rPr->u) && !isset($run->rPr->u[
"val"])) {
 
 1979                                        } 
else if (isset($run->rPr->u) && isset($run->rPr->u[
"val"])) {
 
 1980                                                $objText->getFont()->setUnderline((
string)$run->rPr->u[
"val"]);
 
 1983                                        if ((isset($run->rPr->strike[
"val"]) && self::boolean((
string) $run->rPr->strike[
"val"])) ||
 
 1984                                                (isset($run->rPr->strike) && !isset($run->rPr->strike[
"val"]))) {
 
 1985                                                $objText->getFont()->setStrikethrough(TRUE);
 
 1997                $baseDir = dirname($customUITarget);
 
 1998                $nameCustomUI = basename($customUITarget);
 
 2000                $localRibbon = $this->_getFromZipArchive($zip, $customUITarget);
 
 2001                $customUIImagesNames = array();
 
 2002        $customUIImagesBinaries = array();
 
 2004                $pathRels = 
$baseDir . 
'/_rels/' . $nameCustomUI . 
'.rels';
 
 2005                $dataRels = $this->_getFromZipArchive($zip, $pathRels);
 
 2011                                foreach ($UIRels->Relationship as $ele) {
 
 2012                                        if ($ele[
"Type"] == 
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image') {
 
 2014                                                $customUIImagesNames[(string) $ele[
'Id']] = (
string)$ele[
'Target'];
 
 2015                                                $customUIImagesBinaries[(string)$ele[
'Target']] = $this->_getFromZipArchive($zip, 
$baseDir . 
'/' . (
string) $ele[
'Target']);
 
 2021                        $excel->setRibbonXMLData($customUITarget, $localRibbon);
 
 2022                        if (count($customUIImagesNames) > 0 && count($customUIImagesBinaries) > 0) {
 
 2023                                $excel->setRibbonBinObjects($customUIImagesNames, $customUIImagesBinaries);
 
 2025                                $excel->setRibbonBinObjects(NULL);
 
 2028                        $excel->setRibbonXMLData(NULL);
 
 2029                        $excel->setRibbonBinObjects(NULL);
 
 2034                return (isset($array[
$key]) ? $array[
$key] : 
null);
 
 2039                return preg_replace(
'~[^/]+/\.\./~', 
'', dirname(
$base) . 
"/$add");
 
 2046                $temp = explode(
';', 
$style);
 
 2048                foreach ($temp as $item) {
 
 2049                        $item = explode(
':', $item);
 
 2051                        if (strpos($item[1], 
'px') !== 
false) {
 
 2052                                $item[1] = str_replace(
'px', 
'', $item[1]);
 
 2054                        if (strpos($item[1], 
'pt') !== 
false) {
 
 2055                                $item[1] = str_replace(
'pt', 
'', $item[1]);
 
 2058                        if (strpos($item[1], 
'in') !== 
false) {
 
 2059                                $item[1] = str_replace(
'in', 
'', $item[1]);
 
 2062                        if (strpos($item[1], 
'cm') !== 
false) {
 
 2063                                $item[1] = str_replace(
'cm', 
'', $item[1]);
 
 2067                        $style[$item[0]] = $item[1];
 
 2075        if (is_object($value)) {
 
 2076                        $value = (string) $value;
 
 2078                if (is_numeric($value)) {
 
 2079                        return (
bool) $value;
 
 2081                return ($value === 
'true' || $value === 
'TRUE');
 
An exception for terminatinating execution or to throw for unit testing.
static extractAllCellReferencesInRange($pRange='A1')
Extract all cell references in range.
static stringFromColumnIndex($pColumnIndex=0)
String from columnindex.
static coordinateFromString($pCoordinateString='A1')
Coordinate from string.
static columnIndexFromString($pString='A')
Column index from string.
static convertPropertyType($propertyType)
static convertProperty($propertyValue, $propertyType)
securityScan($xml)
Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks.
getReadFilter()
Read filter.
securityScanFile($filestream)
Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks.
static readChart($chartElements, $chartName)
__construct()
Create a new PHPExcel_Reader_Excel2007 instance.
_readRibbon($excel, $customUITarget, $zip)
static toCSSArray($style)
listWorksheetInfo($pFilename)
Return worksheet info (Name, Last Column Letter, Last Column Index, Total Rows, Total Columns)
static dir_add($base, $add)
_getFromZipArchive($archive, $fileName='')
static _readColor($color, $background=FALSE)
static array_item($array, $key=0)
static _readBorder($docBorder, $eleBorder)
_castToFormula($c, $r, &$cellDataType, &$value, &$calculatedValue, &$sharedFormulas, $castBaseType)
listWorksheetNames($pFilename)
Reads names of the worksheets from a file, without parsing the whole file to a PHPExcel object.
static boolean($value=NULL)
static _readStyle($docStyle, $style)
canRead($pFilename)
Can the current PHPExcel_Reader_IReader read the file?
static getInstance()
Get an instance of this class.
static getZipClass()
Return the name of the Zip handler Class that PHPExcel is configured to use (PCLZip or ZipArchive) or...
static getLibXmlLoaderOptions()
Get default options for libxml loader.
static setExcelCalendar($baseDate)
Set the Excel calendar (Windows 1900 or Mac 1904)
const CALENDAR_WINDOWS_1900
constants
static EMUToPixels($pValue=0)
Convert EMU to pixels.
static angleToDegrees($pValue=0)
Convert angle to degrees.
static realpath($pFilename)
Returns canonicalized absolute pathname, also for ZIP archives.
static fontSizeToPixels($fontSizeInPoints=11)
Calculate an (approximate) pixel size, based on a font points size.
static centimeterSizeToPixels($sizeInCm=1)
Calculate an (approximate) pixel size, based on centimeter size.
static inchSizeToPixels($sizeInInch=1)
Calculate an (approximate) pixel size, based on inch size.
static ControlCharacterOOXML2PHP($value='')
Convert from OpenXML escaped control character to PHP control character.
static changeBrightness($hex, $adjustPercentage)
Adjust the brightness of a color.
static indexedColor($pIndex, $background=FALSE)
Get indexed color.
const CONDITION_EXPRESSION
const CONDITION_CONTAINSTEXT
const PROTECTION_UNPROTECTED
const PROTECTION_PROTECTED
const AUTOFILTER_COLUMN_RULE_TOPTEN_TOP
const AUTOFILTER_RULETYPE_FILTER
const AUTOFILTER_COLUMN_RULE_TOPTEN_PERCENT
const AUTOFILTER_COLUMN_RULE_TOPTEN_BY_VALUE
const AUTOFILTER_RULETYPE_DYNAMICFILTER
const AUTOFILTER_RULETYPE_TOPTENFILTER
const AUTOFILTER_RULETYPE_CUSTOMFILTER
const AUTOFILTER_COLUMN_RULE_TOPTEN_BOTTOM
const AUTOFILTER_RULETYPE_DATEGROUP
const AUTOFILTER_FILTERTYPE_CUSTOMFILTER
const AUTOFILTER_FILTERTYPE_FILTER
const AUTOFILTER_FILTERTYPE_TOPTENFILTER
const AUTOFILTER_FILTERTYPE_DYNAMICFILTER
const AUTOFILTER_COLUMN_JOIN_AND
static extractSheetTitle($pRange, $returnRange=false)
Extract worksheet title from range.
if( $path[strlen( $path) - 1]==='/') if(is_dir($path)) if(!file_exists( $path)) if(preg_match('#\.php$#D', $path)) $contentType
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
foreach($_POST as $key=> $value) $res