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