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

Source for file HTML.php

Documentation is available at HTML.php

  1. <?php
  2. /**
  3.  * PHPExcel
  4.  *
  5.  * Copyright (c) 2006 - 2010 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 the 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_Writer
  23.  * @copyright  Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
  24.  * @license    http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt    LGPL
  25.  * @version    1.7.2, 2010-01-11
  26.  */
  27.  
  28.  
  29. /** PHPExcel root directory */
  30. if (!defined('PHPEXCEL_ROOT')) {
  31.     /**
  32.      * @ignore
  33.      */
  34.     define('PHPEXCEL_ROOT'dirname(__FILE__'/../../');
  35. }
  36.  
  37. /** PHPExcel_IWriter */
  38. require_once PHPEXCEL_ROOT 'PHPExcel/Writer/IWriter.php';
  39.  
  40. /** PHPExcel_Cell */
  41. require_once PHPEXCEL_ROOT 'PHPExcel/Cell.php';
  42.  
  43. /** PHPExcel_RichText */
  44. require_once PHPEXCEL_ROOT 'PHPExcel/RichText.php';
  45.  
  46. /** PHPExcel_Shared_Drawing */
  47. require_once PHPEXCEL_ROOT 'PHPExcel/Shared/Drawing.php';
  48.  
  49. /** PHPExcel_Shared_String */
  50. require_once PHPEXCEL_ROOT 'PHPExcel/Shared/String.php';
  51.  
  52. /** PHPExcel_HashTable */
  53. require_once PHPEXCEL_ROOT 'PHPExcel/HashTable.php';
  54.  
  55.  
  56. /**
  57.  * PHPExcel_Writer_HTML
  58.  *
  59.  * @category   PHPExcel
  60.  * @package    PHPExcel_Writer
  61.  * @copyright  Copyright (c) 2006 - 2010 PHPExcel (http://www.codeplex.com/PHPExcel)
  62.  */
  63. class PHPExcel_Writer_HTML implements PHPExcel_Writer_IWriter {
  64.     /**
  65.      * PHPExcel object
  66.      *
  67.      * @var PHPExcel 
  68.      */
  69.     protected $_phpExcel;
  70.  
  71.     /**
  72.      * Sheet index to write
  73.      *
  74.      * @var int 
  75.      */
  76.     private $_sheetIndex;
  77.  
  78.     /**
  79.      * Pre-calculate formulas
  80.      *
  81.      * @var boolean 
  82.      */
  83.     private $_preCalculateFormulas = true;
  84.  
  85.     /**
  86.      * Images root
  87.      *
  88.      * @var string 
  89.      */
  90.     private $_imagesRoot = '.';
  91.     
  92.     /**
  93.      * Use inline CSS?
  94.      *
  95.      * @var boolean 
  96.      */
  97.     private $_useInlineCss = false;
  98.     
  99.     /**
  100.      * Array of CSS styles
  101.      *
  102.      * @var array 
  103.      */
  104.     private $_cssStyles = null;
  105.  
  106.     /**
  107.      * Array of column widths in points
  108.      *
  109.      * @var array 
  110.      */
  111.     private $_columnWidths = null;
  112.  
  113.     /**
  114.      * Default font
  115.      *
  116.      * @var PHPExcel_Style_Font 
  117.      */
  118.     private $_defaultFont;
  119.  
  120.     /**
  121.      * Flag whether spans have been calculated
  122.      *
  123.      * @var boolean 
  124.      */
  125.     private $_spansAreCalculated;
  126.  
  127.     /**
  128.      * Excel cells that should not be written as HTML cells
  129.      *
  130.      * @var array 
  131.      */
  132.     private $_isSpannedCell;
  133.  
  134.     /**
  135.      * Excel cells that are upper-left corner in a cell merge
  136.      *
  137.      * @var array 
  138.      */
  139.     private $_isBaseCell;
  140.  
  141.     /**
  142.      * Excel rows that should not be written as HTML rows
  143.      *
  144.      * @var array 
  145.      */
  146.     private $_isSpannedRow;
  147.  
  148.     /**
  149.      * Is the current writer creating PDF?
  150.      *
  151.      * @var boolean 
  152.      */
  153.     protected $_isPdf = false;
  154.  
  155.     /**
  156.      * Create a new PHPExcel_Writer_HTML
  157.      *
  158.      * @param     PHPExcel    $phpExcel    PHPExcel object
  159.      */
  160.     public function __construct(PHPExcel $phpExcel{
  161.         $this->_phpExcel = $phpExcel;
  162.         $this->_defaultFont = $this->_phpExcel->getDefaultStyle()->getFont();
  163.         $this->_sheetIndex = 0;
  164.         $this->_imagesRoot = '.';
  165.  
  166.         $this->_spansAreCalculated = false;
  167.         $this->_isSpannedCell = array();
  168.         $this->_isBaseCell    = array();
  169.         $this->_isSpannedRow  = array();
  170.     }
  171.  
  172.     /**
  173.      * Save PHPExcel to file
  174.      *
  175.      * @param     string         $pFileName 
  176.      * @throws     Exception
  177.      */
  178.     public function save($pFilename null{
  179.         // garbage collect
  180.         $this->_phpExcel->garbageCollect();
  181.  
  182.         $saveArrayReturnType PHPExcel_Calculation::getArrayReturnType();
  183.         PHPExcel_Calculation::setArrayReturnType(PHPExcel_Calculation::RETURN_ARRAY_AS_VALUE);
  184.  
  185.         // Build CSS
  186.         $this->buildCSS(!$this->_useInlineCss);
  187.         
  188.         // Open file
  189.         $fileHandle fopen($pFilename'w');
  190.         if ($fileHandle === false{
  191.             throw new Exception("Could not open file $pFilename for writing.");
  192.         }
  193.  
  194.         // Write headers
  195.         fwrite($fileHandle$this->generateHTMLHeader(!$this->_useInlineCss));
  196.  
  197.         // Write data
  198.         fwrite($fileHandle$this->generateSheetData());
  199.  
  200.         // Write footer
  201.         fwrite($fileHandle$this->generateHTMLFooter());
  202.  
  203.         // Close file
  204.         fclose($fileHandle);
  205.  
  206.         PHPExcel_Calculation::setArrayReturnType($saveArrayReturnType);
  207.     }
  208.  
  209.     /**
  210.      * Map VAlign
  211.      */
  212.     private function _mapVAlign($vAlign{
  213.         switch ($vAlign{
  214.             case PHPExcel_Style_Alignment::VERTICAL_BOTTOMreturn 'bottom';
  215.             case PHPExcel_Style_Alignment::VERTICAL_TOPreturn 'top';
  216.             case PHPExcel_Style_Alignment::VERTICAL_CENTER:
  217.             case PHPExcel_Style_Alignment::VERTICAL_JUSTIFYreturn 'middle';
  218.             defaultreturn 'baseline';
  219.         }
  220.     }
  221.  
  222.     /**
  223.      * Map HAlign
  224.      *
  225.      * @return string|false
  226.      */
  227.     private function _mapHAlign($hAlign{
  228.         switch ($hAlign{
  229.             case PHPExcel_Style_Alignment::HORIZONTAL_GENERALreturn false;
  230.             case PHPExcel_Style_Alignment::HORIZONTAL_LEFTreturn 'left';
  231.             case PHPExcel_Style_Alignment::HORIZONTAL_RIGHTreturn 'right';
  232.             case PHPExcel_Style_Alignment::HORIZONTAL_CENTERreturn 'center';
  233.             case PHPExcel_Style_Alignment::HORIZONTAL_JUSTIFYreturn 'justify';
  234.             defaultreturn false;
  235.         }
  236.     }
  237.  
  238.     /**
  239.      * Map border style
  240.      */
  241.     private function _mapBorderStyle($borderStyle{
  242.         switch ($borderStyle{
  243.             case PHPExcel_Style_Border::BORDER_NONEreturn '0px';
  244.             case PHPExcel_Style_Border::BORDER_DASHEDreturn '1px dashed';
  245.             case PHPExcel_Style_Border::BORDER_DOTTEDreturn '1px dotted';
  246.             case PHPExcel_Style_Border::BORDER_DOUBLEreturn '3px double';
  247.             case PHPExcel_Style_Border::BORDER_THICKreturn '2px solid';
  248.             defaultreturn '1px solid'// map others to thin
  249.         }
  250.     }
  251.  
  252.     /**
  253.      * Get sheet index
  254.      *
  255.      * @return int 
  256.      */
  257.     public function getSheetIndex({
  258.         return $this->_sheetIndex;
  259.     }
  260.  
  261.     /**
  262.      * Set sheet index
  263.      *
  264.      * @param    int        $pValue        Sheet index
  265.      * @return PHPExcel_Writer_HTML 
  266.      */
  267.     public function setSheetIndex($pValue 0{
  268.         $this->_sheetIndex = $pValue;
  269.         return $this;
  270.     }
  271.  
  272.     /**
  273.      * Write all sheets (resets sheetIndex to NULL)
  274.      */
  275.     public function writeAllSheets({
  276.         $this->_sheetIndex = null;
  277.     }
  278.  
  279.     /**
  280.      * Generate HTML header
  281.      *
  282.      * @param    boolean        $pIncludeStyles        Include styles?
  283.      * @return    string 
  284.      * @throws Exception
  285.      */
  286.     public function generateHTMLHeader($pIncludeStyles false{
  287.         // PHPExcel object known?
  288.         if (is_null($this->_phpExcel)) {
  289.             throw new Exception('Internal PHPExcel object not set to an instance of an object.');
  290.         }
  291.  
  292.         // Construct HTML
  293.         $html '';
  294.         $html .= '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' "\r\n";
  295.         $html .= '<!-- Generated by PHPExcel - http://www.phpexcel.net -->' "\r\n";
  296.         $html .= '<html>' "\r\n";
  297.         $html .= '  <head>' "\r\n";
  298.         $html .= '    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' "\r\n";
  299.         $html .= '    <title>' htmlspecialchars($this->_phpExcel->getProperties()->getTitle()) '</title>' "\r\n";
  300.         if ($pIncludeStyles{
  301.             $html .= $this->generateStyles(true);
  302.         }
  303.         $html .= '  </head>' "\r\n";
  304.         $html .= '' "\r\n";
  305.         $html .= '  <body>' "\r\n";
  306.  
  307.         // Return
  308.         return $html;
  309.     }
  310.  
  311.     /**
  312.      * Generate sheet data
  313.      *
  314.      * @return    string 
  315.      * @throws Exception
  316.      */
  317.     public function generateSheetData({
  318.         // PHPExcel object known?
  319.         if (is_null($this->_phpExcel)) {
  320.             throw new Exception('Internal PHPExcel object not set to an instance of an object.');
  321.         }
  322.  
  323.         // Ensure that Spans have been calculated?
  324.         if (!$this->_spansAreCalculated{
  325.             $this->_calculateSpans();
  326.         }
  327.  
  328.         // Fetch sheets
  329.         $sheets array();
  330.         if (is_null($this->_sheetIndex)) {
  331.             $sheets $this->_phpExcel->getAllSheets();
  332.         else {
  333.             $sheets[$this->_phpExcel->getSheet($this->_sheetIndex);
  334.         }
  335.  
  336.         // Construct HTML
  337.         $html '';
  338.  
  339.         // Loop all sheets
  340.         $sheetId 0;
  341.         foreach ($sheets as $sheet{
  342.             // Write table header
  343.             $html .= $this->_generateTableHeader($sheet);
  344.  
  345.             // Get worksheet dimension
  346.             $dimension explode(':'$sheet->calculateWorksheetDimension());
  347.             $dimension[0PHPExcel_Cell::coordinateFromString($dimension[0]);
  348.             $dimension[0][0PHPExcel_Cell::columnIndexFromString($dimension[0][0]1;
  349.             $dimension[1PHPExcel_Cell::coordinateFromString($dimension[1]);
  350.             $dimension[1][0PHPExcel_Cell::columnIndexFromString($dimension[1][0]1;
  351.  
  352.             // Loop through cells
  353.             $rowData null;
  354.             for ($row $dimension[0][1]$row <= $dimension[1][1]++$row{
  355.                 // Start a new row
  356.                 $rowData array();
  357.  
  358.                 // Loop through columns
  359.                 for ($column $dimension[0][0]$column <= $dimension[1][0]++$column{
  360.                     // Cell exists?
  361.                     if ($sheet->cellExistsByColumnAndRow($column$row)) {
  362.                         $rowData[$column$sheet->getCellByColumnAndRow($column$row);
  363.                     else {
  364.                         $rowData[$column'';
  365.                     }
  366.                 }
  367.  
  368.                 // Write row if there are HTML table cells in it
  369.                 if !isset($this->_isSpannedRow[$sheet->getParent()->getIndex($sheet)][$row]) ) {
  370.                     $html .= $this->_generateRow($sheet$rowData$row 1);
  371.                 }
  372.             }
  373.  
  374.             // Write table footer
  375.             $html .= $this->_generateTableFooter();
  376.             
  377.             // Writing PDF?
  378.             if ($this->_isPdf)
  379.             {
  380.                 if (is_null($this->_sheetIndex&& $sheetId $this->_phpExcel->getSheetCount()) {
  381.                     $html .= '<tcpdf method="AddPage" />';
  382.                 }
  383.             }
  384.             
  385.             // Next sheet
  386.             ++$sheetId;
  387.         }
  388.  
  389.         // Return
  390.         return $html;
  391.     }
  392.  
  393.     /**
  394.      * Generate image tag in cell
  395.      *
  396.      * @param    PHPExcel_Worksheet     $pSheet            PHPExcel_Worksheet
  397.      * @param    string                $coordinates    Cell coordinates
  398.      * @return    string 
  399.      * @throws    Exception
  400.      */
  401.     private function _writeImageTagInCell(PHPExcel_Worksheet $pSheet$coordinates{
  402.         // Construct HTML
  403.         $html '';
  404.  
  405.         // Write images
  406.         foreach ($pSheet->getDrawingCollection(as $drawing{
  407.             if ($drawing instanceof PHPExcel_Worksheet_Drawing{
  408.                 if ($drawing->getCoordinates(== $coordinates{
  409.                     $filename $drawing->getPath();
  410.  
  411.                     // Strip off eventual '.'
  412.                     if (substr($filename01== '.'{
  413.                         $filename substr($filename1);
  414.                     }
  415.  
  416.                     // Prepend images root
  417.                     $filename $this->getImagesRoot($filename;
  418.  
  419.                     // Strip off eventual '.'
  420.                     if (substr($filename01== '.' && substr($filename02!= './'{
  421.                         $filename substr($filename1);
  422.                     }
  423.  
  424.                     // Convert UTF8 data to PCDATA
  425.                     $filename htmlspecialchars($filename);
  426.  
  427.                     $html .= "\r\n";
  428.                     $html .= '        <img style="position: relative; left: ' $drawing->getOffsetX('px; top: ' $drawing->getOffsetY('px; width: ' $drawing->getWidth('px; height: ' $drawing->getHeight('px;" src="' $filename '" border="0" width="' $drawing->getWidth('" height="' $drawing->getHeight('" />' "\r\n";
  429.                 }
  430.             }
  431.         }
  432.  
  433.         // Return
  434.         return $html;
  435.     }
  436.  
  437.     /**
  438.      * Generate CSS styles
  439.      *
  440.      * @param    boolean    $generateSurroundingHTML    Generate surrounding HTML tags? (<style> and </style>)
  441.      * @return    string 
  442.      * @throws    Exception
  443.      */
  444.     public function generateStyles($generateSurroundingHTML true{
  445.         // PHPExcel object known?
  446.         if (is_null($this->_phpExcel)) {
  447.             throw new Exception('Internal PHPExcel object not set to an instance of an object.');
  448.         }
  449.         
  450.         // Build CSS
  451.         $css $this->buildCSS($generateSurroundingHTML);
  452.  
  453.         // Construct HTML
  454.         $html '';
  455.  
  456.         // Start styles
  457.         if ($generateSurroundingHTML{
  458.             $html .= '    <style type="text/css">' "\r\n";
  459.             $html .= '      html { ' $this->_assembleCSS($css['html']' }' "\r\n";
  460.         }
  461.         
  462.         // Write all other styles
  463.         foreach ($css as $styleName => $styleDefinition{
  464.             if ($styleName != 'html'{
  465.                 $html .= '      ' $styleName ' { ' $this->_assembleCSS($styleDefinition' }' "\r\n";
  466.             }
  467.         }
  468.  
  469.         // End styles
  470.         if ($generateSurroundingHTML{
  471.             $html .= '    </style>' "\r\n";
  472.         }
  473.  
  474.         // Return
  475.         return $html;
  476.     }
  477.     
  478.     /**
  479.      * Build CSS styles
  480.      *
  481.      * @param    boolean    $generateSurroundingHTML    Generate surrounding HTML style? (html { })
  482.      * @return    array 
  483.      * @throws    Exception
  484.      */
  485.     public function buildCSS($generateSurroundingHTML true{
  486.         // PHPExcel object known?
  487.         if (is_null($this->_phpExcel)) {
  488.             throw new Exception('Internal PHPExcel object not set to an instance of an object.');
  489.         }
  490.         
  491.         // Cached?
  492.         if (!is_null($this->_cssStyles)) {
  493.             return $this->_cssStyles;
  494.         }
  495.  
  496.         // Ensure that spans have been calculated
  497.         if (!$this->_spansAreCalculated{
  498.             $this->_calculateSpans();
  499.         }
  500.  
  501.         // Construct CSS
  502.         $css array();
  503.  
  504.         // Start styles
  505.         if ($generateSurroundingHTML{
  506.             // html { }
  507.             $css['html']['font-family']      'Calibri, Arial, Helvetica, sans-serif';
  508.             $css['html']['font-size']        '11pt';
  509.             $css['html']['background-color''white';
  510.         }
  511.  
  512.  
  513.         // table { }
  514.         $css['table']['border-collapse']  'collapse';
  515.         $css['table']['page-break-after''always';
  516.  
  517.         // .gridlines td { }
  518.         $css['.gridlines td']['border''1px dotted black';
  519.  
  520.         // .b {}
  521.         $css['.b']['text-align''center'// BOOL
  522.  
  523.         // .e {}
  524.         $css['.e']['text-align''center'// ERROR
  525.  
  526.         // .f {}
  527.         $css['.f']['text-align''right'// FORMULA
  528.  
  529.         // .inlineStr {}
  530.         $css['.inlineStr']['text-align''left'// INLINE
  531.  
  532.         // .n {}
  533.         $css['.n']['text-align''right'// NUMERIC
  534.  
  535.         // .s {}
  536.         $css['.s']['text-align''left'// STRING
  537.  
  538.         // Calculate cell style hashes
  539.         foreach ($this->_phpExcel->getCellXfCollection(as $index => $style{
  540.             $css['td.style' $index$this->_createCSSStyle$style );
  541.         }
  542.  
  543.         // Fetch sheets
  544.         $sheets array();
  545.         if (is_null($this->_sheetIndex)) {
  546.             $sheets $this->_phpExcel->getAllSheets();
  547.         else {
  548.             $sheets[$this->_phpExcel->getSheet($this->_sheetIndex);
  549.         }
  550.  
  551.         // Build styles per sheet
  552.         foreach ($sheets as $sheet{
  553.             // Calculate hash code
  554.             $sheetIndex $sheet->getParent()->getIndex($sheet);
  555.  
  556.             // Build styles
  557.             // Calculate column widths
  558.             $sheet->calculateColumnWidths();
  559.  
  560.             // col elements, initialize
  561.             $highestColumnIndex PHPExcel_Cell::columnIndexFromString($sheet->getHighestColumn()) 1;
  562.             for ($column 0$column <= $highestColumnIndex++$column{
  563.                 $this->_columnWidths[$sheetIndex][$column42// approximation
  564.                 $css['table.sheet' $sheetIndex ' col.col' $column]['width''42pt';
  565.             }
  566.  
  567.             // col elements, loop through columnDimensions and set width
  568.             foreach ($sheet->getColumnDimensions(as $columnDimension{
  569.                 if (($width PHPExcel_Shared_Drawing::cellDimensionToPixels($columnDimension->getWidth()$this->_defaultFont)) >= 0{
  570.                     $width PHPExcel_Shared_Drawing::pixelsToPoints($width);
  571.                     $column PHPExcel_Cell::columnIndexFromString($columnDimension->getColumnIndex()) 1;
  572.                     $this->_columnWidths[$sheetIndex][$column$width;
  573.                     $css['table.sheet' $sheetIndex ' col.col' $column]['width'$width 'pt';
  574.                     
  575.                     if ($columnDimension->getVisible(=== false{
  576.                         $css['table.sheet' $sheetIndex ' col.col' $column]['visibility''collapse';
  577.                         $css['table.sheet' $sheetIndex ' col.col' $column]['*display''none'// target IE6+7
  578.                     }
  579.                 }
  580.             }
  581.  
  582.             // Default row height
  583.             $rowDimension $sheet->getDefaultRowDimension();
  584.  
  585.             // table.sheetN tr { }
  586.             $css['table.sheet' $sheetIndex ' tr'array();
  587.  
  588.             if ($rowDimension->getRowHeight(== -1{
  589.                 $pt_height PHPExcel_Shared_Font::getDefaultRowHeightByFont($this->_phpExcel->getDefaultStyle()->getFont());
  590.             else {
  591.                 $pt_height $rowDimension->getRowHeight();
  592.             }
  593.             $css['table.sheet' $sheetIndex ' tr']['height'$pt_height 'pt';
  594.             if ($rowDimension->getVisible(=== false{
  595.                 $css['table.sheet' $sheetIndex ' tr']['display']    'none';
  596.                 $css['table.sheet' $sheetIndex ' tr']['visibility''hidden';
  597.             }
  598.  
  599.             // Calculate row heights
  600.             foreach ($sheet->getRowDimensions(as $rowDimension{
  601.                 $row $rowDimension->getRowIndex(1;
  602.  
  603.                 // table.sheetN tr.rowYYYYYY { }
  604.                 $css['table.sheet' $sheetIndex ' tr.row' $rowarray();
  605.  
  606.                 if ($rowDimension->getRowHeight(== -1{
  607.                     $pt_height PHPExcel_Shared_Font::getDefaultRowHeightByFont($this->_phpExcel->getDefaultStyle()->getFont());
  608.                 else {
  609.                     $pt_height $rowDimension->getRowHeight();
  610.                 }
  611.                 $css['table.sheet' $sheetIndex ' tr.row' $row]['height'$pt_height 'pt';
  612.                 if ($rowDimension->getVisible(=== false{
  613.                     $css['table.sheet' $sheetIndex ' tr.row' $row]['display''none';
  614.                     $css['table.sheet' $sheetIndex ' tr.row' $row]['visibility''hidden';
  615.                 }
  616.             }
  617.         }
  618.  
  619.         // Cache
  620.         if (is_null($this->_cssStyles)) {
  621.             $this->_cssStyles = $css;
  622.         }
  623.         
  624.         // Return
  625.         return $css;
  626.     }
  627.  
  628.     /**
  629.      * Create CSS style
  630.      *
  631.      * @param    PHPExcel_Style         $pStyle            PHPExcel_Style
  632.      * @return    array 
  633.      */
  634.     private function _createCSSStyle(PHPExcel_Style $pStyle{
  635.         // Construct CSS
  636.         $css '';
  637.  
  638.         // Create CSS
  639.         $css array_merge(
  640.             $this->_createCSSStyleAlignment($pStyle->getAlignment())
  641.             $this->_createCSSStyleBorders($pStyle->getBorders())
  642.             $this->_createCSSStyleFont($pStyle->getFont())
  643.             $this->_createCSSStyleFill($pStyle->getFill())
  644.         );
  645.  
  646.         // Return
  647.         return $css;
  648.     }
  649.  
  650.     /**
  651.      * Create CSS style (PHPExcel_Style_Alignment)
  652.      *
  653.      * @param    PHPExcel_Style_Alignment         $pStyle            PHPExcel_Style_Alignment
  654.      * @return    array 
  655.      */
  656.     private function _createCSSStyleAlignment(PHPExcel_Style_Alignment $pStyle{
  657.         // Construct CSS
  658.         $css array();
  659.  
  660.         // Create CSS
  661.         $css['vertical-align'$this->_mapVAlign($pStyle->getVertical());
  662.         if ($textAlign $this->_mapHAlign($pStyle->getHorizontal())) {
  663.             $css['text-align'$textAlign;
  664.         }
  665.  
  666.         // Return
  667.         return $css;
  668.     }
  669.  
  670.     /**
  671.      * Create CSS style (PHPExcel_Style_Font)
  672.      *
  673.      * @param    PHPExcel_Style_Font         $pStyle            PHPExcel_Style_Font
  674.      * @return    array 
  675.      */
  676.     private function _createCSSStyleFont(PHPExcel_Style_Font $pStyle{
  677.         // Construct CSS
  678.         $css array();
  679.  
  680.         // Create CSS
  681.         if ($pStyle->getBold()) {
  682.             $css['font-weight''bold';
  683.         }
  684.         if ($pStyle->getUnderline(!= PHPExcel_Style_Font::UNDERLINE_NONE && $pStyle->getStrikethrough()) {
  685.             $css['text-decoration''underline line-through';
  686.         else if ($pStyle->getUnderline(!= PHPExcel_Style_Font::UNDERLINE_NONE{
  687.             $css['text-decoration''underline';
  688.         else if ($pStyle->getStrikethrough()) {
  689.             $css['text-decoration''line-through';
  690.         }
  691.         if ($pStyle->getItalic()) {
  692.             $css['font-style''italic';
  693.         }
  694.  
  695.         $css['color']        '#' $pStyle->getColor()->getRGB();
  696.         $css['font-family']    '\'' $pStyle->getName('\'';
  697.         $css['font-size']    $pStyle->getSize('pt';
  698.  
  699.         // Return
  700.         return $css;
  701.     }
  702.  
  703.     /**
  704.      * Create CSS style (PHPExcel_Style_Borders)
  705.      *
  706.      * @param    PHPExcel_Style_Borders         $pStyle            PHPExcel_Style_Borders
  707.      * @return    array 
  708.      */
  709.     private function _createCSSStyleBorders(PHPExcel_Style_Borders $pStyle{
  710.         // Construct CSS
  711.         $css array();
  712.  
  713.         // Create CSS
  714.         $css['border-bottom']    $this->_createCSSStyleBorder($pStyle->getBottom());
  715.         $css['border-top']        $this->_createCSSStyleBorder($pStyle->getTop());
  716.         $css['border-left']        $this->_createCSSStyleBorder($pStyle->getLeft());
  717.         $css['border-right']    $this->_createCSSStyleBorder($pStyle->getRight());
  718.  
  719.         // Return
  720.         return $css;
  721.     }
  722.  
  723.     /**
  724.      * Create CSS style (PHPExcel_Style_Border)
  725.      *
  726.      * @param    PHPExcel_Style_Border        $pStyle            PHPExcel_Style_Border
  727.      * @return    string 
  728.      */
  729.     private function _createCSSStyleBorder(PHPExcel_Style_Border $pStyle{
  730.         // Construct HTML
  731.         $css '';
  732.  
  733.         // Create CSS
  734.         $css .= $this->_mapBorderStyle($pStyle->getBorderStyle()) ' #' $pStyle->getColor()->getRGB();
  735.  
  736.         // Return
  737.         return $css;
  738.     }
  739.  
  740.     /**
  741.      * Create CSS style (PHPExcel_Style_Fill)
  742.      *
  743.      * @param    PHPExcel_Style_Fill        $pStyle            PHPExcel_Style_Fill
  744.      * @return    array 
  745.      */
  746.     private function _createCSSStyleFill(PHPExcel_Style_Fill $pStyle{
  747.         // Construct HTML
  748.         $css array();
  749.  
  750.         // Create CSS
  751.         $value $pStyle->getFillType(== PHPExcel_Style_Fill::FILL_NONE ?
  752.             'white' '#' $pStyle->getStartColor()->getRGB();
  753.         $css['background-color'$value;
  754.  
  755.         // Return
  756.         return $css;
  757.     }
  758.  
  759.     /**
  760.      * Generate HTML footer
  761.      */
  762.     public function generateHTMLFooter({
  763.         // Construct HTML
  764.         $html '';
  765.         $html .= '  </body>' "\r\n";
  766.         $html .= '</html>' "\r\n";
  767.  
  768.         // Return
  769.         return $html;
  770.     }
  771.  
  772.     /**
  773.      * Generate table header
  774.      *
  775.      * @param     PHPExcel_Worksheet    $pSheet        The worksheet for the table we are writing
  776.      * @return    string 
  777.      * @throws    Exception
  778.      */
  779.     private function _generateTableHeader($pSheet{
  780.         $sheetIndex $pSheet->getParent()->getIndex($pSheet);
  781.  
  782.         // Construct HTML
  783.         $html '';
  784.         
  785.         if (!$this->_useInlineCss{
  786.             $gridlines $pSheet->getShowGridLines(' gridlines' '';
  787.             $html .= '    <table border="0" cellpadding="0" cellspacing="0" class="sheet' $sheetIndex $gridlines '">' "\r\n";
  788.         else {
  789.             $style = isset($this->_cssStyles['table']?
  790.                 $this->_assembleCSS($this->_cssStyles['table']'';
  791.  
  792.             $html .= '    <table border="0" cellpadding="0" cellspacing="0" style="' $style '">' "\r\n";
  793.         }
  794.  
  795.         // Write <col> elements
  796.         $highestColumnIndex PHPExcel_Cell::columnIndexFromString($pSheet->getHighestColumn()) 1;
  797.         for ($i 0$i <= $highestColumnIndex++$i{
  798.             if (!$this->_useInlineCss{
  799.                 $html .= '        <col class="col' $i '">' "\r\n";
  800.             else {
  801.                 $style = isset($this->_cssStyles['table.sheet' $sheetIndex ' col.col' $i]?
  802.                     $this->_assembleCSS($this->_cssStyles['table.sheet' $sheetIndex ' col.col' $i]'';
  803.                 $html .= '        <col style="' $style '">' "\r\n";
  804.             }
  805.         }
  806.  
  807.         // Return
  808.         return $html;
  809.     }
  810.  
  811.     /**
  812.      * Generate table footer
  813.      *
  814.      * @throws    Exception
  815.      */
  816.     private function _generateTableFooter({
  817.         // Construct HTML
  818.         $html '';
  819.         $html .= '    </table>' "\r\n";
  820.  
  821.         // Return
  822.         return $html;
  823.     }
  824.  
  825.     /**
  826.      * Generate row
  827.      *
  828.      * @param    PHPExcel_Worksheet     $pSheet            PHPExcel_Worksheet
  829.      * @param    array                $pValues        Array containing cells in a row
  830.      * @param    int                    $pRow            Row number
  831.      * @return    string 
  832.      * @throws    Exception
  833.      */
  834.     private function _generateRow(PHPExcel_Worksheet $pSheet$pValues null$pRow 0{
  835.         if (is_array($pValues)) {
  836.             // Construct HTML
  837.             $html '';
  838.             
  839.             // Sheet index
  840.             $sheetIndex $pSheet->getParent()->getIndex($pSheet);
  841.  
  842.             // Write row start
  843.             if (!$this->_useInlineCss{
  844.                 $html .= '        <tr class="row' $pRow '">' "\r\n";
  845.             else {
  846.                 $style = isset($this->_cssStyles['table.sheet' $sheetIndex ' tr.row' $pRow])
  847.                     ? $this->_assembleCSS($this->_cssStyles['table.sheet' $sheetIndex ' tr.row' $pRow]'';
  848.                     
  849.                 $html .= '        <tr style="' $style '">' "\r\n";
  850.             }
  851.  
  852.             // Write cells
  853.             $colNum 0;
  854.             foreach ($pValues as $cell{
  855.                 if (!$this->_useInlineCss{
  856.                     $cssClass '';
  857.                     $cssClass 'column' $colNum;
  858.                 else {
  859.                     $cssClass array();
  860.                     if (isset($this->_cssStyles['table.sheet' $sheetIndex ' td.column' $colNum])) {
  861.                         $this->_cssStyles['table.sheet' $sheetIndex ' td.column' $colNum];
  862.                     }
  863.                 }
  864.                 $colSpan 1;
  865.                 $rowSpan 1;
  866.                 $writeCell true;    // Write cell
  867.  
  868.                 // initialize
  869.                 $cellData '';
  870.  
  871.                 // PHPExcel_Cell
  872.                 if ($cell instanceof PHPExcel_Cell{
  873.  
  874.                     // Value
  875.                     if ($cell->getValue(instanceof PHPExcel_RichText{
  876.                         // Loop through rich text elements
  877.                         $elements $cell->getValue()->getRichTextElements();
  878.                         foreach ($elements as $element{
  879.                             // Rich text start?
  880.                             if ($element instanceof PHPExcel_RichText_Run{
  881.                                 $cellData .= '<span style="' $this->_assembleCSS($this->_createCSSStyleFont($element->getFont())) '">';
  882.  
  883.                                 if ($element->getFont()->getSuperScript()) {
  884.                                     $cellData .= '<sup>';
  885.                                 else if ($element->getFont()->getSubScript()) {
  886.                                     $cellData .= '<sub>';
  887.                                 }
  888.                             }
  889.  
  890.                             // Convert UTF8 data to PCDATA
  891.                             $cellText $element->getText();
  892.                             $cellData .= htmlspecialchars($cellText);
  893.  
  894.                             if ($element instanceof PHPExcel_RichText_Run{
  895.                                 if ($element->getFont()->getSuperScript()) {
  896.                                     $cellData .= '</sup>';
  897.                                 else if ($element->getFont()->getSubScript()) {
  898.                                     $cellData .= '</sub>';
  899.                                 }
  900.  
  901.                                 $cellData .= '</span>';
  902.                             }
  903.                         }
  904.                     else {
  905.                         if ($this->_preCalculateFormulas{
  906.                             $cellData PHPExcel_Style_NumberFormat::toFormattedString(
  907.                                 $cell->getCalculatedValue(),
  908.                                 $pSheet->getParent()->getCellXfByIndex$cell->getXfIndex() )->getNumberFormat()->getFormatCode(),
  909.                                 array($this'formatColor')
  910.                             );
  911.                         else {
  912.                             $cellData PHPExcel_Style_NumberFormat::ToFormattedString(
  913.                                 $cell->getValue(),
  914.                                 $pSheet->getParent()->getCellXfByIndex$cell->getXfIndex() )->getNumberFormat()->getFormatCode(),
  915.                                 array($this'formatColor')
  916.                             );
  917.                         }
  918.                     }
  919.  
  920.                     // replace leading spaces on each line with &nbsp;
  921.                     $cellData $this->_convertNbsp($cellData);
  922.  
  923.                     // convert newline "\n" to '<br>'
  924.                     $cellData str_replace("\n"'<br/>'$cellData);
  925.  
  926.                     // Check value
  927.                     if ($cellData == ''{
  928.                         $cellData '&nbsp;';
  929.                     }
  930.  
  931.                     // Extend CSS class?
  932.                     if (!$this->_useInlineCss{
  933.                         $cssClass .= ' style' $cell->getXfIndex();
  934.                         $cssClass .= ' ' $cell->getDataType();
  935.                     else {
  936.                         if (isset($this->_cssStyles['td.style' $cell->getXfIndex()])) {
  937.                             $cssClass array_merge($cssClass$this->_cssStyles['td.style' $cell->getXfIndex()]);
  938.                         }
  939.  
  940.                         // General horizontal alignment: Actual horizontal alignment depends on dataType
  941.                         $sharedStyle $pSheet->getParent()->getCellXfByIndex$cell->getXfIndex() );
  942.                         if ($sharedStyle->getAlignment()->getHorizontal(== PHPExcel_Style_Alignment::HORIZONTAL_GENERAL
  943.                             && isset($this->_cssStyles['.' $cell->getDataType()]['text-align']))
  944.                         {
  945.                             $cssClass['text-align'$this->_cssStyles['.' $cell->getDataType()]['text-align'];
  946.                         }
  947.                     }
  948.                 else {
  949.                     $cell new PHPExcel_Cell(
  950.                         PHPExcel_Cell::stringFromColumnIndex($colNum),
  951.                         ($pRow 1),
  952.                         '',
  953.                         PHPExcel_Cell_DataType::TYPE_NULL,
  954.                         $pSheet
  955.                     );
  956.                 }
  957.  
  958.                 // Hyperlink?
  959.                 if ($cell->hasHyperlink(&& !$cell->getHyperlink()->isInternal()) {
  960.                     $cellData '<a href="' htmlspecialchars($cell->getHyperlink()->getUrl()) '" title="' htmlspecialchars($cell->getHyperlink()->getTooltip()) '">' $cellData '</a>';
  961.                 }
  962.  
  963.                 // Should the cell be written or is it swallowed by a rowspan or colspan?
  964.                 $writeCell isset($this->_isSpannedCell[$pSheet->getParent()->getIndex($pSheet)][$pRow 1][$colNum])
  965.                             && $this->_isSpannedCell[$pSheet->getParent()->getIndex($pSheet)][$pRow 1][$colNum);
  966.  
  967.                 // Colspan and Rowspan
  968.                 $colspan 1;
  969.                 $rowspan 1;
  970.                 if (isset($this->_isBaseCell[$pSheet->getParent()->getIndex($pSheet)][$pRow 1][$colNum])) {
  971.                     $spans $this->_isBaseCell[$pSheet->getParent()->getIndex($pSheet)][$pRow 1][$colNum];
  972.                     $rowSpan $spans['rowspan'];
  973.                     $colSpan $spans['colspan'];
  974.                 }
  975.  
  976.                 // Write
  977.                 if ($writeCell{
  978.                     // Column start
  979.                     $html .= '          <td';
  980.                         if (!$this->_useInlineCss{
  981.                             $html .= ' class="' $cssClass '"';
  982.                         else {
  983.                             //** Necessary redundant code for the sake of PHPExcel_Writer_PDF **
  984.                             // We must explicitly write the width of the <td> element because TCPDF
  985.                             // does not recognize e.g. <col style="width:42pt">
  986.                             $width 0;
  987.                             $columnIndex PHPExcel_Cell::columnIndexFromString($cell->getColumn()) 1;
  988.                             for ($i $columnIndex$i $columnIndex $colSpan++$i{
  989.                                 if (isset($this->_columnWidths[$sheetIndex][$i])) {
  990.                                     $width += $this->_columnWidths[$sheetIndex][$i];
  991.                                 }
  992.                             }
  993.                             $cssClass['width'$width 'pt';
  994.                             
  995.                             // We must also explicitly write the height of the <td> element because TCPDF
  996.                             // does not recognize e.g. <tr style="height:50pt">
  997.                             if (isset($this->_cssStyles['table.sheet' $sheetIndex ' tr.row' $pRow]['height'])) {
  998.                                 $height $this->_cssStyles['table.sheet' $sheetIndex ' tr.row' $pRow]['height'];
  999.                                 $cssClass['height'$height;
  1000.                             }
  1001.                             //** end of redundant code **
  1002.                             
  1003.                             $html .= ' style="' $this->_assembleCSS($cssClass'"';
  1004.                         }
  1005.                         if ($colSpan 1{
  1006.                             $html .= ' colspan="' $colSpan '"';
  1007.                         }
  1008.                         if ($rowSpan 1{
  1009.                             $html .= ' rowspan="' $rowSpan '"';
  1010.                         }
  1011.                     $html .= '>';
  1012.  
  1013.                     // Image?
  1014.                     $html .= $this->_writeImageTagInCell($pSheet$cell->getCoordinate());
  1015.  
  1016.                     // Cell data
  1017.                     $html .= $cellData;
  1018.                     
  1019.                     // Column end
  1020.                     $html .= '</td>' "\r\n";
  1021.                 }
  1022.  
  1023.                 // Next column
  1024.                 ++$colNum;
  1025.             }
  1026.  
  1027.             // Write row end
  1028.             $html .= '        </tr>' "\r\n";
  1029.  
  1030.             // Return
  1031.             return $html;
  1032.         else {
  1033.             throw new Exception("Invalid parameters passed.");
  1034.         }
  1035.     }
  1036.  
  1037.     /**
  1038.      * Takes array where of CSS properties / values and converts to CSS string
  1039.      *
  1040.      * @param array 
  1041.      * @return string 
  1042.      */
  1043.     private function _assembleCSS($pValue array())
  1044.     {
  1045.         $pairs array();
  1046.         foreach ($pValue as $property => $value{
  1047.             $pairs[$property ':' $value;
  1048.         }
  1049.         $string implode('; '$pairs);
  1050.  
  1051.         return $string;
  1052.     }
  1053.  
  1054.     /**
  1055.      * Get Pre-Calculate Formulas
  1056.      *
  1057.      * @return boolean 
  1058.      */
  1059.     public function getPreCalculateFormulas({
  1060.         return $this->_preCalculateFormulas;
  1061.     }
  1062.  
  1063.     /**
  1064.      * Set Pre-Calculate Formulas
  1065.      *
  1066.      * @param boolean $pValue    Pre-Calculate Formulas?
  1067.      * @return PHPExcel_Writer_HTML 
  1068.      */
  1069.     public function setPreCalculateFormulas($pValue true{
  1070.         $this->_preCalculateFormulas = $pValue;
  1071.         return $this;
  1072.     }
  1073.  
  1074.     /**
  1075.      * Get images root
  1076.      *
  1077.      * @return string 
  1078.      */
  1079.     public function getImagesRoot({
  1080.         return $this->_imagesRoot;
  1081.     }
  1082.  
  1083.     /**
  1084.      * Set images root
  1085.      *
  1086.      * @param string $pValue 
  1087.      * @return PHPExcel_Writer_HTML 
  1088.      */
  1089.     public function setImagesRoot($pValue '.'{
  1090.         $this->_imagesRoot = $pValue;
  1091.         return $this;
  1092.     }
  1093.     
  1094.     /**
  1095.      * Get use inline CSS?
  1096.      *
  1097.      * @return boolean 
  1098.      */
  1099.     public function getUseInlineCss({
  1100.         return $this->_useInlineCss;
  1101.     }
  1102.  
  1103.     /**
  1104.      * Set use inline CSS?
  1105.      *
  1106.      * @param boolean $pValue 
  1107.      * @return PHPExcel_Writer_HTML 
  1108.      */
  1109.     public function setUseInlineCss($pValue false{
  1110.         $this->_useInlineCss = $pValue;
  1111.         return $this;
  1112.     }
  1113.  
  1114.     /**
  1115.      * Converts a string so that spaces occuring at beginning of each new line are replaced by &nbsp;
  1116.      * Example: "  Hello\n to the world" is converted to "&nbsp;&nbsp;Hello\n&nbsp;to the world"
  1117.      *
  1118.      * @param string $pValue 
  1119.      * @return string 
  1120.      */
  1121.     private function _convertNbsp($pValue '')
  1122.     {
  1123.         $explodes explode("\n"$pValue);
  1124.         foreach ($explodes as $explode{
  1125.             $matches array();
  1126.             if (preg_match('/^( )+/'$explode$matches)) {
  1127.                 $explode str_repeat('&nbsp;'strlen($matches[0])) substr($explodestrlen($matches[0]));
  1128.             }
  1129.             $implodes[$explode;
  1130.         }
  1131.  
  1132.         $string implode("\n"$implodes);
  1133.         return $string;
  1134.     }
  1135.  
  1136.     /**
  1137.      * Add color to formatted string as inline style
  1138.      *
  1139.      * @param string $pValue Plain formatted value without color
  1140.      * @param string $pFormat Format code
  1141.      * @return string 
  1142.      */
  1143.     public function formatColor($pValue$pFormat)
  1144.     {
  1145.         // Color information, e.g. [Red] is always at the beginning
  1146.         $color null// initialize
  1147.         $matches array();
  1148.  
  1149.         $color_regex '/^\\[[a-zA-Z]+\\]/';
  1150.         if (preg_match($color_regex$pFormat$matches)) {
  1151.             $color str_replace('['''$matches[0]);
  1152.             $color str_replace(']'''$color);
  1153.             $color strtolower($color);
  1154.         }
  1155.         
  1156.         // convert to PCDATA
  1157.         $value htmlspecialchars($pValue);
  1158.         
  1159.         // color span tag
  1160.         if ($color !== null{
  1161.             $value '<span style="color:' $color '">' $value '</span>';
  1162.         }
  1163.  
  1164.         return $value;
  1165.     }
  1166.  
  1167.     /**
  1168.      * Calculate information about HTML colspan and rowspan which is not always the same as Excel's
  1169.      */
  1170.     private function _calculateSpans()
  1171.     {
  1172.         // Identify all cells that should be omitted in HTML due to cell merge.
  1173.         // In HTML only the upper-left cell should be written and it should have
  1174.         //   appropriate rowspan / colspan attribute
  1175.         $sheetIndexes $this->_sheetIndex !== null ?
  1176.             array($this->_sheetIndexrange(0$this->_phpExcel->getSheetCount(1);
  1177.  
  1178.         foreach ($sheetIndexes as $sheetIndex{
  1179.             $sheet $this->_phpExcel->getSheet($sheetIndex);
  1180.  
  1181.             $candidateSpannedRow  array();
  1182.  
  1183.             // loop through all Excel merged cells
  1184.             foreach ($sheet->getMergeCells(as $cells{
  1185.                 list($cellsPHPExcel_Cell::splitRange($cells);
  1186.                 $first $cells[0];
  1187.                 $last  $cells[1];
  1188.  
  1189.                 list($fc$frPHPExcel_Cell::coordinateFromString($first);
  1190.                 $fc PHPExcel_Cell::columnIndexFromString($fc1;
  1191.  
  1192.                 list($lc$lrPHPExcel_Cell::coordinateFromString($last);
  1193.                 $lc PHPExcel_Cell::columnIndexFromString($lc1;
  1194.  
  1195.                 // loop through the individual cells in the individual merge
  1196.                 for ($r $fr$r <= $lr++$r{
  1197.                     // also, flag this row as a HTML row that is candidate to be omitted
  1198.                     $candidateSpannedRow[$r$r;
  1199.  
  1200.                     for ($c $fc$c <= $lc++$c{
  1201.                         if !($c == $fc && $r == $fr) ) {
  1202.                             // not the upper-left cell (should not be written in HTML)
  1203.                             $this->_isSpannedCell[$sheetIndex][$r][$carray(
  1204.                                 'baseCell' => array($fr$fc),
  1205.                             );
  1206.                         else {
  1207.                             // upper-left is the base cell that should hold the colspan/rowspan attribute
  1208.                             $this->_isBaseCell[$sheetIndex][$r][$carray(
  1209.                                 'xlrowspan' => $lr $fr 1// Excel rowspan
  1210.                                 'rowspan'   => $lr $fr 1// HTML rowspan, value may change
  1211.                                 'xlcolspan' => $lc $fc 1// Excel colspan
  1212.                                 'colspan'   => $lc $fc 1// HTML colspan, value may change
  1213.                             );
  1214.                         }
  1215.                     }
  1216.                 }
  1217.             }
  1218.  
  1219.             // Identify which rows should be omitted in HTML. These are the rows where all the cells
  1220.             //   participate in a merge and the where base cells are somewhere above.
  1221.             $countColumns PHPExcel_Cell::columnIndexFromString($sheet->getHighestColumn());
  1222.             foreach ($candidateSpannedRow as $rowIndex{
  1223.                 if (isset($this->_isSpannedCell[$sheetIndex][$rowIndex])) {
  1224.                     if (count($this->_isSpannedCell[$sheetIndex][$rowIndex]== $countColumns{
  1225.                         $this->_isSpannedRow[$sheetIndex][$rowIndex$rowIndex;
  1226.                     };
  1227.                 }
  1228.             }
  1229.  
  1230.             // For each of the omitted rows we found above, the affected rowspans should be subtracted by 1
  1231.             if isset($this->_isSpannedRow[$sheetIndex]) ) {
  1232.                 foreach ($this->_isSpannedRow[$sheetIndexas $rowIndex{
  1233.                     $adjustedBaseCells array();
  1234.                     for ($c 0$c $countColumns++$c{
  1235.                         $baseCell $this->_isSpannedCell[$sheetIndex][$rowIndex][$c]['baseCell'];
  1236.  
  1237.                         if !in_array($baseCell$adjustedBaseCells) ) {
  1238.  
  1239.                             // subtract rowspan by 1
  1240.                             --$this->_isBaseCell[$sheetIndex]$baseCell[0] ]$baseCell[1] ]['rowspan'];
  1241.                             $adjustedBaseCells[$baseCell;
  1242.                         }
  1243.                     }
  1244.                 }
  1245.             }
  1246.  
  1247.             // TODO: Same for columns
  1248.         }
  1249.  
  1250.         // We have calculated the spans
  1251.         $this->_spansAreCalculated = true;
  1252.     }
  1253.  
  1254. }

Documentation generated on Mon, 11 Jan 2010 08:11:25 +0100 by phpDocumentor 1.4.1