mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-22 05:16:06 +03:00
Bugfix: Work items 15905 and 18183
Allow "no impact" to formats on Conditional Formatting
This commit is contained in:
parent
6710c8a136
commit
b7acf2bbe4
@ -689,16 +689,17 @@ class PHPExcel_Reader_Excel2007 implements PHPExcel_Reader_IReader
|
||||
|
||||
$dxfs = array();
|
||||
if (!$this->_readDataOnly && $xmlStyles) {
|
||||
// Conditional Styles
|
||||
if ($xmlStyles->dxfs) {
|
||||
foreach ($xmlStyles->dxfs->dxf as $dxf) {
|
||||
$style = new PHPExcel_Style;
|
||||
$style = new PHPExcel_Style(FALSE, TRUE);
|
||||
self::_readStyle($style, $dxf);
|
||||
$dxfs[] = $style;
|
||||
}
|
||||
}
|
||||
|
||||
if ($xmlStyles->cellStyles)
|
||||
{
|
||||
// Cell Styles
|
||||
if ($xmlStyles->cellStyles) {
|
||||
foreach ($xmlStyles->cellStyles->cellStyle as $cellStyle) {
|
||||
if (intval($cellStyle['builtinId']) == 0) {
|
||||
if (isset($cellStyles[intval($cellStyle['xfId'])])) {
|
||||
|
@ -108,21 +108,26 @@ class PHPExcel_Style implements PHPExcel_IComparable
|
||||
/**
|
||||
* Create a new PHPExcel_Style
|
||||
*
|
||||
* @param boolean $isSupervisor
|
||||
* @param boolean $isSupervisor Flag indicating if this is a supervisor or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
* @param boolean $isConditional Flag indicating if this is a conditional style or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($isSupervisor = false)
|
||||
public function __construct($isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
$this->_isSupervisor = $isSupervisor;
|
||||
|
||||
// Initialise values
|
||||
$this->_conditionalStyles = array();
|
||||
$this->_font = new PHPExcel_Style_Font($isSupervisor);
|
||||
$this->_fill = new PHPExcel_Style_Fill($isSupervisor);
|
||||
$this->_borders = new PHPExcel_Style_Borders($isSupervisor);
|
||||
$this->_alignment = new PHPExcel_Style_Alignment($isSupervisor);
|
||||
$this->_numberFormat = new PHPExcel_Style_NumberFormat($isSupervisor);
|
||||
$this->_protection = new PHPExcel_Style_Protection($isSupervisor);
|
||||
$this->_font = new PHPExcel_Style_Font($isSupervisor, $isConditional);
|
||||
$this->_fill = new PHPExcel_Style_Fill($isSupervisor, $isConditional);
|
||||
$this->_borders = new PHPExcel_Style_Borders($isSupervisor, $isConditional);
|
||||
$this->_alignment = new PHPExcel_Style_Alignment($isSupervisor, $isConditional);
|
||||
$this->_numberFormat = new PHPExcel_Style_NumberFormat($isSupervisor, $isConditional);
|
||||
$this->_protection = new PHPExcel_Style_Protection($isSupervisor, $isConditional);
|
||||
|
||||
// bind parent if we are a supervisor
|
||||
if ($isSupervisor) {
|
||||
|
@ -116,11 +116,22 @@ class PHPExcel_Style_Alignment implements PHPExcel_IComparable
|
||||
* Create a new PHPExcel_Style_Alignment
|
||||
*
|
||||
* @param boolean $isSupervisor Flag indicating if this is a supervisor or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
* @param boolean $isConditional Flag indicating if this is a conditional style or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($isSupervisor = false)
|
||||
public function __construct($isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
$this->_isSupervisor = $isSupervisor;
|
||||
|
||||
if ($isConditional) {
|
||||
$this->_horizontal = NULL;
|
||||
$this->_vertical = NULL;
|
||||
$this->_textRotation = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -90,14 +90,19 @@ class PHPExcel_Style_Border implements PHPExcel_IComparable
|
||||
* Create a new PHPExcel_Style_Border
|
||||
*
|
||||
* @param boolean $isSupervisor Flag indicating if this is a supervisor or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
* @param boolean $isConditional Flag indicating if this is a conditional style or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($isSupervisor = false)
|
||||
public function __construct($isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
$this->_isSupervisor = $isSupervisor;
|
||||
|
||||
// Initialise values
|
||||
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor);
|
||||
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor);
|
||||
|
||||
// bind parent if we are a supervisor
|
||||
if ($isSupervisor) {
|
||||
|
@ -143,18 +143,23 @@ class PHPExcel_Style_Borders implements PHPExcel_IComparable
|
||||
* Create a new PHPExcel_Style_Borders
|
||||
*
|
||||
* @param boolean $isSupervisor Flag indicating if this is a supervisor or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
* @param boolean $isConditional Flag indicating if this is a conditional style or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($isSupervisor = false)
|
||||
public function __construct($isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
$this->_isSupervisor = $isSupervisor;
|
||||
|
||||
// Initialise values
|
||||
$this->_left = new PHPExcel_Style_Border($isSupervisor);
|
||||
$this->_right = new PHPExcel_Style_Border($isSupervisor);
|
||||
$this->_top = new PHPExcel_Style_Border($isSupervisor);
|
||||
$this->_bottom = new PHPExcel_Style_Border($isSupervisor);
|
||||
$this->_diagonal = new PHPExcel_Style_Border($isSupervisor);
|
||||
$this->_left = new PHPExcel_Style_Border($isSupervisor, $isConditional);
|
||||
$this->_right = new PHPExcel_Style_Border($isSupervisor, $isConditional);
|
||||
$this->_top = new PHPExcel_Style_Border($isSupervisor, $isConditional);
|
||||
$this->_bottom = new PHPExcel_Style_Border($isSupervisor, $isConditional);
|
||||
$this->_diagonal = new PHPExcel_Style_Border($isSupervisor, $isConditional);
|
||||
$this->_diagonalDirection = PHPExcel_Style_Borders::DIAGONAL_NONE;
|
||||
|
||||
// Specially for supervisor
|
||||
|
@ -59,7 +59,7 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_argb;
|
||||
private $_argb = NULL;
|
||||
|
||||
/**
|
||||
* Supervisor?
|
||||
@ -88,14 +88,21 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable
|
||||
*
|
||||
* @param string $pARGB ARGB value for the colour
|
||||
* @param boolean $isSupervisor Flag indicating if this is a supervisor or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
* @param boolean $isConditional Flag indicating if this is a conditional style or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($pARGB = PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor = false)
|
||||
public function __construct($pARGB = PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
$this->_isSupervisor = $isSupervisor;
|
||||
|
||||
// Initialise values
|
||||
$this->_argb = $pARGB;
|
||||
if (!$isConditional) {
|
||||
$this->_argb = $pARGB;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -131,17 +138,12 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable
|
||||
public function getSharedComponent()
|
||||
{
|
||||
switch ($this->_parentPropertyName) {
|
||||
case '_endColor':
|
||||
return $this->_parent->getSharedComponent()->getEndColor();
|
||||
break;
|
||||
|
||||
case '_color':
|
||||
return $this->_parent->getSharedComponent()->getColor();
|
||||
break;
|
||||
|
||||
case '_startColor':
|
||||
return $this->_parent->getSharedComponent()->getStartColor();
|
||||
break;
|
||||
case '_endColor':
|
||||
return $this->_parent->getSharedComponent()->getEndColor(); break;
|
||||
case '_color':
|
||||
return $this->_parent->getSharedComponent()->getColor(); break;
|
||||
case '_startColor':
|
||||
return $this->_parent->getSharedComponent()->getStartColor(); break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,17 +188,15 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable
|
||||
public function getStyleArray($array)
|
||||
{
|
||||
switch ($this->_parentPropertyName) {
|
||||
case '_endColor':
|
||||
$key = 'endcolor';
|
||||
break;
|
||||
|
||||
case '_color':
|
||||
$key = 'color';
|
||||
break;
|
||||
|
||||
case '_startColor':
|
||||
$key = 'startcolor';
|
||||
break;
|
||||
case '_endColor':
|
||||
$key = 'endcolor';
|
||||
break;
|
||||
case '_color':
|
||||
$key = 'color';
|
||||
break;
|
||||
case '_startColor':
|
||||
$key = 'startcolor';
|
||||
break;
|
||||
|
||||
}
|
||||
return $this->_parent->getStyleArray(array($key => $array));
|
||||
|
@ -100,7 +100,7 @@ class PHPExcel_Style_Conditional implements PHPExcel_IComparable
|
||||
$this->_operatorType = PHPExcel_Style_Conditional::OPERATOR_NONE;
|
||||
$this->_text = null;
|
||||
$this->_condition = array();
|
||||
$this->_style = new PHPExcel_Style();
|
||||
$this->_style = new PHPExcel_Style(FALSE, TRUE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -111,15 +111,23 @@ class PHPExcel_Style_Fill implements PHPExcel_IComparable
|
||||
* Create a new PHPExcel_Style_Fill
|
||||
*
|
||||
* @param boolean $isSupervisor Flag indicating if this is a supervisor or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
* @param boolean $isConditional Flag indicating if this is a conditional style or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($isSupervisor = false)
|
||||
public function __construct($isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
$this->_isSupervisor = $isSupervisor;
|
||||
|
||||
// Initialise values
|
||||
$this->_startColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_WHITE, $isSupervisor);
|
||||
$this->_endColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor);
|
||||
if ($isConditional) {
|
||||
$this->_fillType = NULL;
|
||||
}
|
||||
$this->_startColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_WHITE, $isSupervisor, $isConditional);
|
||||
$this->_endColor = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor, $isConditional);
|
||||
|
||||
// bind parent if we are a supervisor
|
||||
if ($isSupervisor) {
|
||||
|
@ -130,15 +130,31 @@ class PHPExcel_Style_Font implements PHPExcel_IComparable
|
||||
* Create a new PHPExcel_Style_Font
|
||||
*
|
||||
* @param boolean $isSupervisor Flag indicating if this is a supervisor or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
* @param boolean $isConditional Flag indicating if this is a conditional style or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($isSupervisor = false)
|
||||
public function __construct($isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
$this->_isSupervisor = $isSupervisor;
|
||||
|
||||
// Initialise values
|
||||
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor);
|
||||
|
||||
if ($isConditional) {
|
||||
$this->_name = NULL;
|
||||
$this->_size = NULL;
|
||||
$this->_bold = NULL;
|
||||
$this->_italic = NULL;
|
||||
$this->_superScript = NULL;
|
||||
$this->_subScript = NULL;
|
||||
$this->_underline = NULL;
|
||||
$this->_strikethrough = NULL;
|
||||
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor, $isConditional);
|
||||
} else {
|
||||
$this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor);
|
||||
}
|
||||
// bind parent if we are a supervisor
|
||||
if ($isSupervisor) {
|
||||
$this->_color->bindParent($this, '_color');
|
||||
|
@ -128,11 +128,20 @@ class PHPExcel_Style_NumberFormat implements PHPExcel_IComparable
|
||||
* Create a new PHPExcel_Style_NumberFormat
|
||||
*
|
||||
* @param boolean $isSupervisor Flag indicating if this is a supervisor or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
* @param boolean $isConditional Flag indicating if this is a conditional style or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($isSupervisor = false)
|
||||
public function __construct($isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
$this->_isSupervisor = $isSupervisor;
|
||||
|
||||
if ($isConditional) {
|
||||
$this->_formatCode = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,15 +79,22 @@ class PHPExcel_Style_Protection implements PHPExcel_IComparable
|
||||
* Create a new PHPExcel_Style_Protection
|
||||
*
|
||||
* @param boolean $isSupervisor Flag indicating if this is a supervisor or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
* @param boolean $isConditional Flag indicating if this is a conditional style or not
|
||||
* Leave this value at default unless you understand exactly what
|
||||
* its ramifications are
|
||||
*/
|
||||
public function __construct($isSupervisor = false)
|
||||
public function __construct($isSupervisor = false, $isConditional = false)
|
||||
{
|
||||
// Supervisor?
|
||||
$this->_isSupervisor = $isSupervisor;
|
||||
|
||||
// Initialise values
|
||||
$this->_locked = self::PROTECTION_INHERIT;
|
||||
$this->_hidden = self::PROTECTION_INHERIT;
|
||||
if (!$isConditional) {
|
||||
$this->_locked = self::PROTECTION_INHERIT;
|
||||
$this->_hidden = self::PROTECTION_INHERIT;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -175,11 +175,11 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
private function _writeFill(PHPExcel_Shared_XMLWriter $objWriter = null, PHPExcel_Style_Fill $pFill = null)
|
||||
{
|
||||
// Check if this is a pattern type or gradient type
|
||||
if ($pFill->getFillType() == PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR
|
||||
|| $pFill->getFillType() == PHPExcel_Style_Fill::FILL_GRADIENT_PATH) {
|
||||
if ($pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_LINEAR ||
|
||||
$pFill->getFillType() === PHPExcel_Style_Fill::FILL_GRADIENT_PATH) {
|
||||
// Gradient fill
|
||||
$this->_writeGradientFill($objWriter, $pFill);
|
||||
} else {
|
||||
} elseif($pFill->getFillType() !== NULL) {
|
||||
// Pattern fill
|
||||
$this->_writePatternFill($objWriter, $pFill);
|
||||
}
|
||||
@ -247,14 +247,18 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
|
||||
if ($pFill->getFillType() !== PHPExcel_Style_Fill::FILL_NONE) {
|
||||
// fgColor
|
||||
$objWriter->startElement('fgColor');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
if ($pFill->getStartColor()->getARGB()) {
|
||||
$objWriter->startElement('fgColor');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// bgColor
|
||||
$objWriter->startElement('bgColor');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
if ($pFill->getEndColor()->getARGB()) {
|
||||
$objWriter->startElement('bgColor');
|
||||
$objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
@ -275,52 +279,66 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
$objWriter->startElement('font');
|
||||
|
||||
// Name
|
||||
$objWriter->startElement('name');
|
||||
$objWriter->writeAttribute('val', $pFont->getName());
|
||||
$objWriter->endElement();
|
||||
if ($pFont->getName() !== NULL) {
|
||||
$objWriter->startElement('name');
|
||||
$objWriter->writeAttribute('val', $pFont->getName());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Size
|
||||
$objWriter->startElement('sz');
|
||||
$objWriter->writeAttribute('val', $pFont->getSize());
|
||||
$objWriter->endElement();
|
||||
if ($pFont->getSize() !== NULL) {
|
||||
$objWriter->startElement('sz');
|
||||
$objWriter->writeAttribute('val', $pFont->getSize());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Bold. We explicitly write this element also when false (like MS Office Excel 2007 does
|
||||
// for conditional formatting). Otherwise it will apparently not be picked up in conditional
|
||||
// formatting style dialog
|
||||
$objWriter->startElement('b');
|
||||
$objWriter->writeAttribute('val', $pFont->getBold() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
if ($pFont->getBold() !== NULL) {
|
||||
$objWriter->startElement('b');
|
||||
$objWriter->writeAttribute('val', $pFont->getBold() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Italic
|
||||
$objWriter->startElement('i');
|
||||
$objWriter->writeAttribute('val', $pFont->getItalic() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
if ($pFont->getItalic() !== NULL) {
|
||||
$objWriter->startElement('i');
|
||||
$objWriter->writeAttribute('val', $pFont->getItalic() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Superscript / subscript
|
||||
if ($pFont->getSuperScript() || $pFont->getSubScript()) {
|
||||
if ($pFont->getSuperScript() === TRUE || $pFont->getSubScript() === TRUE) {
|
||||
$objWriter->startElement('vertAlign');
|
||||
if ($pFont->getSuperScript()) {
|
||||
if ($pFont->getSuperScript() === TRUE) {
|
||||
$objWriter->writeAttribute('val', 'superscript');
|
||||
} else if ($pFont->getSubScript()) {
|
||||
} else if ($pFont->getSubScript() === TRUE) {
|
||||
$objWriter->writeAttribute('val', 'subscript');
|
||||
}
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Underline
|
||||
$objWriter->startElement('u');
|
||||
$objWriter->writeAttribute('val', $pFont->getUnderline());
|
||||
$objWriter->endElement();
|
||||
if ($pFont->getUnderline() !== NULL) {
|
||||
$objWriter->startElement('u');
|
||||
$objWriter->writeAttribute('val', $pFont->getUnderline());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Strikethrough
|
||||
$objWriter->startElement('strike');
|
||||
$objWriter->writeAttribute('val', $pFont->getStrikethrough() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
if ($pFont->getStrikethrough() !== NULL) {
|
||||
$objWriter->startElement('strike');
|
||||
$objWriter->writeAttribute('val', $pFont->getStrikethrough() ? '1' : '0');
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
// Foreground color
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
if ($pFont->getColor()->getARGB() !== NULL) {
|
||||
$objWriter->startElement('color');
|
||||
$objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
}
|
||||
@ -353,11 +371,11 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
}
|
||||
|
||||
// BorderPr
|
||||
$this->_writeBorderPr($objWriter, 'left', $pBorders->getLeft());
|
||||
$this->_writeBorderPr($objWriter, 'right', $pBorders->getRight());
|
||||
$this->_writeBorderPr($objWriter, 'top', $pBorders->getTop());
|
||||
$this->_writeBorderPr($objWriter, 'bottom', $pBorders->getBottom());
|
||||
$this->_writeBorderPr($objWriter, 'diagonal', $pBorders->getDiagonal());
|
||||
$this->_writeBorderPr($objWriter, 'left', $pBorders->getLeft());
|
||||
$this->_writeBorderPr($objWriter, 'right', $pBorders->getRight());
|
||||
$this->_writeBorderPr($objWriter, 'top', $pBorders->getTop());
|
||||
$this->_writeBorderPr($objWriter, 'bottom', $pBorders->getBottom());
|
||||
$this->_writeBorderPr($objWriter, 'diagonal', $pBorders->getDiagonal());
|
||||
$objWriter->endElement();
|
||||
}
|
||||
|
||||
@ -406,8 +424,8 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
} else if ($pStyle->getAlignment()->getTextRotation() < 0) {
|
||||
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
|
||||
}
|
||||
|
||||
$objWriter->writeAttribute('textRotation', $textRotation);
|
||||
|
||||
$objWriter->writeAttribute('wrapText', ($pStyle->getAlignment()->getWrapText() ? 'true' : 'false'));
|
||||
$objWriter->writeAttribute('shrinkToFit', ($pStyle->getAlignment()->getShrinkToFit() ? 'true' : 'false'));
|
||||
|
||||
@ -454,32 +472,43 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
|
||||
// alignment
|
||||
$objWriter->startElement('alignment');
|
||||
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
|
||||
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
|
||||
|
||||
$textRotation = 0;
|
||||
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
|
||||
$textRotation = $pStyle->getAlignment()->getTextRotation();
|
||||
} else if ($pStyle->getAlignment()->getTextRotation() < 0) {
|
||||
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
|
||||
if ($pStyle->getAlignment()->getHorizontal() !== NULL) {
|
||||
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
|
||||
}
|
||||
if ($pStyle->getAlignment()->getVertical() !== NULL) {
|
||||
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
|
||||
}
|
||||
|
||||
$objWriter->writeAttribute('textRotation', $textRotation);
|
||||
if ($pStyle->getAlignment()->getTextRotation() !== NULL) {
|
||||
$textRotation = 0;
|
||||
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
|
||||
$textRotation = $pStyle->getAlignment()->getTextRotation();
|
||||
} else if ($pStyle->getAlignment()->getTextRotation() < 0) {
|
||||
$textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
|
||||
}
|
||||
$objWriter->writeAttribute('textRotation', $textRotation);
|
||||
}
|
||||
$objWriter->endElement();
|
||||
|
||||
// border
|
||||
$this->_writeBorder($objWriter, $pStyle->getBorders());
|
||||
|
||||
// protection
|
||||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->startElement('protection');
|
||||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
if ($pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
$objWriter->endElement();
|
||||
if (($pStyle->getProtection()->getLocked() !== NULL) ||
|
||||
($pStyle->getProtection()->getHidden() !== NULL)) {
|
||||
if ($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT ||
|
||||
$pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||
$objWriter->startElement('protection');
|
||||
if (($pStyle->getProtection()->getLocked() !== NULL) &&
|
||||
($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
|
||||
$objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
if (($pStyle->getProtection()->getHidden() !== NULL) &&
|
||||
($pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT)) {
|
||||
$objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||
}
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
|
||||
$objWriter->endElement();
|
||||
@ -523,10 +552,12 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
||||
$formatCode = $pNumberFormat->getFormatCode();
|
||||
|
||||
// numFmt
|
||||
$objWriter->startElement('numFmt');
|
||||
$objWriter->writeAttribute('numFmtId', ($pId + 164));
|
||||
$objWriter->writeAttribute('formatCode', $formatCode);
|
||||
$objWriter->endElement();
|
||||
if ($formatCode !== NULL) {
|
||||
$objWriter->startElement('numFmt');
|
||||
$objWriter->writeAttribute('numFmtId', ($pId + 164));
|
||||
$objWriter->writeAttribute('formatCode', $formatCode);
|
||||
$objWriter->endElement();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,6 +34,7 @@ Fixed in develop branch:
|
||||
- Bugfix: (MBaker) Support for "e" (epoch) date format mask
|
||||
Rendered as a 4-digit CE year in non-Excel outputs
|
||||
- Bugfix: (MBaker) Work items 15799 and 18278 - Background color cell is always black when editing cell
|
||||
- Bugfix: (MBaker) Work items 15905 and 18183 - Allow "no impact" to formats on Conditional Formatting
|
||||
|
||||
|
||||
2012-05-19 (v1.7.7):
|
||||
|
Loading…
Reference in New Issue
Block a user