PHPExcel_Reader
[ class tree: PHPExcel_Reader ] [ index: PHPExcel_Reader ] [ all elements ]

Source for file Excel2007.php

Documentation is available at Excel2007.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2009 PHPExcel
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Lesser General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2.1 of the License, or (at your option) any later version.
  11.  *
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Lesser General Public License for more details.
  16.  *
  17.  * You should have received a copy of tshhe GNU Lesser General Public
  18.  * License along with this library; if not, write to the Free Software
  19.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  20.  *
  21.  * @category   PHPExcel
  22.  * @package    PHPExcel_Reader
  23.  * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.6.5, 2009-01-05
  26.  */
  27.  
  28.  
  29. /** PHPExcel */
  30. require_once 'PHPExcel.php';
  31.  
  32. /** PHPExcel_Reader_IReader */
  33. require_once 'PHPExcel/Reader/IReader.php';
  34.  
  35. /** PHPExcel_Worksheet */
  36. require_once 'PHPExcel/Worksheet.php';
  37.  
  38. /** PHPExcel_Cell */
  39. require_once 'PHPExcel/Cell.php';
  40.  
  41. /** PHPExcel_Style */
  42. require_once 'PHPExcel/Style.php';
  43.  
  44. /** PHPExcel_Style_Borders */
  45. require_once 'PHPExcel/Style/Borders.php';
  46.  
  47. /** PHPExcel_Style_Conditional */
  48. require_once 'PHPExcel/Style/Conditional.php';
  49.  
  50. /** PHPExcel_Style_Protection */
  51. require_once 'PHPExcel/Style/Protection.php';
  52.  
  53. /** PHPExcel_Style_NumberFormat */
  54. require_once 'PHPExcel/Style/NumberFormat.php';
  55.  
  56. /** PHPExcel_Worksheet_BaseDrawing */
  57. require_once 'PHPExcel/Worksheet/BaseDrawing.php';
  58.  
  59. /** PHPExcel_Worksheet_Drawing */
  60. require_once 'PHPExcel/Worksheet/Drawing.php';
  61.  
  62. /** PHPExcel_Shared_Drawing */
  63. require_once 'PHPExcel/Shared/Drawing.php';
  64.  
  65. /** PHPExcel_Shared_Date */
  66. require_once 'PHPExcel/Shared/Date.php';
  67.  
  68. /** PHPExcel_Shared_File */
  69. require_once 'PHPExcel/Shared/File.php';
  70.  
  71. /** PHPExcel_Shared_String */
  72. require_once 'PHPExcel/Shared/String.php';
  73.  
  74. /** PHPExcel_ReferenceHelper */
  75. require_once 'PHPExcel/ReferenceHelper.php';
  76.  
  77.  /** PHPExcel_Reader_IReadFilter */
  78. require_once 'PHPExcel/Reader/IReadFilter.php';
  79.  
  80.  /** PHPExcel_Reader_DefaultReadFilter */
  81. require_once 'PHPExcel/Reader/DefaultReadFilter.php';
  82.  
  83.  
  84. /**
  85.  * PHPExcel_Reader_Excel2007
  86.  *
  87.  * @category   PHPExcel
  88.  * @package    PHPExcel_Reader
  89.  * @copyright  Copyright (c) 2006 - 2009 PHPExcel (http://www.codeplex.com/PHPExcel)
  90.  */
  91. class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
  92. {
  93.     /**
  94.      * Read data only?
  95.      *
  96.      * @var boolean 
  97.      */
  98.     private $_readDataOnly = false;
  99.  
  100.     /**
  101.      * Restict which sheets should be loaded?
  102.      *
  103.      * @var array 
  104.      */
  105.     private $_loadSheetsOnly = null;
  106.  
  107.     /**
  108.      * PHPExcel_Reader_IReadFilter instance
  109.      *
  110.      * @var PHPExcel_Reader_IReadFilter 
  111.      */
  112.     private $_readFilter = null;
  113.  
  114.     /**
  115.      * Read data only?
  116.      *
  117.      * @return boolean 
  118.      */
  119.     public function getReadDataOnly({
  120.         return $this->_readDataOnly;
  121.     }
  122.  
  123.     /**
  124.      * Set read data only
  125.      *
  126.      * @param boolean $pValue 
  127.      */
  128.     public function setReadDataOnly($pValue false{
  129.         $this->_readDataOnly = $pValue;
  130.     }
  131.  
  132.     /**
  133.      * Get which sheets to load
  134.      *
  135.      * @return mixed 
  136.      */
  137.     public function getLoadSheetsOnly()
  138.     {
  139.         return $this->_loadSheetsOnly;
  140.     }
  141.  
  142.     /**
  143.      * Set which sheets to load
  144.      *
  145.      * @param mixed $value 
  146.      */
  147.     public function setLoadSheetsOnly($value null)
  148.     {
  149.         $this->_loadSheetsOnly = is_array($value?
  150.             $value array($value);
  151.     }
  152.  
  153.     /**
  154.      * Set all sheets to load
  155.      */
  156.     public function setLoadAllSheets()
  157.     {
  158.         $this->_loadSheetsOnly = null;
  159.     }
  160.  
  161.     /**
  162.      * Read filter
  163.      *
  164.      * @return PHPExcel_Reader_IReadFilter 
  165.      */
  166.     public function getReadFilter({
  167.         return $this->_readFilter;
  168.     }
  169.  
  170.     /**
  171.      * Set read filter
  172.      *
  173.      * @param PHPExcel_Reader_IReadFilter $pValue 
  174.      */
  175.     public function setReadFilter(PHPExcel_Reader_IReadFilter $pValue{
  176.         $this->_readFilter = $pValue;
  177.     }
  178.  
  179.     /**
  180.      * Create a new PHPExcel_Reader_Excel2007 instance
  181.      */
  182.     public function __construct({
  183.         $this->_readFilter = new PHPExcel_Reader_DefaultReadFilter();
  184.     }
  185.  
  186.     /**
  187.      * Loads PHPExcel from file
  188.      *
  189.      * @param     string         $pFilename 
  190.      * @throws     Exception
  191.      */
  192.     public function load($pFilename)
  193.     {
  194.         // Check if file exists
  195.         if (!file_exists($pFilename)) {
  196.             throw new Exception("Could not open " $pFilename " for reading! File does not exist.");
  197.         }
  198.  
  199.         // Initialisations
  200.         $excel new PHPExcel;
  201.         $excel->removeSheetByIndex(0);
  202.         $zip new ZipArchive;
  203.         $zip->open($pFilename);
  204.  
  205.         $rels simplexml_load_string($zip->getFromName("_rels/.rels"))//~ http://schemas.openxmlformats.org/package/2006/relationships");
  206.         foreach ($rels->Relationship as $rel{
  207.             switch ($rel["Type"]{
  208.                 case "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties":
  209.                     $xmlCore simplexml_load_string($zip->getFromName("{$rel['Target']}"));
  210.                     $xmlCore->registerXPathNamespace("dc""http://purl.org/dc/elements/1.1/");
  211.                     $xmlCore->registerXPathNamespace("dcterms""http://purl.org/dc/terms/");
  212.                     $xmlCore->registerXPathNamespace("cp""http://schemas.openxmlformats.org/package/2006/metadata/core-properties");
  213.                     $docProps $excel->getProperties();
  214.                     $docProps->setCreator((string) self::array_item($xmlCore->xpath("dc:creator")));
  215.                     $docProps->setLastModifiedBy((string) self::array_item($xmlCore->xpath("cp:lastModifiedBy")));
  216.                     $docProps->setCreated(strtotime(self::array_item($xmlCore->xpath("dcterms:created"))))//! respect xsi:type
  217.                     $docProps->setModified(strtotime(self::array_item($xmlCore->xpath("dcterms:modified"))))//! respect xsi:type
  218.                     $docProps->setTitle((string) self::array_item($xmlCore->xpath("dc:title")));
  219.                     $docProps->setDescription((string) self::array_item($xmlCore->xpath("dc:description")));
  220.                     $docProps->setSubject((string) self::array_item($xmlCore->xpath("dc:subject")));
  221.                     $docProps->setKeywords((string) self::array_item($xmlCore->xpath("cp:keywords")));
  222.                     $docProps->setCategory((string) self::array_item($xmlCore->xpath("cp:category")));
  223.                 break;
  224.  
  225.                 case "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument":
  226.                     $dir dirname($rel["Target"]);
  227.                     $relsWorkbook simplexml_load_string($zip->getFromName("$dir/_rels/basename($rel["Target"]".rels"));  //~ http://schemas.openxmlformats.org/package/2006/relationships");
  228.                     $relsWorkbook->registerXPathNamespace("rel""http://schemas.openxmlformats.org/package/2006/relationships");
  229.  
  230.                     $sharedStrings array();
  231.                     $xpath self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings']"));
  232.                     $xmlStrings simplexml_load_string($zip->getFromName("$dir/$xpath[Target]"));  //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
  233.                     if (isset($xmlStrings&& isset($xmlStrings->si)) {
  234.                         foreach ($xmlStrings->si as $val{
  235.                             if (isset($val->t)) {
  236.                                 $sharedStrings[PHPExcel_Shared_String::ControlCharacterOOXML2PHP(string) $val->);
  237.                             elseif (isset($val->r)) {
  238.                                 $sharedStrings[$this->_parseRichText($val);
  239.                             }
  240.                         }
  241.                     }
  242.  
  243.                     $worksheets array();
  244.                     foreach ($relsWorkbook->Relationship as $ele{
  245.                         if ($ele["Type"== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"{
  246.                             $worksheets[(string) $ele["Id"]] $ele["Target"];
  247.                         }
  248.                     }
  249.  
  250.                     $styles     array();
  251.                     $cellStyles array();
  252.                     $xpath self::array_item($relsWorkbook->xpath("rel:Relationship[@Type='http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles']"));
  253.                     $xmlStyles simplexml_load_string($zip->getFromName("$dir/$xpath[Target]"))//~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
  254.                     $numFmts $xmlStyles->numFmts[0];
  255.                     if ($numFmts{
  256.                         $numFmts->registerXPathNamespace("sml""http://schemas.openxmlformats.org/spreadsheetml/2006/main");
  257.                     }
  258.                     if (!$this->_readDataOnly{
  259.                         foreach ($xmlStyles->cellXfs->xf as $xf{
  260.                             $numFmt PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
  261.                             if ($numFmts && $xf["numFmtId"]{
  262.                                 $tmpNumFmt self::array_item($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]"));
  263.                                 if (isset($tmpNumFmt["formatCode"])) {
  264.                                     $numFmt = (string) $tmpNumFmt["formatCode"];
  265.                                 else if ((int)$xf["numFmtId"165{
  266.                                     $numFmt PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]);
  267.                                 }
  268.                             }
  269.                             //$numFmt = str_replace('mm', 'i', $numFmt);
  270.                             //$numFmt = str_replace('h', 'H', $numFmt);
  271.  
  272.                             $styles[= (object) array(
  273.                                 "numFmt" => $numFmt,
  274.                                 "font" => $xmlStyles->fonts->font[intval($xf["fontId"])],
  275.                                 "fill" => $xmlStyles->fills->fill[intval($xf["fillId"])],
  276.                                 "border" => $xmlStyles->borders->border[intval($xf["borderId"])],
  277.                                 "alignment" => $xf->alignment,
  278.                                 "protection" => $xf->protection,
  279.                                 "applyAlignment" => (isset($xf["applyAlignment"]&& ((string)$xf["applyAlignment"== 'true' || (string)$xf["applyAlignment"== '1')),
  280.                                 "applyBorder" => (isset($xf["applyBorder"]&& ((string)$xf["applyBorder"== 'true' || (string)$xf["applyBorder"== '1')),
  281.                                 "applyFill" => (isset($xf["applyFill"]&& ((string)$xf["applyFill"== 'true' || (string)$xf["applyFill"== '1')),
  282.                                 "applyFont" => (isset($xf["applyFont"]&& ((string)$xf["applyFont"== 'true' || (string)$xf["applyFont"== '1')),
  283.                                 "applyNumberFormat" => (isset($xf["applyNumberFormat"]&& ((string)$xf["applyNumberFormat"== 'true' || (string)$xf["applyNumberFormat"== '1')),
  284.                                 "applyProtection" => (isset($xf["applyProtection"]&& ((string)$xf["applyProtection"== 'true' || (string)$xf["applyProtection"== '1'))
  285.                             );
  286.                         }
  287.                         
  288.                         foreach ($xmlStyles->cellStyleXfs->xf as $xf{
  289.                             $numFmt PHPExcel_Style_NumberFormat::FORMAT_GENERAL;
  290.                             if ($numFmts && $xf["numFmtId"]{
  291.                                 $tmpNumFmt self::array_item($numFmts->xpath("sml:numFmt[@numFmtId=$xf[numFmtId]]"));
  292.                                 if (isset($tmpNumFmt["formatCode"])) {
  293.                                     $numFmt = (string) $tmpNumFmt["formatCode"];
  294.                                 else if ((int)$xf["numFmtId"165{
  295.                                     $numFmt PHPExcel_Style_NumberFormat::builtInFormatCode((int)$xf["numFmtId"]);
  296.                                 }
  297.                             }
  298.  
  299.                             $cellStyles[= (object) array(
  300.                                 "numFmt" => $numFmt,
  301.                                 "font" => $xmlStyles->fonts->font[intval($xf["fontId"])],
  302.                                 "fill" => $xmlStyles->fills->fill[intval($xf["fillId"])],
  303.                                 "border" => $xmlStyles->borders->border[intval($xf["borderId"])],
  304.                                 "alignment" => $xf->alignment,
  305.                                 "protection" => $xf->protection,
  306.                                 "applyAlignment" => true,
  307.                                 "applyBorder" => true,
  308.                                 "applyFill" => true,
  309.                                 "applyFont" => true,
  310.                                 "applyNumberFormat" => true,
  311.                                 "applyProtection" => true
  312.                             );
  313.                         }
  314.                     }
  315.                     
  316.                     $dxfs array();
  317.                     if (!$this->_readDataOnly{
  318.                         foreach ($xmlStyles->dxfs->dxf as $dxf{
  319.                             $style new PHPExcel_Style;
  320.                             $this->_readStyle($style$dxf);
  321.                             $dxfs[$style;
  322.                         }
  323.                         
  324.                         foreach ($xmlStyles->cellStyles->cellStyle as $cellStyle{
  325.                             if (intval($cellStyle['builtinId']== 0{
  326.                                 if (isset($cellStyles[intval($cellStyle['xfId'])])) {
  327.                                     // Set default style
  328.                                     $style new PHPExcel_Style;
  329.                                     $this->_readStyle($style$cellStyles[intval($cellStyle['xfId'])]);
  330.                                     PHPExcel_Style::setDefaultStyle($style);
  331.                                 }
  332.                             }
  333.                         }
  334.                     }
  335.  
  336.                     $xmlWorkbook simplexml_load_string($zip->getFromName("{$rel['Target']}"));  //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
  337.  
  338.                     // Set base date
  339.                     if ($xmlWorkbook->workbookPr{
  340.                         if (isset($xmlWorkbook->workbookPr['date1904'])) {
  341.                             $date1904 = (string)$xmlWorkbook->workbookPr['date1904'];
  342.                             if ($date1904 == "true" || $date1904 == "1"{
  343.                                 PHPExcel_Shared_Date::setExcelCalendar(PHPExcel_Shared_Date::CALENDAR_MAC_1904);
  344.                             }
  345.                         }
  346.                     }
  347.                         
  348.                     $sheetId 0;
  349.                     foreach ($xmlWorkbook->sheets->sheet as $eleSheet{
  350.                         // Check if sheet should be skipped
  351.                         if (isset($this->_loadSheetsOnly&& !in_array((string) $eleSheet["name"]$this->_loadSheetsOnly)) {
  352.                             continue;
  353.                         }
  354.  
  355.                         // Load sheet
  356.                         $docSheet $excel->createSheet();
  357.                         $docSheet->setTitle((string) $eleSheet["name"]);
  358.                         $fileWorksheet $worksheets[(string) self::array_item($eleSheet->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships")"id")];
  359.                         $xmlSheet simplexml_load_string($zip->getFromName("$dir/$fileWorksheet"));  //~ http://schemas.openxmlformats.org/spreadsheetml/2006/main");
  360.  
  361.                         $sharedFormulas array();
  362.  
  363.                         if (isset($xmlSheet->sheetViews&& isset($xmlSheet->sheetViews->sheetView)) {
  364.                             if (isset($xmlSheet->sheetViews->sheetView['zoomScale'])) {
  365.                                 $docSheet->getSheetView()->setZoomScaleintval($xmlSheet->sheetViews->sheetView['zoomScale']) );
  366.                             }
  367.                             
  368.                             if (isset($xmlSheet->sheetViews->sheetView['zoomScaleNormal'])) {
  369.                                 $docSheet->getSheetView()->setZoomScaleNormalintval($xmlSheet->sheetViews->sheetView['zoomScaleNormal']) );
  370.                             }
  371.                             
  372.                             if (isset($xmlSheet->sheetViews->sheetView['showGridLines'])) {
  373.                                 $docSheet->setShowGridLines($xmlSheet->sheetViews->sheetView['showGridLines'true false);
  374.                             }
  375.                             
  376.                             if (isset($xmlSheet->sheetViews->sheetView->pane)) {
  377.                                 if (isset($xmlSheet->sheetViews->sheetView->pane['topLeftCell'])) {
  378.                                     $docSheet->freezePane(string)$xmlSheet->sheetViews->sheetView->pane['topLeftCell');
  379.                                 else {
  380.                                     $xSplit 0;
  381.                                     $ySplit 0;
  382.                                     
  383.                                     if (isset($xmlSheet->sheetViews->sheetView->pane['xSplit'])) {
  384.                                         $xSplit intval($xmlSheet->sheetViews->sheetView->pane['xSplit']);
  385.                                     }
  386.                                     
  387.                                     if (isset($xmlSheet->sheetViews->sheetView->pane['ySplit'])) {
  388.                                         $ySplit intval($xmlSheet->sheetViews->sheetView->pane['ySplit']);
  389.                                     }
  390.                                     
  391.                                     $docSheet->freezePaneByColumnAndRow($xSplit$ySplit);
  392.                                 }
  393.                             }
  394.                         }
  395.  
  396.                         if (isset($xmlSheet->sheetPr&& isset($xmlSheet->sheetPr->outlinePr)) {
  397.                             if (isset($xmlSheet->sheetPr->outlinePr['summaryRight']&& $xmlSheet->sheetPr->outlinePr['summaryRight'== false{
  398.                                 $docSheet->setShowSummaryRight(false);
  399.                             else {
  400.                                 $docSheet->setShowSummaryRight(true);
  401.                             }
  402.  
  403.                             if (isset($xmlSheet->sheetPr->outlinePr['summaryBelow']&& $xmlSheet->sheetPr->outlinePr['summaryBelow'== false{
  404.                                 $docSheet->setShowSummaryBelow(false);
  405.                             else {
  406.                                 $docSheet->setShowSummaryBelow(true);
  407.                             }
  408.                         }
  409.  
  410.                         if (isset($xmlSheet->sheetFormatPr)) {
  411.                             if (isset($xmlSheet->sheetFormatPr['customHeight']&& ((string)$xmlSheet->sheetFormatPr['customHeight'== '1' || strtolower((string)$xmlSheet->sheetFormatPr['customHeight']== 'true'&& isset($xmlSheet->sheetFormatPr['defaultRowHeight'])) {
  412.                                 $docSheet->getDefaultRowDimension()->setRowHeight(float)$xmlSheet->sheetFormatPr['defaultRowHeight');
  413.                             }
  414.                             if (isset($xmlSheet->sheetFormatPr['defaultColWidth'])) {
  415.                                 $docSheet->getDefaultColumnDimension()->setWidth(float)$xmlSheet->sheetFormatPr['defaultColWidth');
  416.                             }
  417.                         }
  418.  
  419.                         if (isset($xmlSheet->cols&& !$this->_readDataOnly{
  420.                             foreach ($xmlSheet->cols->col as $col{
  421.                                 for ($i intval($col["min"]1$i intval($col["max"])++$i{
  422.                                     if ($col["bestFit"]{
  423.                                         $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setAutoSize(true);
  424.                                     }
  425.                                     if ($col["hidden"]{
  426.                                         $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setVisible(false);
  427.                                     }
  428.                                     if ($col["collapsed"]{
  429.                                         $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setCollapsed(true);
  430.                                     }
  431.                                     if ($col["outlineLevel"0{
  432.                                         $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setOutlineLevel(intval($col["outlineLevel"]));
  433.                                     }
  434.                                     $docSheet->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($i))->setWidth(floatval($col["width"]));
  435.  
  436.                                     if (intval($col["max"]== 16384{
  437.                                         break;
  438.                                     }
  439.                                 }
  440.                             }
  441.                         }
  442.  
  443.                         if (isset($xmlSheet->printOptions&& !$this->_readDataOnly{
  444.                             if ($xmlSheet->printOptions['gridLinesSet'== 'true' && $xmlSheet->printOptions['gridLinesSet'== '1'{
  445.                                 $docSheet->setShowGridlines(true);
  446.                             }
  447.  
  448.                             if ($xmlSheet->printOptions['gridLines'== 'true' || $xmlSheet->printOptions['gridLines'== '1'{
  449.                                 $docSheet->setPrintGridlines(true);
  450.                             }
  451.  
  452.                             if ($xmlSheet->printOptions['horizontalCentered']{
  453.                                 $docSheet->getPageSetup()->setHorizontalCentered(true);
  454.                             }
  455.                             if ($xmlSheet->printOptions['verticalCentered']{
  456.                                 $docSheet->getPageSetup()->setVerticalCentered(true);
  457.                             }
  458.                         }
  459.  
  460.                         foreach ($xmlSheet->sheetData->row as $row{
  461.                             if ($row["ht"&& !$this->_readDataOnly{
  462.                                 $docSheet->getRowDimension(intval($row["r"]))->setRowHeight(floatval($row["ht"]));
  463.                             }
  464.                             if ($row["hidden"&& !$this->_readDataOnly{
  465.                                 $docSheet->getRowDimension(intval($row["r"]))->setVisible(false);
  466.                             }
  467.                             if ($row["collapsed"]{
  468.                                 $docSheet->getRowDimension(intval($row["r"]))->setCollapsed(true);
  469.                             }
  470.                             if ($row["outlineLevel"0{
  471.                                 $docSheet->getRowDimension(intval($row["r"]))->setOutlineLevel(intval($row["outlineLevel"]));
  472.                             }
  473.  
  474.                             foreach ($row->as $c{
  475.                                 $r = (string) $c["r"];
  476.                                 $cellDataType = (string) $c["t"];
  477.  
  478.                                 // Read cell?
  479.                                 if !is_null($this->getReadFilter()) ) {
  480.                                     $coordinates PHPExcel_Cell::coordinateFromString($r);
  481.  
  482.                                     if !$this->getReadFilter()->readCell($coordinates[0]$coordinates[1]$docSheet->getTitle()) ) {
  483.                                         break;
  484.                                     }
  485.                                 }
  486.  
  487.                                 // Read cell!
  488.                                 switch ($cellDataType{
  489.                                     case "s":
  490.                                         if ((string)$c->!= ''{
  491.                                             $value $sharedStrings[intval($c->v)];
  492.  
  493.                                             if ($value instanceof PHPExcel_RichText{
  494.                                                 $value clone $value;
  495.                                             }
  496.                                         else {
  497.                                             $value '';
  498.                                         }
  499.  
  500.                                         break;
  501.                                     case "b":
  502.                                         $value = (string)$c->v;
  503.                                         if ($value == '0'{
  504.                                             $value false;
  505.                                         else if ($value == '1'{
  506.                                             $value true;
  507.                                         else {
  508.                                             $value = (bool)$c->v;
  509.                                         }
  510.  
  511.                                         break;
  512.                                     case "inlineStr":
  513.                                         $value $this->_parseRichText($c->is);
  514.  
  515.                                         break;
  516.                                     case "e":
  517.                                         if (!isset($c->f)) {
  518.                                             $value = (string)$c->v;
  519.                                         else {
  520.                                             $value "={$c->f}";
  521.                                         }
  522.  
  523.                                         break;
  524.  
  525.                                     default:
  526.                                         if (!isset($c->f)) {
  527.                                             $value = (string) $c->v;
  528.                                         else {
  529.                                             // Formula
  530.                                             $value "={$c->f}";
  531.                                             $cellDataType 'f';
  532.  
  533.                                             // Shared formula?
  534.                                             if (isset($c->f['t']&& strtolower((string)$c->f['t']== 'shared'{
  535.                                                 $instance = (string)$c->f['si'];
  536.  
  537.                                                 if (!isset($sharedFormulas[(string)$c->f['si']])) {
  538.                                                     $sharedFormulas[$instancearray('master' => $r,
  539.                                                                                         'formula' => $value);
  540.                                                 else {
  541.                                                     $master PHPExcel_Cell::coordinateFromString($sharedFormulas[$instance]['master']);
  542.                                                     $current PHPExcel_Cell::coordinateFromString($r);
  543.  
  544.                                                     $difference array(00);
  545.                                                     $difference[0PHPExcel_Cell::columnIndexFromString($current[0]PHPExcel_Cell::columnIndexFromString$master[0]);
  546.                                                     $difference[1$current[1$master[1];
  547.  
  548.                                                     $helper PHPExcel_ReferenceHelper::getInstance();
  549.                                                     $x $helper->updateFormulaReferences(
  550.                                                         $sharedFormulas[$instance]['formula'],
  551.                                                         'A1',
  552.                                                         $difference[0],
  553.                                                         $difference[1]
  554.                                                     );
  555.  
  556.                                                     $value $x;
  557.                                                 }
  558.                                             }
  559.                                         }
  560.  
  561.                                         break;
  562.                                 }
  563.  
  564.                                 // Check for numeric values
  565.                                 if (is_numeric($value&& $cellDataType != 's'{
  566.                                     if ($value == (int)$value$value = (int)$value;
  567.                                     elseif ($value == (float)$value$value = (float)$value;
  568.                                     elseif ($value == (double)$value$value = (double)$value;
  569.                                 }
  570.  
  571.                                 // Rich text?
  572.                                 if ($value instanceof PHPExcel_RichText && $this->_readDataOnly{
  573.                                     $value $value->getPlainText();
  574.                                 }
  575.  
  576.                                 // Assign value
  577.                                 if ($cellDataType != ''{
  578.                                     $docSheet->setCellValueExplicit($r$value$cellDataType);
  579.                                 else {
  580.                                     $docSheet->setCellValue($r$value);
  581.                                 }
  582.  
  583.                                 // Style information?
  584.                                 if ($c["s"&& !$this->_readDataOnly{
  585.                                     if (isset($styles[intval($c["s"])])) {
  586.                                         $this->_readStyle($docSheet->getStyle($r)$styles[intval($c["s"])]);
  587.                                     }
  588.  
  589.                                     if ($cellDataType != 's' && PHPExcel_Shared_Date::isDateTimeFormat($docSheet->getStyle($r)->getNumberFormat())) {
  590.                                         if (preg_match ("/^([0-9.,-]+)$/"$value)) {
  591.                                             $docSheet->setCellValue($rPHPExcel_Shared_Date::ExcelToPHP($value));
  592.                                         }
  593.                                     }
  594.                                 }
  595.  
  596.                                 // Set rich text parent
  597.                                 if ($value instanceof PHPExcel_RichText && !$this->_readDataOnly{
  598.                                     $value->setParent($docSheet->getCell($r));
  599.                                 }
  600.                             }
  601.                         }
  602.  
  603.                         $conditionals array();
  604.                         if (!$this->_readDataOnly{
  605.                             foreach ($xmlSheet->conditionalFormatting as $conditional{
  606.                                 foreach ($conditional->cfRule as $cfRule{
  607.                                     if (
  608.                                         (
  609.                                             (string)$cfRule["type"== PHPExcel_Style_Conditional::CONDITION_NONE ||
  610.                                             (string)$cfRule["type"== PHPExcel_Style_Conditional::CONDITION_CELLIS ||
  611.                                             (string)$cfRule["type"== PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT
  612.                                         && isset($dxfs[intval($cfRule["dxfId"])])
  613.                                     {
  614.                                         $conditionals[(string) $conditional["sqref"]][intval($cfRule["priority"])$cfRule;
  615.                                     }
  616.                                 }
  617.                             }
  618.  
  619.                             foreach ($conditionals as $ref => $cfRules{
  620.                                 ksort($cfRules);
  621.                                 $conditionalStyles array();
  622.                                 foreach ($cfRules as $cfRule{
  623.                                     $objConditional new PHPExcel_Style_Conditional();
  624.                                     $objConditional->setConditionType((string)$cfRule["type"]);
  625.                                     $objConditional->setOperatorType((string)$cfRule["operator"]);
  626.                                     
  627.                                     if ((string)$cfRule["text"!= ''{
  628.                                         $objConditional->setText((string)$cfRule["text"]);
  629.                                     }
  630.  
  631.                                     if (count($cfRule->formula1{
  632.                                         foreach ($cfRule->formula as $formula{
  633.                                             $objConditional->addCondition((string)$formula);
  634.                                         }
  635.                                     else {
  636.                                         $objConditional->addCondition((string)$cfRule->formula);
  637.                                     }
  638.                                     $objConditional->setStyle(clone $dxfs[intval($cfRule["dxfId"])]);
  639.                                     $conditionalStyles[$objConditional;
  640.                                 }
  641.  
  642.                                 // Extract all cell references in $ref
  643.                                 $aReferences PHPExcel_Cell::extractAllCellReferencesInRange($ref);
  644.                                 foreach ($aReferences as $reference{
  645.                                     $docSheet->getStyle($reference)->setConditionalStyles($conditionalStyles);
  646.                                 }
  647.                             }
  648.                         }
  649.  
  650.                         $aKeys array("sheet""objects""scenarios""formatCells""formatColumns""formatRows""insertColumns""insertRows""insertHyperlinks""deleteColumns""deleteRows""selectLockedCells""sort""autoFilter""pivotTables""selectUnlockedCells");
  651.                         if (!$this->_readDataOnly{
  652.                             foreach ($aKeys as $key{
  653.                                 $method "set" ucfirst($key);
  654.                                 $docSheet->getProtection()->$method($xmlSheet->sheetProtection[$key== "true");
  655.                             }
  656.                         }
  657.  
  658.                         if (!$this->_readDataOnly{
  659.                             $docSheet->getProtection()->setPassword((string) $xmlSheet->sheetProtection["password"]true);
  660.                             if ($xmlSheet->protectedRanges->protectedRange{
  661.                                 foreach ($xmlSheet->protectedRanges->protectedRange as $protectedRange{
  662.                                     $docSheet->protectCells((string) $protectedRange["sqref"](string) $protectedRange["password"]true);
  663.                                 }
  664.                             }
  665.                         }
  666.  
  667.                         if ($xmlSheet->autoFilter && !$this->_readDataOnly{
  668.                             $docSheet->setAutoFilter((string) $xmlSheet->autoFilter["ref"]);
  669.                         }
  670.  
  671.                         if ($xmlSheet->mergeCells->mergeCell && !$this->_readDataOnly{
  672.                             foreach ($xmlSheet->mergeCells->mergeCell as $mergeCell{
  673.                                 $docSheet->mergeCells((string) $mergeCell["ref"]);
  674.                             }
  675.                         }
  676.  
  677.                         if (!$this->_readDataOnly{
  678.                             $docPageMargins $docSheet->getPageMargins();
  679.                             $docPageMargins->setLeft(floatval($xmlSheet->pageMargins["left"]));
  680.                             $docPageMargins->setRight(floatval($xmlSheet->pageMargins["right"]));
  681.                             $docPageMargins->setTop(floatval($xmlSheet->pageMargins["top"]));
  682.                             $docPageMargins->setBottom(floatval($xmlSheet->pageMargins["bottom"]));
  683.                             $docPageMargins->setHeader(floatval($xmlSheet->pageMargins["header"]));
  684.                             $docPageMargins->setFooter(floatval($xmlSheet->pageMargins["footer"]));
  685.                         }
  686.  
  687.                         if (!$this->_readDataOnly{
  688.                             $docPageSetup $docSheet->getPageSetup();
  689.  
  690.                             if (isset($xmlSheet->pageSetup["orientation"])) {
  691.                                 $docPageSetup->setOrientation((string) $xmlSheet->pageSetup["orientation"]);
  692.                             }
  693.                             if (isset($xmlSheet->pageSetup["paperSize"])) {
  694.                                 $docPageSetup->setPaperSize(intval($xmlSheet->pageSetup["paperSize"]));
  695.                             }
  696.                             if (isset($xmlSheet->pageSetup["scale"])) {
  697.                                 $docPageSetup->setScale(intval($xmlSheet->pageSetup["scale"]));
  698.                             }
  699.                             if (isset($xmlSheet->pageSetup["fitToHeight"]&& intval($xmlSheet->pageSetup["fitToHeight"]0{
  700.                                 $docPageSetup->setFitToHeight(intval($xmlSheet->pageSetup["fitToHeight"]));
  701.                             }
  702.                             if (isset($xmlSheet->pageSetup["fitToWidth"]&& intval($xmlSheet->pageSetup["fitToWidth"]0{
  703.                                 $docPageSetup->setFitToWidth(intval($xmlSheet->pageSetup["fitToWidth"]));
  704.                             }
  705.                         }
  706.  
  707.                         if (!$this->_readDataOnly{
  708.                             $docHeaderFooter $docSheet->getHeaderFooter();
  709.                             $docHeaderFooter->setDifferentOddEven($xmlSheet->headerFooter["differentOddEven"== 'true');
  710.                             $docHeaderFooter->setDifferentFirst($xmlSheet->headerFooter["differentFirst"== 'true');
  711.                             $docHeaderFooter->setScaleWithDocument($xmlSheet->headerFooter["scaleWithDoc"== 'true');
  712.                             $docHeaderFooter->setAlignWithMargins($xmlSheet->headerFooter["alignWithMargins"== 'true');
  713.                             $docHeaderFooter->setOddHeader((string) $xmlSheet->headerFooter->oddHeader);
  714.                             $docHeaderFooter->setOddFooter((string) $xmlSheet->headerFooter->oddFooter);
  715.                             $docHeaderFooter->setEvenHeader((string) $xmlSheet->headerFooter->evenHeader);
  716.                             $docHeaderFooter->setEvenFooter((string) $xmlSheet->headerFooter->evenFooter);
  717.                             $docHeaderFooter->setFirstHeader((string) $xmlSheet->headerFooter->firstHeader);
  718.                             $docHeaderFooter->setFirstFooter((string) $xmlSheet->headerFooter->firstFooter);
  719.                         }
  720.  
  721.                         if ($xmlSheet->rowBreaks->brk && !$this->_readDataOnly{
  722.                             foreach ($xmlSheet->rowBreaks->brk as $brk{
  723.                                 if ($brk["man"]{
  724.                                     $docSheet->setBreak("A$brk[id]"PHPExcel_Worksheet::BREAK_ROW);
  725.                                 }
  726.                             }
  727.                         }
  728.                         if ($xmlSheet->colBreaks->brk && !$this->_readDataOnly{
  729.                             foreach ($xmlSheet->colBreaks->brk as $brk{
  730.                                 if ($brk["man"]{
  731.                                     $docSheet->setBreak(PHPExcel_Cell::stringFromColumnIndex($brk["id"]"1"PHPExcel_Worksheet::BREAK_COLUMN);
  732.                                 }
  733.                             }
  734.                         }
  735.  
  736.                         if ($xmlSheet->dataValidations && !$this->_readDataOnly{
  737.                             foreach ($xmlSheet->dataValidations->dataValidation as $dataValidation{
  738.                                 // Uppercase coordinate
  739.                                 $range strtoupper($dataValidation["sqref"]);
  740.  
  741.                                 // Extract all cell references in $range
  742.                                 $aReferences PHPExcel_Cell::extractAllCellReferencesInRange($range);
  743.                                 foreach ($aReferences as $reference{
  744.                                     // Create validation
  745.                                     $docValidation $docSheet->getCell($reference)->getDataValidation();
  746.                                     $docValidation->setType((string) $dataValidation["type"]);
  747.                                     $docValidation->setErrorStyle((string) $dataValidation["errorStyle"]);
  748.                                     $docValidation->setOperator((string) $dataValidation["operator"]);
  749.                                     $docValidation->setAllowBlank($dataValidation["allowBlank"!= 0);
  750.                                     $docValidation->setShowDropDown($dataValidation["showDropDown"== 0);
  751.                                     $docValidation->setShowInputMessage($dataValidation["showInputMessage"!= 0);
  752.                                     $docValidation->setShowErrorMessage($dataValidation["showErrorMessage"!= 0);
  753.                                     $docValidation->setErrorTitle((string) $dataValidation["errorTitle"]);
  754.                                     $docValidation->setError((string) $dataValidation["error"]);
  755.                                     $docValidation->setPromptTitle((string) $dataValidation["promptTitle"]);
  756.                                     $docValidation->setPrompt((string) $dataValidation["prompt"]);
  757.                                     $docValidation->setFormula1((string) $dataValidation->formula1);
  758.                                     $docValidation->setFormula2((string) $dataValidation->formula2);
  759.                                 }
  760.                             }
  761.                         }
  762.  
  763.                         // Add hyperlinks
  764.                         $hyperlinks array();
  765.                         if (!$this->_readDataOnly{
  766.                             // Locate hyperlink relations
  767.                             if ($zip->locateName(dirname("$dir/$fileWorksheet""/_rels/" basename($fileWorksheet".rels")) {
  768.                                 $relsWorksheet simplexml_load_string($zip->getFromNamedirname("$dir/$fileWorksheet""/_rels/" basename($fileWorksheet".rels") )//~ http://schemas.openxmlformats.org/package/2006/relationships");
  769.                                 foreach ($relsWorksheet->Relationship as $ele{
  770.                                     if ($ele["Type"== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"{
  771.                                         $hyperlinks[(string)$ele["Id"]] = (string)$ele["Target"];
  772.                                     }
  773.                                 }
  774.                             }
  775.  
  776.                             // Loop trough hyperlinks
  777.                             if ($xmlSheet->hyperlinks{
  778.                                 foreach ($xmlSheet->hyperlinks->hyperlink as $hyperlink{
  779.                                     // Link url
  780.                                     $linkRel $hyperlink->attributes('http://schemas.openxmlformats.org/officeDocument/2006/relationships');
  781.  
  782.                                     if (isset($linkRel['id'])) {
  783.                                         $docSheet->getCell$hyperlink['ref')->getHyperlink()->setUrl$hyperlinks(string)$linkRel['id'] ] );
  784.                                     }
  785.                                     if (isset($hyperlink['location'])) {
  786.                                         $docSheet->getCell$hyperlink['ref')->getHyperlink()->setUrl'sheet://' . (string)$hyperlink['location');
  787.                                     }
  788.  
  789.                                     // Tooltip
  790.                                     if (isset($hyperlink['tooltip'])) {
  791.                                         $docSheet->getCell$hyperlink['ref')->getHyperlink()->setTooltip(string)$hyperlink['tooltip');
  792.                                     }
  793.                                 }
  794.                             }
  795.                         }
  796.  
  797.                         // Add comments
  798.                         $comments array();
  799.                         $vmlComments array();
  800.                         if (!$this->_readDataOnly{
  801.                             // Locate comment relations
  802.                             if ($zip->locateName(dirname("$dir/$fileWorksheet""/_rels/" basename($fileWorksheet".rels")) {
  803.                                 $relsWorksheet simplexml_load_string($zip->getFromNamedirname("$dir/$fileWorksheet""/_rels/" basename($fileWorksheet".rels") )//~ http://schemas.openxmlformats.org/package/2006/relationships");
  804.                                 foreach ($relsWorksheet->Relationship as $ele{
  805.                                     if ($ele["Type"== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"{
  806.                                         $comments[(string)$ele["Id"]] = (string)$ele["Target"];
  807.                                     }
  808.                                     if ($ele["Type"== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"{
  809.                                         $vmlComments[(string)$ele["Id"]] = (string)$ele["Target"];
  810.                                     }
  811.                                 }
  812.                             }
  813.  
  814.                             // Loop trough comments
  815.                         foreach ($comments as $relName => $relPath{
  816.                                 // Load comments file
  817.                                 $relPath PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet""/" $relPath);
  818.                                 $commentsFile simplexml_load_string($zip->getFromName($relPath) );
  819.  
  820.                                 // Utility variables
  821.                                 $authors array();
  822.  
  823.                                 // Loop trough authors
  824.                                 foreach ($commentsFile->authors->author as $author{
  825.                                     $authors[= (string)$author;
  826.                                 }
  827.  
  828.                                 // Loop trough contents
  829.                                 foreach ($commentsFile->commentList->comment as $comment{
  830.                                     $docSheet->getComment(string)$comment['ref')->setAuthor$authors[(string)$comment['authorId']] );
  831.                                     $docSheet->getComment(string)$comment['ref')->setText$this->_parseRichText($comment->text) );
  832.                                 }
  833.                             }
  834.                             
  835.                             // Loop trough VML comments
  836.                             foreach ($vmlComments as $relName => $relPath{
  837.                                 // Load VML comments file
  838.                                 $relPath PHPExcel_Shared_File::realpath(dirname("$dir/$fileWorksheet""/" $relPath);
  839.                                 $vmlCommentsFile simplexml_load_string$zip->getFromName($relPath) );
  840.                                 $vmlCommentsFile->registerXPathNamespace('v''urn:schemas-microsoft-com:vml');
  841.                                 
  842.                                 $shapes $vmlCommentsFile->xpath('//v:shape');
  843.                                 foreach ($shapes as $shape{
  844.                                     $shape->registerXPathNamespace('v''urn:schemas-microsoft-com:vml');
  845.                                     
  846.                                     if (isset($shape['style'])) {
  847.                                         $style        = (string)$shape['style'];
  848.                                         $fillColor    strtouppersubstr(string)$shape['fillcolor']) );
  849.                                         $column       null;
  850.                                         $row          null;
  851.                                         
  852.                                         $clientData   $shape->xpath('.//x:ClientData');
  853.                                         if (is_array($clientData)) {
  854.                                             $clientData   $clientData[0];
  855.                                             
  856.                                             if isset($clientData['ObjectType']&& (string)$clientData['ObjectType'== 'Note' {
  857.                                                 $temp $clientData->xpath('.//x:Row');
  858.                                                 if (is_array($temp)) $row $temp[0];
  859.                                                 
  860.                                                 $temp $clientData->xpath('.//x:Column');
  861.                                                 if (is_array($temp)) $column $temp[0];
  862.                                             }
  863.                                         }
  864.                                         
  865.                                         if (!is_null($column&& !is_null($row)) {
  866.                                             // Set comment properties
  867.                                             $comment $docSheet->getCommentByColumnAndRow($column$row 1);
  868.                                             $comment->getFillColor()->setRGB$fillColor );
  869.  
  870.                                             // Parse style
  871.                                             $styleArray explode(';'str_replace(' '''$style));
  872.                                             foreach ($styleArray as $stylePair{
  873.                                                 $stylePair explode(':'$stylePair);
  874.                                                 
  875.                                                 if ($stylePair[0== 'margin-left')     $comment->setMarginLeft($stylePair[1]);
  876.                                                 if ($stylePair[0== 'margin-top')      $comment->setMarginTop($stylePair[1]);
  877.                                                 if ($stylePair[0== 'width')           $comment->setWidth($stylePair[1]);
  878.                                                 if ($stylePair[0== 'height')          $comment->setHeight($stylePair[1]);
  879.                                                 if ($stylePair[0== 'visibility')      $comment->setVisible$stylePair[1== 'visible' );
  880.                                                 
  881.                                             }
  882.                                         }
  883.                                     }
  884.                                 }
  885.                             }
  886.  
  887.                             // Header/footer images
  888.                             if ($xmlSheet->legacyDrawingHF && !$this->_readDataOnly{
  889.                                 if ($zip->locateName(dirname("$dir/$fileWorksheet""/_rels/" basename($fileWorksheet".rels")) {
  890.                                     $relsWorksheet simplexml_load_string($zip->getFromNamedirname("$dir/$fileWorksheet""/_rels/" basename($fileWorksheet".rels") )//~ http://schemas.openxmlformats.org/package/2006/relationships");
  891.                                     $vmlRelationship '';
  892.  
  893.                                     foreach ($relsWorksheet->Relationship as $ele{
  894.                                         if ($ele["Type"== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"{
  895.                                             $vmlRelationship self::dir_add("$dir/$fileWorksheet"$ele["Target"]);
  896.                                         }
  897.                                     }
  898.  
  899.                                     if ($vmlRelationship != ''{
  900.                                         // Fetch linked images
  901.                                         $relsVML simplexml_load_string($zip->getFromNamedirname($vmlRelationship'/_rels/' basename($vmlRelationship'.rels' ))//~ http://schemas.openxmlformats.org/package/2006/relationships");
  902.                                         $drawings array();
  903.                                         foreach ($relsVML->Relationship as $ele{
  904.                                             if ($ele["Type"== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"{
  905.                                                 $drawings[(string) $ele["Id"]] self::dir_add($vmlRelationship$ele["Target"]);
  906.                                             }
  907.                                         }
  908.  
  909.                                         // Fetch VML document
  910.                                         $vmlDrawing simplexml_load_string($zip->getFromName($vmlRelationship));
  911.                                         $vmlDrawing->registerXPathNamespace('v''urn:schemas-microsoft-com:vml');
  912.  
  913.                                         $hfImages array();
  914.  
  915.                                         $shapes $vmlDrawing->xpath('//v:shape');
  916.                                         foreach ($shapes as $shape{
  917.                                             $shape->registerXPathNamespace('v''urn:schemas-microsoft-com:vml');
  918.                                             $imageData $shape->xpath('//v:imagedata');
  919.                                             $imageData $imageData[0];
  920.  
  921.                                             $imageData $imageData->attributes('urn:schemas-microsoft-com:office:office');
  922.                                             $style self::toCSSArray(string)$shape['style');
  923.  
  924.                                             $hfImages(string)$shape['id'] ] new PHPExcel_Worksheet_HeaderFooterDrawing();
  925.                                             if (isset($imageData['title'])) {
  926.                                                 $hfImages(string)$shape['id'] ]->setName(string)$imageData['title');
  927.                                             }
  928.  
  929.                                             $hfImages(string)$shape['id'] ]->setPath("zip://$pFilename#$drawings[(string)$imageData['relid']]false);
  930.                                             $hfImages(string)$shape['id'] ]->setResizeProportional(false);
  931.                                             $hfImages(string)$shape['id'] ]->setWidth($style['width']);
  932.                                             $hfImages(string)$shape['id'] ]->setHeight($style['height']);
  933.                                             $hfImages(string)$shape['id'] ]->setOffsetX($style['margin-left']);
  934.                                             $hfImages(string)$shape['id'] ]->setOffsetY($style['margin-top']);
  935.                                             $hfImages(string)$shape['id'] ]->setResizeProportional(true);
  936.                                         }
  937.  
  938.                                         $docSheet->getHeaderFooter()->setImages($hfImages);
  939.                                     }
  940.                                 }
  941.                             }
  942.  
  943.                         }
  944.  
  945. // TODO: Make sure drawings and graph are loaded differently!
  946.                         if ($zip->locateName(dirname("$dir/$fileWorksheet""/_rels/" basename($fileWorksheet".rels")) {
  947.                             $relsWorksheet simplexml_load_string($zip->getFromNamedirname("$dir/$fileWorksheet""/_rels/" basename($fileWorksheet".rels") )//~ http://schemas.openxmlformats.org/package/2006/relationships");
  948.                             $drawings array();
  949.                             foreach ($relsWorksheet->Relationship as $ele{
  950.                                 if ($ele["Type"== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing"{
  951.                                     $drawings[(string) $ele["Id"]] self::dir_add("$dir/$fileWorksheet"$ele["Target"]);
  952.                                 }
  953.                             }
  954.                             if ($xmlSheet->drawing && !$this->_readDataOnly{
  955.                                 foreach ($xmlSheet->drawing as $drawing{
  956.                                     $fileDrawing $drawings[(string) self::array_item($drawing->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships")"id")];
  957.                                     $relsDrawing simplexml_load_string($zip->getFromNamedirname($fileDrawing"/_rels/" basename($fileDrawing".rels") )//~ http://schemas.openxmlformats.org/package/2006/relationships");
  958.                                     $images array();
  959.  
  960.                                     if ($relsDrawing && $relsDrawing->Relationship{
  961.                                         foreach ($relsDrawing->Relationship as $ele{
  962.                                             if ($ele["Type"== "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"{
  963.                                                 $images[(string) $ele["Id"]] self::dir_add($fileDrawing$ele["Target"]);
  964.                                             }
  965.                                         }
  966.                                     }
  967.                                     $xmlDrawing simplexml_load_string($zip->getFromName($fileDrawing))->children("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
  968.  
  969.                                     if ($xmlDrawing->oneCellAnchor{
  970.                                         foreach ($xmlDrawing->oneCellAnchor as $oneCellAnchor{
  971.                                             if ($oneCellAnchor->pic->blipFill{
  972.                                                 $blip $oneCellAnchor->pic->blipFill->children("http://schemas.openxmlformats.org/drawingml/2006/main")->blip;
  973.                                                 $xfrm $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm;
  974.                                                 $outerShdw $oneCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw;
  975.                                                 $objDrawing new PHPExcel_Worksheet_Drawing;
  976.                                                 $objDrawing->setName((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes()"name"));
  977.                                                 $objDrawing->setDescription((string) self::array_item($oneCellAnchor->pic->nvPicPr->cNvPr->attributes()"descr"));
  978.                                                 $objDrawing->setPath("zip://$pFilename#$images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships")"embed")]false);
  979.                                                 $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex($oneCellAnchor->from->col($oneCellAnchor->from->row 1));
  980.                                                 $objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->colOff));
  981.                                                 $objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($oneCellAnchor->from->rowOff));
  982.                                                 $objDrawing->setResizeProportional(false);
  983.                                                 $objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes()"cx")));
  984.                                                 $objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($oneCellAnchor->ext->attributes()"cy")));
  985.                                                 if ($xfrm{
  986.                                                     $objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes()"rot")));
  987.                                                 }
  988.                                                 if ($outerShdw{
  989.                                                     $shadow $objDrawing->getShadow();
  990.                                                     $shadow->setVisible(true);
  991.                                                     $shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes()"blurRad")));
  992.                                                     $shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes()"dist")));
  993.                                                     $shadow->setDirection(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($outerShdw->attributes()"dir")));
  994.                                                     $shadow->setAlignment((string) self::array_item($outerShdw->attributes()"algn"));
  995.                                                     $shadow->getColor()->setRGB(self::array_item($outerShdw->srgbClr->attributes()"val"));
  996.                                                     $shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes()"val"1000);
  997.                                                 }
  998.                                                 $objDrawing->setWorksheet($docSheet);
  999.                                             }
  1000.                                         }
  1001.                                     }
  1002.                                     if ($xmlDrawing->twoCellAnchor{
  1003.                                         foreach ($xmlDrawing->twoCellAnchor as $twoCellAnchor{
  1004.                                             if ($twoCellAnchor->pic->blipFill{
  1005.                                                 $blip $twoCellAnchor->pic->blipFill->children("http://schemas.openxmlformats.org/drawingml/2006/main")->blip;
  1006.                                                 $xfrm $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->xfrm;
  1007.                                                 $outerShdw $twoCellAnchor->pic->spPr->children("http://schemas.openxmlformats.org/drawingml/2006/main")->effectLst->outerShdw;
  1008.                                                 $objDrawing new PHPExcel_Worksheet_Drawing;
  1009.                                                 $objDrawing->setName((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes()"name"));
  1010.                                                 $objDrawing->setDescription((string) self::array_item($twoCellAnchor->pic->nvPicPr->cNvPr->attributes()"descr"));
  1011.                                                 $objDrawing->setPath("zip://$pFilename#$images[(string) self::array_item($blip->attributes("http://schemas.openxmlformats.org/officeDocument/2006/relationships")"embed")]false);
  1012.                                                 $objDrawing->setCoordinates(PHPExcel_Cell::stringFromColumnIndex($twoCellAnchor->from->col($twoCellAnchor->from->row 1));
  1013.                                                 $objDrawing->setOffsetX(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->colOff));
  1014.                                                 $objDrawing->setOffsetY(PHPExcel_Shared_Drawing::EMUToPixels($twoCellAnchor->from->rowOff));
  1015.                                                 $objDrawing->setResizeProportional(false);
  1016.  
  1017.                                                 $objDrawing->setWidth(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($xfrm->ext->attributes()"cx")));
  1018.                                                 $objDrawing->setHeight(PHPExcel_Shared_Drawing::EMUToPixels(self::array_item($xfrm->ext->attributes()"cy")));
  1019.  
  1020.                                                 if ($xfrm{
  1021.                                                     $objDrawing->setRotation(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($xfrm->attributes()"rot")));
  1022.                                                 }
  1023.                                                 if ($outerShdw{
  1024.                                                     $shadow $objDrawing->getShadow();
  1025.                                                     $shadow->setVisible(true);
  1026.                                                     $shadow->setBlurRadius(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes()"blurRad")));
  1027.                                                     $shadow->setDistance(PHPExcel_Shared_Drawing::EMUTopixels(self::array_item($outerShdw->attributes()"dist")));
  1028.                                                     $shadow->setDirection(PHPExcel_Shared_Drawing::angleToDegrees(self::array_item($outerShdw->attributes()"dir")));
  1029.                                                     $shadow->setAlignment((string) self::array_item($outerShdw->attributes()"algn"));
  1030.                                                     $shadow->getColor()->setRGB(self::array_item($outerShdw->srgbClr->attributes()"val"));
  1031.                                                     $shadow->setAlpha(self::array_item($outerShdw->srgbClr->alpha->attributes()"val"1000);
  1032.                                                 }
  1033.                                                 $objDrawing->setWorksheet($docSheet);
  1034.                                             }
  1035.                                         }
  1036.                                     }
  1037.  
  1038.                                 }
  1039.                             }
  1040.                         }
  1041.  
  1042.                         // Loop trough definedNames
  1043.                         if ($xmlWorkbook->definedNames{
  1044.                             foreach ($xmlWorkbook->definedNames->definedName as $definedName{
  1045.                                 // Extract range
  1046.                                 $extractedRange = (string)$definedName;
  1047.                                 if (strpos($extractedRange'!'!== false{
  1048.                                     $extractedRange substr($extractedRangestrpos($extractedRange'!'1);
  1049.                                 }
  1050.                                 $extractedRange str_replace('$'''$extractedRange);
  1051.  
  1052.                                 // Valid range?
  1053.                                 if (stripos((string)$definedName'#REF!'!== false || $extractedRange == ''{
  1054.                                     continue;
  1055.                                 }
  1056.  
  1057.                                 // Some definedNames are only applicable if we are on the same sheet...
  1058.                                 if ($definedName['localSheetId'== $sheetId{
  1059.                                     // Switch on type
  1060.                                     switch ((string)$definedName['name']{
  1061.  
  1062.                                         case '_xlnm._FilterDatabase':
  1063.                                             $docSheet->setAutoFilter($extractedRange);
  1064.                                             break;
  1065.  
  1066.                                         case '_xlnm.Print_Titles':
  1067.                                             // Split $extractedRange
  1068.                                             $extractedRange explode(','$extractedRange);
  1069.  
  1070.                                             // Set print titles
  1071.                                             if (isset($extractedRange[0])) {
  1072.                                                 $range explode(':'$extractedRange[0]);
  1073.  
  1074.                                                 if (PHPExcel_Worksheet::extractSheetTitle($range[0]!= '')
  1075.                                                     $range[0PHPExcel_Worksheet::extractSheetTitle($range[0]);
  1076.                                                 $range[0str_replace('$'''$range[0]);
  1077.                                                 if (PHPExcel_Worksheet::extractSheetTitle($range[1]!= '')
  1078.                                                     $range[1PHPExcel_Worksheet::extractSheetTitle($range[1]);
  1079.                                                 $range[1str_replace('$'''$range[1]);
  1080.  
  1081.                                                 $docSheet->getPageSetup()->setColumnsToRepeatAtLeft$range );
  1082.                                             }
  1083.                                             if (isset($extractedRange[1])) {
  1084.                                                 $range explode(':'$extractedRange[1]);
  1085.  
  1086.                                                 if (PHPExcel_Worksheet::extractSheetTitle($range[0]!= '')
  1087.                                                     $range[0PHPExcel_Worksheet::extractSheetTitle($range[0]);
  1088.                                                 $range[0str_replace('$'''$range[0]);
  1089.                                                 if (PHPExcel_Worksheet::extractSheetTitle($range[1]!= '')
  1090.                                                     $range[1PHPExcel_Worksheet::extractSheetTitle($range[1]);
  1091.                                                 $range[1str_replace('$'''$range[1]);
  1092.  
  1093.                                                 $docSheet->getPageSetup()->setRowsToRepeatAtTop$range );
  1094.                                             }
  1095.  
  1096.                                             break;
  1097.  
  1098.                                         case '_xlnm.Print_Area':
  1099.                                             $docSheet->getPageSetup()->setPrintArea($extractedRange);
  1100.                                             break;
  1101.  
  1102.                                         default:
  1103.                                             $excel->addNamedRangenew PHPExcel_NamedRange((string)$definedName['name']$docSheet$extractedRangetrue) );
  1104.                                             break;
  1105.                                     }
  1106.                                 else {
  1107.                                     // "Global" definedNames
  1108.                                     $locatedSheet null;
  1109.                                     $extractedSheetName '';
  1110.                                     if (strpos(string)$definedName'!' !== false{
  1111.                                         // Extract sheet name
  1112.                                         $extractedSheetName PHPExcel_Worksheet::extractSheetTitle(string)$definedName );
  1113.  
  1114.                                         // Locate sheet
  1115.                                         $locatedSheet $excel->getSheetByName($extractedSheetName);
  1116.                                     }
  1117.  
  1118.                                     if (!is_null($locatedSheet)) {
  1119.                                         $excel->addNamedRangenew PHPExcel_NamedRange((string)$definedName['name']$locatedSheet$extractedRangefalse) );
  1120.                                     }
  1121.                                 }
  1122.                             }
  1123.                         }
  1124.  
  1125.                         // Garbage collect...
  1126.                         $docSheet->garbageCollect();
  1127.  
  1128.                         // Next sheet id
  1129.                         ++$sheetId;
  1130.                     }
  1131.  
  1132.                     if (!$this->_readDataOnly{
  1133.                         $excel->setActiveSheetIndex(intval($xmlWorkbook->bookView->workbookView["activeTab"]));
  1134.                     }
  1135.                 break;
  1136.             }
  1137.  
  1138.         }
  1139.  
  1140.         return $excel;
  1141.     }
  1142.  
  1143.     private function _readColor($color{
  1144.         if (isset($color["rgb"])) {
  1145.             return $color["rgb"];
  1146.         else if (isset($color["indexed"])) {
  1147.             return PHPExcel_Style_Color::indexedColor($color["indexed"])->getARGB();
  1148.         }
  1149.     }
  1150.  
  1151.     private function _readStyle($docStyle$style{
  1152.         // format code
  1153.         if ($style->applyNumberFormat$docStyle->getNumberFormat()->setFormatCode($style->numFmt);
  1154.  
  1155.         // font
  1156.         if (isset($style->font&& ($style->applyFont || $style instanceof SimpleXMLElement)) {
  1157.             $docStyle->getFont()->setName((string) $style->font->name["val"]);
  1158.             $docStyle->getFont()->setSize((string) $style->font->sz["val"]);
  1159.             if (isset($style->font->b)) {
  1160.                 $docStyle->getFont()->setBold(!isset($style->font->b["val"]|| $style->font->b["val"== 'true');
  1161.             }
  1162.             if (isset($style->font->i)) {
  1163.                 $docStyle->getFont()->setItalic(!isset($style->font->i["val"]|| $style->font->i["val"== 'true');
  1164.             }
  1165.             if (isset($style->font->strike)) {
  1166.                 $docStyle->getFont()->setStriketrough(!isset($style->font->strike["val"]|| $style->font->strike["val"== 'true');
  1167.             }
  1168.             $docStyle->getFont()->getColor()->setARGB($this->_readColor($style->font->color));
  1169.  
  1170.             if (isset($style->font->u&& !isset($style->font->u["val"])) {
  1171.                 $docStyle->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
  1172.             else if (isset($style->font->u&& isset($style->font->u["val"])) {
  1173.                 $docStyle->getFont()->setUnderline((string)$style->font->u["val"]);
  1174.             }
  1175.  
  1176.             if (isset($style->font->vertAlign&& isset($style->font->vertAlign["val"])) {
  1177.                 $vertAlign strtolower((string)$style->font->vertAlign["val"]);
  1178.                 if ($vertAlign == 'superscript'{
  1179.                     $docStyle->getFont()->setSuperScript(true);
  1180.                 }
  1181.                 if ($vertAlign == 'subscript'{
  1182.                     $docStyle->getFont()->setSubScript(true);
  1183.                 }
  1184.             }
  1185.         }
  1186.  
  1187.         // fill
  1188.         if (isset($style->fill&& ($style->applyFill || $style instanceof SimpleXMLElement)) {
  1189.             if ($style->fill->gradientFill{
  1190.                 $gradientFill $style->fill->gradientFill[0];
  1191.                 $docStyle->getFill()->setFillType((string) $gradientFill["type"]);
  1192.                 $docStyle->getFill()->setRotation(floatval($gradientFill["degree"]));
  1193.                 $gradientFill->registerXPathNamespace("sml""http://schemas.openxmlformats.org/spreadsheetml/2006/main");
  1194.                 $docStyle->getFill()->getStartColor()->setARGB($this->_readColorself::array_item($gradientFill->xpath("sml:stop[@position=0]"))->color) );
  1195.                 $docStyle->getFill()->getEndColor()->setARGB($this->_readColorself::array_item($gradientFill->xpath("sml:stop[@position=1]"))->color) );
  1196.             elseif ($style->fill->patternFill{
  1197.                 $patternType = (string)$style->fill->patternFill["patternType"!= '' ? (string)$style->fill->patternFill["patternType"'solid';
  1198.                 $docStyle->getFill()->setFillType($patternType);
  1199.                 if ($style->fill->patternFill->fgColor{
  1200.                     $docStyle->getFill()->getStartColor()->setARGB($this->_readColor($style->fill->patternFill->fgColor));
  1201.                 }
  1202.                 if ($style->fill->patternFill->bgColor{
  1203.                     $docStyle->getFill()->getEndColor()->setARGB($this->_readColor($style->fill->patternFill->bgColor));
  1204.                 }
  1205.             }
  1206.         }
  1207.  
  1208.         // border
  1209.         if (isset($style->border&& ($style->applyBorder || $style instanceof SimpleXMLElement)) {
  1210.             if ($style->border["diagonalUp"== 'true'{
  1211.                 $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_UP);
  1212.             elseif ($style->border["diagonalDown"== 'true'{
  1213.                 $docStyle->getBorders()->setDiagonalDirection(PHPExcel_Style_Borders::DIAGONAL_DOWN);
  1214.             }
  1215.             $docStyle->getBorders()->setOutline($style->border["outline"== 'true');
  1216.             $this->_readBorder($docStyle->getBorders()->getLeft()$style->border->left);
  1217.             $this->_readBorder($docStyle->getBorders()->getRight()$style->border->right);
  1218.             $this->_readBorder($docStyle->getBorders()->getTop()$style->border->top);
  1219.             $this->_readBorder($docStyle->getBorders()->getBottom()$style->border->bottom);
  1220.             $this->_readBorder($docStyle->getBorders()->getDiagonal()$style->border->diagonal);
  1221.             $this->_readBorder($docStyle->getBorders()->getVertical()$style->border->vertical);
  1222.             $this->_readBorder($docStyle->getBorders()->getHorizontal()$style->border->horizontal);
  1223.         }
  1224.  
  1225.         // alignment
  1226.         if (isset($style->alignment&& ($style->applyAlignment || $style instanceof SimpleXMLElement)) {
  1227.             $docStyle->getAlignment()->setHorizontal((string) $style->alignment["horizontal"]);
  1228.             $docStyle->getAlignment()->setVertical((string) $style->alignment["vertical"]);
  1229.  
  1230.             $textRotation 0;
  1231.             if ((int)$style->alignment["textRotation"<= 90{
  1232.                 $textRotation = (int)$style->alignment["textRotation"];
  1233.             else if ((int)$style->alignment["textRotation"90{
  1234.                 $textRotation 90 - (int)$style->alignment["textRotation"];
  1235.             }
  1236.  
  1237.             $docStyle->getAlignment()->setTextRotation(intval($textRotation));
  1238.             $docStyle->getAlignment()->setWrapText(string)$style->alignment["wrapText"== "true" || (string)$style->alignment["wrapText"== "1" );
  1239.             $docStyle->getAlignment()->setShrinkToFit(string)$style->alignment["shrinkToFit"== "true" || (string)$style->alignment["shrinkToFit"== "1" );
  1240.             $docStyle->getAlignment()->setIndentintval((string)$style->alignment["indent"]intval((string)$style->alignment["indent"]);
  1241.         }
  1242.  
  1243.         // protection
  1244.         if (isset($style->protection&& $style->applyProtection{
  1245.             if (isset($style->protection['locked'])) {
  1246.                 if ((string)$style->protection['locked'== 'true'{
  1247.                     $docStyle->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_PROTECTED);
  1248.                 else {
  1249.                     $docStyle->getProtection()->setLocked(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
  1250.                 }
  1251.             }
  1252.  
  1253.             if (isset($style->protection['hidden'])) {
  1254.                 if ((string)$style->protection['hidden'== 'true'{
  1255.                     $docStyle->getProtection()->setHidden(PHPExcel_Style_Protection::PROTECTION_PROTECTED);
  1256.                 else {
  1257.                     $docStyle->getProtection()->setHidden(PHPExcel_Style_Protection::PROTECTION_UNPROTECTED);
  1258.                 }
  1259.             }
  1260.         }
  1261.     }
  1262.  
  1263.     private function _readBorder($docBorder$eleBorder{
  1264.         if (isset($eleBorder["style"])) {
  1265.             $docBorder->setBorderStyle((string) $eleBorder["style"]);
  1266.         }
  1267.         if (isset($eleBorder->color)) {
  1268.             $docBorder->getColor()->setARGB($this->_readColor($eleBorder->color));
  1269.         }
  1270.     }
  1271.  
  1272.     private function _parseRichText($is null{
  1273.         $value new PHPExcel_RichText();
  1274.  
  1275.         if (isset($is->t)) {
  1276.             $value->createTextPHPExcel_Shared_String::ControlCharacterOOXML2PHP(string) $is->) );
  1277.         else {
  1278.             foreach ($is->as $run{
  1279.                 $objText $value->createTextRunPHPExcel_Shared_String::ControlCharacterOOXML2PHP(string) $run->) );
  1280.  
  1281.                 if (isset($run->rPr)) {
  1282.                     if (isset($run->rPr->rFont["val"])) {
  1283.                         $objText->getFont()->setName((string) $run->rPr->rFont["val"]);
  1284.                     }
  1285.  
  1286.                     if (isset($run->rPr->sz["val"])) {
  1287.                         $objText->getFont()->setSize((string) $run->rPr->sz["val"]);
  1288.                     }
  1289.  
  1290.                     if (isset($run->rPr->color)) {
  1291.                         $objText->getFont()->setColornew PHPExcel_Style_Color$this->_readColor($run->rPr->color) ) );
  1292.                     }
  1293.  
  1294.                     if ( (isset($run->rPr->b["val"]&& ((string) $run->rPr->b["val"== 'true' || (string) $run->rPr->b["val"== '1'))
  1295.                          || (isset($run->rPr->b&& !isset($run->rPr->b["val"])) ) {
  1296.                         $objText->getFont()->setBold(true);
  1297.                     }
  1298.  
  1299.                     if ( (isset($run->rPr->i["val"]&& ((string) $run->rPr->i["val"== 'true' || (string) $run->rPr->i["val"== '1'))
  1300.                          || (isset($run->rPr->i&& !isset($run->rPr->i["val"])) ) {
  1301.                         $objText->getFont()->setItalic(true);
  1302.                     }
  1303.  
  1304.                     if (isset($run->rPr->vertAlign&& isset($run->rPr->vertAlign["val"])) {
  1305.                         $vertAlign strtolower((string)$run->rPr->vertAlign["val"]);
  1306.                         if ($vertAlign == 'superscript'{
  1307.                             $objText->getFont()->setSuperScript(true);
  1308.                         }
  1309.                         if ($vertAlign == 'subscript'{
  1310.                             $objText->getFont()->setSubScript(true);
  1311.                         }
  1312.                     }
  1313.  
  1314.                     if (isset($run->rPr->u&& !isset($run->rPr->u["val"])) {
  1315.                         $objText->getFont()->setUnderline(PHPExcel_Style_Font::UNDERLINE_SINGLE);
  1316.                     else if (isset($run->rPr->u&& isset($run->rPr->u["val"])) {
  1317.                         $objText->getFont()->setUnderline((string)$run->rPr->u["val"]);
  1318.                     }
  1319.  
  1320.                     if ( (isset($run->rPr->strike["val"])  && ((string) $run->rPr->strike["val"== 'true' || (string) $run->rPr->strike["val"== '1'))
  1321.                          || (isset($run->rPr->strike&& !isset($run->rPr->strike["val"])) ) {
  1322.                         $objText->getFont()->setStriketrough(true);
  1323.                     }
  1324.                 }
  1325.             }
  1326.         }
  1327.  
  1328.         return $value;
  1329.     }
  1330.  
  1331.     private static function array_item($array$key 0{
  1332.         return (isset($array[$key]$array[$keynull);
  1333.     }
  1334.  
  1335.     private static function dir_add($base$add{
  1336.         return preg_replace('~[^/]+/\.\./~'''dirname($base"/$add");
  1337.     }
  1338.  
  1339.     private static function toCSSArray($style{
  1340.         $style str_replace("\r"""$style);
  1341.         $style str_replace("\n"""$style);
  1342.  
  1343.         $temp explode(';'$style);
  1344.  
  1345.         $style array();
  1346.         foreach ($temp as $item{
  1347.             $item explode(':'$item);
  1348.  
  1349.             if (strpos($item[1]'px'!== false{
  1350.                 $item[1str_replace('px'''$item[1]);
  1351.             }
  1352.             if (strpos($item[1]'pt'!== false{
  1353.                 $item[1str_replace('pt'''$item[1]);
  1354.                 $item[1PHPExcel_Shared_Font::fontSizeToPixels($item[1]);
  1355.             }
  1356.  
  1357.             $style[$item[0]] $item[1];
  1358.         }
  1359.  
  1360.         return $style;
  1361.     }
  1362. }

Documentation generated on Mon, 05 Jan 2009 20:37:12 +0100 by phpDocumentor 1.4.1