141                $this->_phpExcel = $phpExcel;
 
  151        public function save($pFilename = 
null) {
 
  153                $this->_phpExcel->garbageCollect();
 
  161                $this->
buildCSS(!$this->_useInlineCss);
 
  164                $fileHandle = fopen($pFilename, 
'wb+');
 
  165                if ($fileHandle === 
false) {
 
  173                if ((!$this->_isPdf) && ($this->_generateSheetNavigationBlock)) {
 
  202                        default: 
return 'baseline';
 
  220                        default: 
return false;
 
  231                switch ($borderStyle) {
 
  246                        default: 
return '1px solid'; 
 
  266                $this->_sheetIndex = $pValue;
 
  286                $this->_generateSheetNavigationBlock = (bool) $pValue;
 
  294                $this->_sheetIndex = 
null;
 
  307                if (is_null($this->_phpExcel)) {
 
  312                $properties = $this->_phpExcel->getProperties();
 
  313                $html = 
'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">' . 
PHP_EOL;
 
  314                $html .= 
'<!-- Generated by PHPExcel - http://www.phpexcel.net -->' . 
PHP_EOL;
 
  317                $html .= 
'        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . 
PHP_EOL;
 
  318                if ($properties->getTitle() > 
'')
 
  319                        $html .= 
'        <title>' . htmlspecialchars($properties->getTitle()) . 
'</title>' . 
PHP_EOL;
 
  321                if ($properties->getCreator() > 
'')
 
  322                        $html .= 
'        <meta name="author" content="' . htmlspecialchars($properties->getCreator()) . 
'" />' . 
PHP_EOL;
 
  323                if ($properties->getTitle() > 
'')
 
  324                        $html .= 
'        <meta name="title" content="' . htmlspecialchars($properties->getTitle()) . 
'" />' . 
PHP_EOL;
 
  325                if ($properties->getDescription() > 
'')
 
  326                        $html .= 
'        <meta name="description" content="' . htmlspecialchars($properties->getDescription()) . 
'" />' . 
PHP_EOL;
 
  327                if ($properties->getSubject() > 
'')
 
  328                        $html .= 
'        <meta name="subject" content="' . htmlspecialchars($properties->getSubject()) . 
'" />' . 
PHP_EOL;
 
  329                if ($properties->getKeywords() > 
'')
 
  330                        $html .= 
'        <meta name="keywords" content="' . htmlspecialchars($properties->getKeywords()) . 
'" />' . 
PHP_EOL;
 
  331                if ($properties->getCategory() > 
'')
 
  332                        $html .= 
'        <meta name="category" content="' . htmlspecialchars($properties->getCategory()) . 
'" />' . 
PHP_EOL;
 
  333                if ($properties->getCompany() > 
'')
 
  334                        $html .= 
'        <meta name="company" content="' . htmlspecialchars($properties->getCompany()) . 
'" />' . 
PHP_EOL;
 
  335                if ($properties->getManager() > 
'')
 
  336                        $html .= 
'        <meta name="manager" content="' . htmlspecialchars($properties->getManager()) . 
'" />' . 
PHP_EOL;
 
  338                if ($pIncludeStyles) {
 
  358                if (is_null($this->_phpExcel)) {
 
  363                if (!$this->_spansAreCalculated) {
 
  369                if (is_null($this->_sheetIndex)) {
 
  370                        $sheets = $this->_phpExcel->getAllSheets();
 
  372                        $sheets[] = $this->_phpExcel->getSheet($this->_sheetIndex);
 
  380                foreach ($sheets as $sheet) {
 
  385                        $dimension = explode(
':', $sheet->calculateWorksheetDimension());
 
  392                        $rowMin = $dimension[0][1];
 
  393                        $rowMax = $dimension[1][1];
 
  396                        $tbodyStart = $rowMin;
 
  397                        $theadStart = $theadEnd   = 0; 
 
  398                        if ($sheet->getPageSetup()->isRowsToRepeatAtTopSet()) {
 
  399                                $rowsToRepeatAtTop = $sheet->getPageSetup()->getRowsToRepeatAtTop();
 
  402                                if ($rowsToRepeatAtTop[0] == 1) {
 
  403                                        $theadStart = $rowsToRepeatAtTop[0];
 
  404                                        $theadEnd   = $rowsToRepeatAtTop[1];
 
  405                                        $tbodyStart = $rowsToRepeatAtTop[1] + 1;
 
  411                        while(
$row++ < $rowMax) {
 
  413                                if (
$row == $theadStart) {
 
  419                                if (
$row == $tbodyStart) {
 
  425                                if ( !isset($this->_isSpannedRow[$sheet->getParent()->getIndex($sheet)][
$row]) ) {
 
  429                                        $column = $dimension[0][0] - 1;
 
  430                                        while(
$column++ < $dimension[1][0]) {
 
  432                                                if ($sheet->cellExistsByColumnAndRow(
$column, 
$row)) {
 
  442                                if (
$row == $theadEnd) {
 
  456                                if (is_null($this->_sheetIndex) && $sheetId + 1 < $this->_phpExcel->getSheetCount()) {
 
  457                                        $html .= 
'<div style="page-break-before:always" />';
 
  478                if (is_null($this->_phpExcel)) {
 
  484                if (is_null($this->_sheetIndex)) {
 
  485                        $sheets = $this->_phpExcel->getAllSheets();
 
  487                        $sheets[] = $this->_phpExcel->getSheet($this->_sheetIndex);
 
  494                if (count($sheets) > 1) {
 
  500                        foreach ($sheets as $sheet) {
 
  501                                $html .= 
'  <li class="sheet' . $sheetId . 
'"><a href="#sheet' . $sheetId . 
'">' . $sheet->getTitle() . 
'</a></li>' . 
PHP_EOL;
 
  514                if ($this->_includeCharts) {
 
  517                                    $chartCoordinates = 
$chart->getTopLeftPosition();
 
  520                                        if ($chartTL[1] > $rowMax) {
 
  521                                                $rowMax = $chartTL[1];
 
  523                                                        $colMax = $chartTL[0];
 
  534                                if ($imageTL[1] > $rowMax) {
 
  535                                        $rowMax = $imageTL[1];
 
  537                                                $colMax = $imageTL[0];
 
  544                while (
$row < $rowMax) {
 
  546                        for ($col = 
'A'; $col != $colMax; ++$col) {
 
  549                                if ($this->_includeCharts) {
 
  576                                if ($drawing->getCoordinates() == $coordinates) {
 
  596                                        if ((!$this->_embedImages) || ($this->_isPdf)) {
 
  601                                                        $picture = fread($fp,filesize(
$filename));
 
  605                                                        $base64 = chunk_split(base64_encode($picture));
 
  606                                                        $imageData = 
'data:'.$imageDetails[
'mime'].
';base64,' . $base64;
 
  612                                        $html .= 
'<div style="position: relative;">';
 
  613                                        $html .= 
'<img style="position: absolute; z-index: 1; left: ' . 
 
  614                        $drawing->getOffsetX() . 
'px; top: ' . $drawing->getOffsetY() . 
'px; width: ' . 
 
  615                        $drawing->getWidth() . 
'px; height: ' . $drawing->getHeight() . 
'px;" src="' . 
 
  616                        $imageData . 
'" border="0" />';
 
  641                            $chartCoordinates = 
$chart->getTopLeftPosition();
 
  642                                if ($chartCoordinates[
'cell'] == $coordinates) {
 
  644                                        if (!
$chart->render($chartFileName)) {
 
  649                                        $imageDetails = getimagesize($chartFileName);
 
  650                                        if ($fp = fopen($chartFileName,
"rb", 0)) {
 
  651                                                $picture = fread($fp,filesize($chartFileName));
 
  655                                                $base64 = chunk_split(base64_encode($picture));
 
  656                                                $imageData = 
'data:'.$imageDetails[
'mime'].
';base64,' . $base64;
 
  658                                                $html .= 
'<div style="position: relative;">';
 
  659                                                $html .= 
'<img style="position: absolute; z-index: 1; left: ' . $chartCoordinates[
'xOffset'] . 
'px; top: ' . $chartCoordinates[
'yOffset'] . 
'px; width: ' . $imageDetails[0] . 
'px; height: ' . $imageDetails[1] . 
'px;" src="' . $imageData . 
'" border="0" />' . 
PHP_EOL;
 
  662                                                unlink($chartFileName);
 
  681                if (is_null($this->_phpExcel)) {
 
  686                $css = $this->
buildCSS($generateSurroundingHTML);
 
  692                if ($generateSurroundingHTML) {
 
  698                foreach ($css as $styleName => $styleDefinition) {
 
  699                        if ($styleName != 
'html') {
 
  705                if ($generateSurroundingHTML) {
 
  720        public function buildCSS($generateSurroundingHTML = 
true) {
 
  722                if (is_null($this->_phpExcel)) {
 
  727                if (!is_null($this->_cssStyles)) {
 
  732                if (!$this->_spansAreCalculated) {
 
  740                if ($generateSurroundingHTML) {
 
  742                        $css[
'html'][
'font-family']       = 
'Calibri, Arial, Helvetica, sans-serif';
 
  743                        $css[
'html'][
'font-size']               = 
'11pt';
 
  744                        $css[
'html'][
'background-color'] = 
'white';
 
  749                $css[
'table'][
'border-collapse']  = 
'collapse';
 
  750            if (!$this->_isPdf) {
 
  751                        $css[
'table'][
'page-break-after'] = 
'always';
 
  755                $css[
'.gridlines td'][
'border'] = 
'1px dotted black';
 
  756                $css[
'.gridlines th'][
'border'] = 
'1px dotted black';
 
  759                $css[
'.b'][
'text-align'] = 
'center'; 
 
  762                $css[
'.e'][
'text-align'] = 
'center'; 
 
  765                $css[
'.f'][
'text-align'] = 
'right'; 
 
  768                $css[
'.inlineStr'][
'text-align'] = 
'left'; 
 
  771                $css[
'.n'][
'text-align'] = 
'right'; 
 
  774                $css[
'.s'][
'text-align'] = 
'left'; 
 
  777                foreach ($this->_phpExcel->getCellXfCollection() as $index => 
$style) {
 
  784                if (is_null($this->_sheetIndex)) {
 
  785                        $sheets = $this->_phpExcel->getAllSheets();
 
  787                        $sheets[] = $this->_phpExcel->getSheet($this->_sheetIndex);
 
  791                foreach ($sheets as $sheet) {
 
  793                        $sheetIndex = $sheet->getParent()->getIndex($sheet);
 
  797                        $sheet->calculateColumnWidths();
 
  802                        while(
$column++ < $highestColumnIndex) {
 
  803                                $this->_columnWidths[$sheetIndex][
$column] = 42; 
 
  804                                $css[
'table.sheet' . $sheetIndex . 
' col.col' . 
$column][
'width'] = 
'42pt';
 
  808                        foreach ($sheet->getColumnDimensions() as $columnDimension) {
 
  812                                        $this->_columnWidths[$sheetIndex][
$column] = $width;
 
  813                                        $css[
'table.sheet' . $sheetIndex . 
' col.col' . 
$column][
'width'] = $width . 
'pt';
 
  815                                        if ($columnDimension->getVisible() === 
false) {
 
  816                                                $css[
'table.sheet' . $sheetIndex . 
' col.col' . 
$column][
'visibility'] = 
'collapse';
 
  817                                                $css[
'table.sheet' . $sheetIndex . 
' col.col' . 
$column][
'*display'] = 
'none'; 
 
  823                        $rowDimension = $sheet->getDefaultRowDimension();
 
  826                        $css[
'table.sheet' . $sheetIndex . 
' tr'] = array();
 
  828                        if ($rowDimension->getRowHeight() == -1) {
 
  831                                $pt_height = $rowDimension->getRowHeight();
 
  833                        $css[
'table.sheet' . $sheetIndex . 
' tr'][
'height'] = $pt_height . 
'pt';
 
  834                        if ($rowDimension->getVisible() === 
false) {
 
  835                                $css[
'table.sheet' . $sheetIndex . 
' tr'][
'display']    = 
'none';
 
  836                                $css[
'table.sheet' . $sheetIndex . 
' tr'][
'visibility'] = 
'hidden';
 
  840                        foreach ($sheet->getRowDimensions() as $rowDimension) {
 
  841                                $row = $rowDimension->getRowIndex() - 1;
 
  844                                $css[
'table.sheet' . $sheetIndex . 
' tr.row' . 
$row] = array();
 
  846                                if ($rowDimension->getRowHeight() == -1) {
 
  849                                        $pt_height = $rowDimension->getRowHeight();
 
  851                                $css[
'table.sheet' . $sheetIndex . 
' tr.row' . 
$row][
'height'] = $pt_height . 
'pt';
 
  852                                if ($rowDimension->getVisible() === 
false) {
 
  853                                        $css[
'table.sheet' . $sheetIndex . 
' tr.row' . 
$row][
'display'] = 
'none';
 
  854                                        $css[
'table.sheet' . $sheetIndex . 
' tr.row' . 
$row][
'visibility'] = 
'hidden';
 
  860                if (is_null($this->_cssStyles)) {
 
  861                        $this->_cssStyles = $css;
 
  881                        , $this->_createCSSStyleBorders($pStyle->
getBorders())
 
  882                        , $this->_createCSSStyleFont($pStyle->
getFont())
 
  883                        , $this->_createCSSStyleFill($pStyle->
getFill())
 
  903                        $css[
'text-align'] = $textAlign;
 
  904                        if(in_array($textAlign,array(
'left',
'right')))
 
  905                                $css[
'padding-'.$textAlign] = (string)((
int)$pStyle->
getIndent() * 9).
'px';
 
  924                        $css[
'font-weight'] = 
'bold';
 
  927                        $css[
'text-decoration'] = 
'underline line-through';
 
  929                        $css[
'text-decoration'] = 
'underline';
 
  931                        $css[
'text-decoration'] = 
'line-through';
 
  934                        $css[
'font-style'] = 
'italic';
 
  937                $css[
'color']           = 
'#' . $pStyle->
getColor()->getRGB();
 
  938                $css[
'font-family']     = 
'\'' . $pStyle->
getName() . 
'\'';
 
  939                $css[
'font-size']       = $pStyle->
getSize() . 
'pt';
 
  976                $css = $borderStyle . 
' #' . $pStyle->
getColor()->getRGB() . (($borderStyle == 
'none') ? 
'' : 
' !important'); 
 
  995                $css[
'background-color'] = $value;
 
 1022                $sheetIndex = $pSheet->getParent()->getIndex($pSheet);
 
 1028                if (!$this->_useInlineCss) {
 
 1029                        $gridlines = $pSheet->getShowGridlines() ? 
' gridlines' : 
'';
 
 1030                        $html .= 
'      <table border="0" cellpadding="0" cellspacing="0" id="sheet' . $sheetIndex . 
'" class="sheet' . $sheetIndex . $gridlines . 
'">' . 
PHP_EOL;
 
 1032                        $style = isset($this->_cssStyles[
'table']) ?
 
 1035                        if ($this->_isPdf && $pSheet->getShowGridlines()) {
 
 1036                                $html .= 
'      <table border="1" cellpadding="1" id="sheet' . $sheetIndex . 
'" cellspacing="1" style="' . 
$style . 
'">' . 
PHP_EOL;
 
 1038                                $html .= 
'      <table border="0" cellpadding="1" id="sheet' . $sheetIndex . 
'" cellspacing="0" style="' . 
$style . 
'">' . 
PHP_EOL;
 
 1045                while($i++ < $highestColumnIndex) {
 
 1046                    if (!$this->_isPdf) {
 
 1047                                if (!$this->_useInlineCss) {
 
 1050                                        $style = isset($this->_cssStyles[
'table.sheet' . $sheetIndex . 
' col.col' . $i]) ?
 
 1051                                                $this->
_assembleCSS($this->_cssStyles[
'table.sheet' . $sheetIndex . 
' col.col' . $i]) : 
'';
 
 1085                if (is_array($pValues)) {
 
 1090                        $sheetIndex = $pSheet->
getParent()->getIndex($pSheet);
 
 1093                        if ($this->_isPdf && count($pSheet->
getBreaks()) > 0) {
 
 1097                                if (isset($breaks[
'A' . $pRow])) {
 
 1102                                        $html .= 
'<div style="page-break-before:always" />';
 
 1110                        if (!$this->_useInlineCss) {
 
 1113                                $style = isset($this->_cssStyles[
'table.sheet' . $sheetIndex . 
' tr.row' . $pRow])
 
 1114                                        ? $this->
_assembleCSS($this->_cssStyles[
'table.sheet' . $sheetIndex . 
' tr.row' . $pRow]) : 
'';
 
 1121                        foreach ($pValues as $cellAddress) {
 
 1122                $cell = ($cellAddress > 
'') ? $pSheet->
getCell($cellAddress) : 
'';
 
 1124                                if (!$this->_useInlineCss) {
 
 1126                                        $cssClass = 
'column' . $colNum;
 
 1128                                        $cssClass = array();
 
 1129                    if ($cellType == 
'th') {
 
 1130                        if (isset($this->_cssStyles[
'table.sheet' . $sheetIndex . 
' th.column' . $colNum])) {
 
 1131                            $this->_cssStyles[
'table.sheet' . $sheetIndex . 
' th.column' . $colNum];
 
 1134                        if (isset($this->_cssStyles[
'table.sheet' . $sheetIndex . 
' td.column' . $colNum])) {
 
 1135                            $this->_cssStyles[
'table.sheet' . $sheetIndex . 
' td.column' . $colNum];
 
 1143                                $cellData = 
' ';
 
 1148                                        if (is_null($cell->getParent())) {
 
 1149                                                $cell->attach($pSheet);
 
 1154                                                $elements = $cell->getValue()->getRichTextElements();
 
 1155                                                foreach ($elements as $element) {
 
 1160                                                                if ($element->getFont()->getSuperScript()) {
 
 1161                                                                        $cellData .= 
'<sup>';
 
 1162                                                                } 
else if ($element->getFont()->getSubScript()) {
 
 1163                                                                        $cellData .= 
'<sub>';
 
 1168                                                        $cellText = $element->getText();
 
 1169                                                        $cellData .= htmlspecialchars($cellText);
 
 1172                                                                if ($element->getFont()->getSuperScript()) {
 
 1173                                                                        $cellData .= 
'</sup>';
 
 1174                                                                } 
else if ($element->getFont()->getSubScript()) {
 
 1175                                                                        $cellData .= 
'</sub>';
 
 1178                                                                $cellData .= 
'</span>';
 
 1182                                                if ($this->_preCalculateFormulas) {
 
 1184                                                                $cell->getCalculatedValue(),
 
 1185                                                                $pSheet->
getParent()->getCellXfByIndex( $cell->getXfIndex() )->getNumberFormat()->getFormatCode(),
 
 1186                                                                array($this, 
'formatColor')
 
 1191                                                                $pSheet->
getParent()->getCellXfByIndex( $cell->getXfIndex() )->getNumberFormat()->getFormatCode(),
 
 1192                                                                array($this, 
'formatColor')
 
 1195                                                $cellData = htmlspecialchars($cellData);
 
 1196                                                if ($pSheet->
getParent()->getCellXfByIndex( $cell->getXfIndex() )->getFont()->getSuperScript()) {
 
 1197                                                        $cellData = 
'<sup>'.$cellData.
'</sup>';
 
 1198                                                } elseif ($pSheet->
getParent()->getCellXfByIndex( $cell->getXfIndex() )->getFont()->getSubScript()) {
 
 1199                                                        $cellData = 
'<sub>'.$cellData.
'</sub>';
 
 1205                                        $cellData = preg_replace(
"/(?m)(?:^|\\G) /", 
' ', $cellData);
 
 1208                                        $cellData = nl2br($cellData);
 
 1211                                        if (!$this->_useInlineCss) {
 
 1212                                                $cssClass .= 
' style' . $cell->getXfIndex();
 
 1213                                                $cssClass .= 
' ' . $cell->getDataType();
 
 1215                        if ($cellType == 
'th') {
 
 1216                            if (isset($this->_cssStyles[
'th.style' . $cell->getXfIndex()])) {
 
 1217                                $cssClass = array_merge($cssClass, $this->_cssStyles[
'th.style' . $cell->getXfIndex()]);
 
 1220                            if (isset($this->_cssStyles[
'td.style' . $cell->getXfIndex()])) {
 
 1221                                $cssClass = array_merge($cssClass, $this->_cssStyles[
'td.style' . $cell->getXfIndex()]);
 
 1226                                                $sharedStyle = $pSheet->
getParent()->getCellXfByIndex( $cell->getXfIndex() );
 
 1228                                                        && isset($this->_cssStyles[
'.' . $cell->getDataType()][
'text-align']))
 
 1230                                                        $cssClass[
'text-align'] = $this->_cssStyles[
'.' . $cell->getDataType()][
'text-align'];
 
 1237                                        $cellData = 
'<a href="' . htmlspecialchars($pSheet->
getHyperlink($coordinate)->getUrl()) . 
'" title="' . htmlspecialchars($pSheet->
getHyperlink($coordinate)->getTooltip()) . 
'">' . $cellData . 
'</a>';
 
 1241                                $writeCell = ! ( isset($this->_isSpannedCell[$pSheet->
getParent()->getIndex($pSheet)][$pRow + 1][$colNum])
 
 1242                                                        && $this->_isSpannedCell[$pSheet->
getParent()->getIndex($pSheet)][$pRow + 1][$colNum] );
 
 1247                                if (isset($this->_isBaseCell[$pSheet->
getParent()->getIndex($pSheet)][$pRow + 1][$colNum])) {
 
 1248                                        $spans = $this->_isBaseCell[$pSheet->
getParent()->getIndex($pSheet)][$pRow + 1][$colNum];
 
 1249                                        $rowSpan = $spans[
'rowspan'];
 
 1250                                        $colSpan = $spans[
'colspan'];
 
 1255                                        if (!$this->_useInlineCss) {
 
 1256                                                $cssClass .= 
' style' . $pSheet->
getCell($endCellCoord)->getXfIndex();
 
 1263                                        $html .= 
'                      <' . $cellType;
 
 1264                                                if (!$this->_useInlineCss) {
 
 1265                                                        $html .= 
' class="' . $cssClass . 
'"';
 
 1272                                                        $e = $colNum + $colSpan - 1;
 
 1274                                                                if (isset($this->_columnWidths[$sheetIndex][$i])) {
 
 1275                                                                        $width += $this->_columnWidths[$sheetIndex][$i];
 
 1278                                                        $cssClass[
'width'] = $width . 
'pt';
 
 1282                                                        if (isset($this->_cssStyles[
'table.sheet' . $sheetIndex . 
' tr.row' . $pRow][
'height'])) {
 
 1283                                                                $height = $this->_cssStyles[
'table.sheet' . $sheetIndex . 
' tr.row' . $pRow][
'height'];
 
 1284                                                                $cssClass[
'height'] = $height;
 
 1291                                                        $html .= 
' colspan="' . $colSpan . 
'"';
 
 1294                                                        $html .= 
' rowspan="' . $rowSpan . 
'"';
 
 1302                                        if ($this->_includeCharts) {
 
 1336                foreach ($pValue as $property => $value) {
 
 1337                        $pairs[] = $property . 
':' . $value;
 
 1339                $string = implode(
'; ', $pairs);
 
 1360                $this->_imagesRoot = $pValue;
 
 1380                $this->_embedImages = $pValue;
 
 1400                $this->_useInlineCss = $pValue;
 
 1417                $color_regex = 
'/^\\[[a-zA-Z]+\\]/';
 
 1418                if (preg_match($color_regex, $pFormat, $matches)) {
 
 1419                        $color = str_replace(
'[', 
'', $matches[0]);
 
 1420                        $color = str_replace(
']', 
'', $color);
 
 1421                        $color = strtolower($color);
 
 1425                $value = htmlspecialchars($pValue);
 
 1428                if ($color !== 
null) {
 
 1429                        $value = 
'<span style="color:' . $color . 
'">' . $value . 
'</span>';
 
 1443                $sheetIndexes = $this->_sheetIndex !== 
null ?
 
 1444                        array($this->_sheetIndex) : range(0, $this->_phpExcel->getSheetCount() - 1);
 
 1446                foreach ($sheetIndexes as $sheetIndex) {
 
 1447                        $sheet = $this->_phpExcel->getSheet($sheetIndex);
 
 1449                        $candidateSpannedRow  = array();
 
 1452                        foreach ($sheet->getMergeCells() as $cells) {
 
 1467                                        $candidateSpannedRow[
$r] = 
$r;
 
 1471                                                if ( !($c == $fc && 
$r == $fr) ) {
 
 1473                                                        $this->_isSpannedCell[$sheetIndex][
$r][$c] = array(
 
 1474                                                                'baseCell' => array($fr, $fc),
 
 1478                                                        $this->_isBaseCell[$sheetIndex][
$r][$c] = array(
 
 1479                                                                'xlrowspan' => $lr - $fr + 1, 
 
 1480                                                                'rowspan'   => $lr - $fr + 1, 
 
 1481                                                                'xlcolspan' => $lc - $fc + 1, 
 
 1482                                                                'colspan'   => $lc - $fc + 1, 
 
 1492                        foreach ($candidateSpannedRow as $rowIndex) {
 
 1493                                if (isset($this->_isSpannedCell[$sheetIndex][$rowIndex])) {
 
 1494                                        if (count($this->_isSpannedCell[$sheetIndex][$rowIndex]) == $countColumns) {
 
 1495                                                $this->_isSpannedRow[$sheetIndex][$rowIndex] = $rowIndex;
 
 1501                        if ( isset($this->_isSpannedRow[$sheetIndex]) ) {
 
 1502                                foreach ($this->_isSpannedRow[$sheetIndex] as $rowIndex) {
 
 1503                                        $adjustedBaseCells = array();
 
 1505                                        $e = $countColumns - 1;
 
 1507                                                $baseCell = $this->_isSpannedCell[$sheetIndex][$rowIndex][$c][
'baseCell'];
 
 1509                                                if ( !in_array($baseCell, $adjustedBaseCells) ) {
 
 1511                                                        --$this->_isBaseCell[$sheetIndex][ $baseCell[0] ][ $baseCell[1] ][
'rowspan'];
 
 1512                                                        $adjustedBaseCells[] = $baseCell;
 
 1522                $this->_spansAreCalculated = 
true;
 
 1526                $htmlPage = 
'@page { ';
 
 1527                $htmlBody = 
'body { ';
 
 1530                $htmlPage .= 
'left-margin: ' . $left;
 
 1531                $htmlBody .= 
'left-margin: ' . $left;
 
 1533                $htmlPage .= 
'right-margin: ' . $right;
 
 1534                $htmlBody .= 
'right-margin: ' . $right;
 
 1536                $htmlPage .= 
'top-margin: ' . $top;
 
 1537                $htmlBody .= 
'top-margin: ' . $top;
 
 1539                $htmlPage .= 
'bottom-margin: ' . $bottom;
 
 1540                $htmlBody .= 
'bottom-margin: ' . $bottom;
 
 1545                return "<style>\n" . $htmlPage . $htmlBody . 
"</style>\n";
 
An exception for terminatinating execution or to throw for unit testing.
static getInstance(PHPExcel $workbook=NULL)
Get an instance of this class.
const RETURN_ARRAY_AS_VALUE
static getArrayReturnType()
Return the Array Return Type (Array or Value of first element in the array)
static setArrayReturnType($returnType)
Set the Array Return Type (Array or Value of first element in the array)
static stringFromColumnIndex($pColumnIndex=0)
String from columnindex.
static coordinateFromString($pCoordinateString='A1')
Coordinate from string.
static splitRange($pRange='A1:A1')
Split range into coordinate strings.
static columnIndexFromString($pString='A')
Column index from string.
static cellDimensionToPixels($pValue=0, PHPExcel_Style_Font $pDefaultFont)
Convert column width from (intrinsic) Excel units to pixels.
static pixelsToPoints($pValue=0)
Convert pixels to points.
static sys_get_temp_dir()
Get the systems temporary directory.
static getDefaultRowHeightByFont(PHPExcel_Style_Font $font)
Get the effective row height for rows without a row dimension or rows with height -1 For example,...
static FormatNumber($value)
Formats a numeric value as a string for output in various output writers forcing point as decimal sep...
getHorizontal()
Get Horizontal.
getVertical()
Get Vertical.
const HORIZONTAL_CENTER_CONTINUOUS
const BORDER_MEDIUMDASHDOTDOT
const BORDER_MEDIUMDASHED
getBorderStyle()
Get Border style.
const BORDER_SLANTDASHDOT
const BORDER_MEDIUMDASHDOT
getColor()
Get Border Color.
getStartColor()
Get Start Color.
getFillType()
Get Fill Type.
getUnderline()
Get Underline.
getStrikethrough()
Get Strikethrough.
getAlignment()
Get Alignment.
getCell($pCoordinate='A1')
Get cell at a specific coordinate.
getPageMargins()
Get page margins.
getHyperlink($pCellCoordinate='A1')
Get hyperlink.
getChartCollection()
Get collection of charts.
getDrawingCollection()
Get collection of drawings.
hyperlinkExists($pCoordinate='A1')
Hyperlink at a specific coordinate exists?
_generateRow(PHPExcel_Worksheet $pSheet, $pValues=null, $pRow=0, $cellType='td')
Generate row.
getUseInlineCss()
Get use inline CSS?
_generateTableFooter()
Generate table footer.
writeAllSheets()
Write all sheets (resets sheetIndex to NULL)
_mapHAlign($hAlign)
Map HAlign.
formatColor($pValue, $pFormat)
Add color to formatted string as inline style.
_createCSSStyleBorders(PHPExcel_Style_Borders $pStyle)
Create CSS style (PHPExcel_Style_Borders)
setUseInlineCss($pValue=false)
Set use inline CSS?
setEmbedImages($pValue='.')
Set embed images.
_mapBorderStyle($borderStyle)
Map border style.
_extendRowsForChartsAndImages(PHPExcel_Worksheet $pSheet, $row)
__construct(PHPExcel $phpExcel)
Create a new PHPExcel_Writer_HTML.
setGenerateSheetNavigationBlock($pValue=true)
Set sheet index.
setImagesRoot($pValue='.')
Set images root.
_generateTableHeader($pSheet)
Generate table header.
_createCSSStyleAlignment(PHPExcel_Style_Alignment $pStyle)
Create CSS style (PHPExcel_Style_Alignment)
buildCSS($generateSurroundingHTML=true)
Build CSS styles.
_mapVAlign($vAlign)
Map VAlign.
getImagesRoot()
Get images root.
_assembleCSS($pValue=array())
Takes array where of CSS properties / values and converts to CSS string.
generateHTMLFooter()
Generate HTML footer.
_calculateSpans()
Calculate information about HTML colspan and rowspan which is not always the same as Excel's.
_writeChartInCell(PHPExcel_Worksheet $pSheet, $coordinates)
Generate chart tag in cell.
_createCSSStyleFont(PHPExcel_Style_Font $pStyle)
Create CSS style (PHPExcel_Style_Font)
_setMargins(PHPExcel_Worksheet $pSheet)
setSheetIndex($pValue=0)
Set sheet index.
_writeImageInCell(PHPExcel_Worksheet $pSheet, $coordinates)
Generate image tag in cell.
_createCSSStyle(PHPExcel_Style $pStyle)
Create CSS style.
generateNavigation()
Generate sheet tabs.
$_generateSheetNavigationBlock
getSheetIndex()
Get sheet index.
generateHTMLHeader($pIncludeStyles=false)
Generate HTML header.
_createCSSStyleFill(PHPExcel_Style_Fill $pStyle)
Create CSS style (PHPExcel_Style_Fill)
_createCSSStyleBorder(PHPExcel_Style_Border $pStyle)
Create CSS style (PHPExcel_Style_Border)
getEmbedImages()
Get embed images.
generateStyles($generateSurroundingHTML=true)
Generate CSS styles.
generateSheetData()
Generate sheet data.
save($pFilename=null)
Save PHPExcel to file.
getGenerateSheetNavigationBlock()
Get sheet index.
getDefaultStyle()
Get default style.