mirror of
https://github.com/retailcrm/PHPExcel.git
synced 2024-11-29 08:46:03 +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();
|
$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,8 +90,13 @@ 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;
|
||||||
|
@ -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,15 +88,22 @@ 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
|
||||||
|
if (!$isConditional) {
|
||||||
$this->_argb = $pARGB;
|
$this->_argb = $pARGB;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind parent. Only used for supervisor
|
* Bind parent. Only used for supervisor
|
||||||
@ -132,16 +139,11 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable
|
|||||||
{
|
{
|
||||||
switch ($this->_parentPropertyName) {
|
switch ($this->_parentPropertyName) {
|
||||||
case '_endColor':
|
case '_endColor':
|
||||||
return $this->_parent->getSharedComponent()->getEndColor();
|
return $this->_parent->getSharedComponent()->getEndColor(); break;
|
||||||
break;
|
|
||||||
|
|
||||||
case '_color':
|
case '_color':
|
||||||
return $this->_parent->getSharedComponent()->getColor();
|
return $this->_parent->getSharedComponent()->getColor(); break;
|
||||||
break;
|
|
||||||
|
|
||||||
case '_startColor':
|
case '_startColor':
|
||||||
return $this->_parent->getSharedComponent()->getStartColor();
|
return $this->_parent->getSharedComponent()->getStartColor(); break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -189,11 +191,9 @@ class PHPExcel_Style_Color implements PHPExcel_IComparable
|
|||||||
case '_endColor':
|
case '_endColor':
|
||||||
$key = 'endcolor';
|
$key = 'endcolor';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '_color':
|
case '_color':
|
||||||
$key = 'color';
|
$key = 'color';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '_startColor':
|
case '_startColor':
|
||||||
$key = 'startcolor';
|
$key = 'startcolor';
|
||||||
break;
|
break;
|
||||||
|
@ -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
|
||||||
|
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);
|
$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,16 +79,23 @@ 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
|
||||||
|
if (!$isConditional) {
|
||||||
$this->_locked = self::PROTECTION_INHERIT;
|
$this->_locked = self::PROTECTION_INHERIT;
|
||||||
$this->_hidden = self::PROTECTION_INHERIT;
|
$this->_hidden = self::PROTECTION_INHERIT;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bind parent. Only used for supervisor
|
* Bind parent. Only used for supervisor
|
||||||
|
@ -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,15 +247,19 @@ 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
|
||||||
|
if ($pFill->getStartColor()->getARGB()) {
|
||||||
$objWriter->startElement('fgColor');
|
$objWriter->startElement('fgColor');
|
||||||
$objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
|
$objWriter->writeAttribute('rgb', $pFill->getStartColor()->getARGB());
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
}
|
||||||
|
|
||||||
// bgColor
|
// bgColor
|
||||||
|
if ($pFill->getEndColor()->getARGB()) {
|
||||||
$objWriter->startElement('bgColor');
|
$objWriter->startElement('bgColor');
|
||||||
$objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
|
$objWriter->writeAttribute('rgb', $pFill->getEndColor()->getARGB());
|
||||||
$objWriter->endElement();
|
$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
|
||||||
|
if ($pFont->getName() !== NULL) {
|
||||||
$objWriter->startElement('name');
|
$objWriter->startElement('name');
|
||||||
$objWriter->writeAttribute('val', $pFont->getName());
|
$objWriter->writeAttribute('val', $pFont->getName());
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
}
|
||||||
|
|
||||||
// Size
|
// Size
|
||||||
|
if ($pFont->getSize() !== NULL) {
|
||||||
$objWriter->startElement('sz');
|
$objWriter->startElement('sz');
|
||||||
$objWriter->writeAttribute('val', $pFont->getSize());
|
$objWriter->writeAttribute('val', $pFont->getSize());
|
||||||
$objWriter->endElement();
|
$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
|
||||||
|
if ($pFont->getBold() !== NULL) {
|
||||||
$objWriter->startElement('b');
|
$objWriter->startElement('b');
|
||||||
$objWriter->writeAttribute('val', $pFont->getBold() ? '1' : '0');
|
$objWriter->writeAttribute('val', $pFont->getBold() ? '1' : '0');
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
}
|
||||||
|
|
||||||
// Italic
|
// Italic
|
||||||
|
if ($pFont->getItalic() !== NULL) {
|
||||||
$objWriter->startElement('i');
|
$objWriter->startElement('i');
|
||||||
$objWriter->writeAttribute('val', $pFont->getItalic() ? '1' : '0');
|
$objWriter->writeAttribute('val', $pFont->getItalic() ? '1' : '0');
|
||||||
$objWriter->endElement();
|
$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
|
||||||
|
if ($pFont->getUnderline() !== NULL) {
|
||||||
$objWriter->startElement('u');
|
$objWriter->startElement('u');
|
||||||
$objWriter->writeAttribute('val', $pFont->getUnderline());
|
$objWriter->writeAttribute('val', $pFont->getUnderline());
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
}
|
||||||
|
|
||||||
// Strikethrough
|
// Strikethrough
|
||||||
|
if ($pFont->getStrikethrough() !== NULL) {
|
||||||
$objWriter->startElement('strike');
|
$objWriter->startElement('strike');
|
||||||
$objWriter->writeAttribute('val', $pFont->getStrikethrough() ? '1' : '0');
|
$objWriter->writeAttribute('val', $pFont->getStrikethrough() ? '1' : '0');
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
}
|
||||||
|
|
||||||
// Foreground color
|
// Foreground color
|
||||||
|
if ($pFont->getColor()->getARGB() !== NULL) {
|
||||||
$objWriter->startElement('color');
|
$objWriter->startElement('color');
|
||||||
$objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB());
|
$objWriter->writeAttribute('rgb', $pFont->getColor()->getARGB());
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
|
}
|
||||||
|
|
||||||
$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,33 +472,44 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
|||||||
|
|
||||||
// alignment
|
// alignment
|
||||||
$objWriter->startElement('alignment');
|
$objWriter->startElement('alignment');
|
||||||
|
if ($pStyle->getAlignment()->getHorizontal() !== NULL) {
|
||||||
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
|
$objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
|
||||||
|
}
|
||||||
|
if ($pStyle->getAlignment()->getVertical() !== NULL) {
|
||||||
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
|
$objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($pStyle->getAlignment()->getTextRotation() !== NULL) {
|
||||||
$textRotation = 0;
|
$textRotation = 0;
|
||||||
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
|
if ($pStyle->getAlignment()->getTextRotation() >= 0) {
|
||||||
$textRotation = $pStyle->getAlignment()->getTextRotation();
|
$textRotation = $pStyle->getAlignment()->getTextRotation();
|
||||||
} 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->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) ||
|
||||||
|
($pStyle->getProtection()->getHidden() !== NULL)) {
|
||||||
|
if ($pStyle->getProtection()->getLocked() !== PHPExcel_Style_Protection::PROTECTION_INHERIT ||
|
||||||
|
$pStyle->getProtection()->getHidden() !== PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
||||||
$objWriter->startElement('protection');
|
$objWriter->startElement('protection');
|
||||||
if ($pStyle->getProtection()->getLocked() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
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'));
|
$objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||||
}
|
}
|
||||||
if ($pStyle->getProtection()->getHidden() != PHPExcel_Style_Protection::PROTECTION_INHERIT) {
|
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->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == PHPExcel_Style_Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
|
||||||
}
|
}
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
@ -523,11 +552,13 @@ class PHPExcel_Writer_Excel2007_Style extends PHPExcel_Writer_Excel2007_WriterPa
|
|||||||
$formatCode = $pNumberFormat->getFormatCode();
|
$formatCode = $pNumberFormat->getFormatCode();
|
||||||
|
|
||||||
// numFmt
|
// numFmt
|
||||||
|
if ($formatCode !== NULL) {
|
||||||
$objWriter->startElement('numFmt');
|
$objWriter->startElement('numFmt');
|
||||||
$objWriter->writeAttribute('numFmtId', ($pId + 164));
|
$objWriter->writeAttribute('numFmtId', ($pId + 164));
|
||||||
$objWriter->writeAttribute('formatCode', $formatCode);
|
$objWriter->writeAttribute('formatCode', $formatCode);
|
||||||
$objWriter->endElement();
|
$objWriter->endElement();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an array of all styles
|
* Get an array of all styles
|
||||||
|
@ -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
Block a user