diff --git a/Classes/PHPExcel/Writer/Excel5/Xf.php b/Classes/PHPExcel/Writer/Excel5/Xf.php index 7347aabb..6d953f81 100644 --- a/Classes/PHPExcel/Writer/Excel5/Xf.php +++ b/Classes/PHPExcel/Writer/Excel5/Xf.php @@ -166,7 +166,7 @@ class PHPExcel_Writer_Excel5_Xf * * @return string The XF record */ - function writeXf() + public function writeXf() { // Set the type of the XF record and some of the attributes. if ($this->_isStyleXf) { @@ -249,18 +249,14 @@ class PHPExcel_Writer_Excel5_Xf $border2 |= self::_mapBorderStyle($this->_style->getBorders()->getDiagonal()->getBorderStyle()) << 21; $border2 |= self::_mapFillType($this->_style->getFill()->getFillType()) << 26; - $header = pack("vv", $record, $length); + $header = pack("vv", $record, $length); //BIFF8 options: identation, shrinkToFit and text direction $biff8_options = $this->_style->getAlignment()->getIndent(); $biff8_options |= (int) $this->_style->getAlignment()->getShrinkToFit() << 4; $data = pack("vvvC", $ifnt, $ifmt, $style, $align); - $data .= pack("CCC" - , self::_mapTextRotation($this->_style->getAlignment()->getTextRotation()) - , $biff8_options - , $used_attrib - ); + $data .= pack("CCC", self::_mapTextRotation($this->_style->getAlignment()->getTextRotation()), $biff8_options, $used_attrib); $data .= pack("VVv", $border1, $border2, $icv); return($header . $data); @@ -282,7 +278,7 @@ class PHPExcel_Writer_Excel5_Xf * @access public * @param int $colorIndex Color index */ - function setBottomColor($colorIndex) + public function setBottomColor($colorIndex) { $this->_bottom_color = $colorIndex; } @@ -293,7 +289,7 @@ class PHPExcel_Writer_Excel5_Xf * @access public * @param int $colorIndex Color index */ - function setTopColor($colorIndex) + public function setTopColor($colorIndex) { $this->_top_color = $colorIndex; } @@ -304,7 +300,7 @@ class PHPExcel_Writer_Excel5_Xf * @access public * @param int $colorIndex Color index */ - function setLeftColor($colorIndex) + public function setLeftColor($colorIndex) { $this->_left_color = $colorIndex; } @@ -315,7 +311,7 @@ class PHPExcel_Writer_Excel5_Xf * @access public * @param int $colorIndex Color index */ - function setRightColor($colorIndex) + public function setRightColor($colorIndex) { $this->_right_color = $colorIndex; } @@ -326,7 +322,7 @@ class PHPExcel_Writer_Excel5_Xf * @access public * @param int $colorIndex Color index */ - function setDiagColor($colorIndex) + public function setDiagColor($colorIndex) { $this->_diag_color = $colorIndex; } @@ -338,7 +334,7 @@ class PHPExcel_Writer_Excel5_Xf * @access public * @param int $colorIndex Color index */ - function setFgColor($colorIndex) + public function setFgColor($colorIndex) { $this->_fg_color = $colorIndex; } @@ -349,7 +345,7 @@ class PHPExcel_Writer_Excel5_Xf * @access public * @param int $colorIndex Color index */ - function setBgColor($colorIndex) + public function setBgColor($colorIndex) { $this->_bg_color = $colorIndex; } @@ -361,7 +357,7 @@ class PHPExcel_Writer_Excel5_Xf * @access public * @param integer $numberFormatIndex Index to format record */ - function setNumberFormatIndex($numberFormatIndex) + public function setNumberFormatIndex($numberFormatIndex) { $this->_numberFormatIndex = $numberFormatIndex; } @@ -403,9 +399,11 @@ class PHPExcel_Writer_Excel5_Xf * @param string $borderStyle * @return int */ - private static function _mapBorderStyle($borderStyle) { - if (isset(self::$_mapBorderStyle[$borderStyle])) + private static function _mapBorderStyle($borderStyle) + { + if (isset(self::$_mapBorderStyle[$borderStyle])) { return self::$_mapBorderStyle[$borderStyle]; + } return 0x00; } @@ -442,9 +440,11 @@ class PHPExcel_Writer_Excel5_Xf * @param string $fillType * @return int */ - private static function _mapFillType($fillType) { - if (isset(self::$_mapFillType[$fillType])) + private static function _mapFillType($fillType) + { + if (isset(self::$_mapFillType[$fillType])) { return self::$_mapFillType[$fillType]; + } return 0x00; } @@ -469,8 +469,9 @@ class PHPExcel_Writer_Excel5_Xf */ private function _mapHAlign($hAlign) { - if (isset(self::$_mapHAlign[$hAlign])) + if (isset(self::$_mapHAlign[$hAlign])) { return self::$_mapHAlign[$hAlign]; + } return 0; } @@ -491,8 +492,9 @@ class PHPExcel_Writer_Excel5_Xf * @return int */ private static function _mapVAlign($vAlign) { - if (isset(self::$_mapVAlign[$vAlign])) + if (isset(self::$_mapVAlign[$vAlign])) { return self::$_mapVAlign[$vAlign]; + } return 2; } @@ -522,10 +524,14 @@ class PHPExcel_Writer_Excel5_Xf */ private static function _mapLocked($locked) { switch ($locked) { - case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 1; - case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1; - case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0; - default: return 1; + case PHPExcel_Style_Protection::PROTECTION_INHERIT: + return 1; + case PHPExcel_Style_Protection::PROTECTION_PROTECTED: + return 1; + case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: + return 0; + default: + return 1; } } @@ -537,11 +543,14 @@ class PHPExcel_Writer_Excel5_Xf */ private static function _mapHidden($hidden) { switch ($hidden) { - case PHPExcel_Style_Protection::PROTECTION_INHERIT: return 0; - case PHPExcel_Style_Protection::PROTECTION_PROTECTED: return 1; - case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: return 0; - default: return 0; + case PHPExcel_Style_Protection::PROTECTION_INHERIT: + return 0; + case PHPExcel_Style_Protection::PROTECTION_PROTECTED: + return 1; + case PHPExcel_Style_Protection::PROTECTION_UNPROTECTED: + return 0; + default: + return 0; } } - } diff --git a/Classes/PHPExcel/Writer/HTML.php b/Classes/PHPExcel/Writer/HTML.php index 99a68630..4821cf06 100644 --- a/Classes/PHPExcel/Writer/HTML.php +++ b/Classes/PHPExcel/Writer/HTML.php @@ -944,7 +944,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ $css['vertical-align'] = $this->_mapVAlign($pStyle->getVertical()); if ($textAlign = $this->_mapHAlign($pStyle->getHorizontal())) { $css['text-align'] = $textAlign; - if (in_array($textAlign,array('left','right'))) { + if (in_array($textAlign,array('left', 'right'))) { $css['padding-'.$textAlign] = (string)((int)$pStyle->getIndent() * 9).'px'; } } @@ -1015,7 +1015,7 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ { // Create CSS // $css = $this->_mapBorderStyle($pStyle->getBorderStyle()) . ' #' . $pStyle->getColor()->getRGB(); - // Create CSS - add !important to non-none border styles for merged cells + // Create CSS - add !important to non-none border styles for merged cells $borderStyle = $this->_mapBorderStyle($pStyle->getBorderStyle()); $css = $borderStyle . ' #' . $pStyle->getColor()->getRGB() . (($borderStyle == 'none') ? '' : ' !important'); @@ -1265,10 +1265,9 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ } // General horizontal alignment: Actual horizontal alignment depends on dataType - $sharedStyle = $pSheet->getParent()->getCellXfByIndex( $cell->getXfIndex() ); + $sharedStyle = $pSheet->getParent()->getCellXfByIndex($cell->getXfIndex()); if ($sharedStyle->getAlignment()->getHorizontal() == PHPExcel_Style_Alignment::HORIZONTAL_GENERAL - && isset($this->_cssStyles['.' . $cell->getDataType()]['text-align'])) - { + && isset($this->_cssStyles['.' . $cell->getDataType()]['text-align'])) { $cssClass['text-align'] = $this->_cssStyles['.' . $cell->getDataType()]['text-align']; } } @@ -1303,39 +1302,39 @@ class PHPExcel_Writer_HTML extends PHPExcel_Writer_Abstract implements PHPExcel_ if ($writeCell) { // Column start $html .= ' <' . $cellType; - if (!$this->_useInlineCss) { - $html .= ' class="' . $cssClass . '"'; - } else { - //** Necessary redundant code for the sake of PHPExcel_Writer_PDF ** - // We must explicitly write the width of the