ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
PHPExcel_Style_Border Class Reference
+ Inheritance diagram for PHPExcel_Style_Border:
+ Collaboration diagram for PHPExcel_Style_Border:

Public Member Functions

 __construct ($isSupervisor=FALSE, $isConditional=FALSE)
 Create a new PHPExcel_Style_Border. More...
 
 bindParent ($parent, $parentPropertyName=NULL)
 Bind parent. More...
 
 getSharedComponent ()
 Get the shared style component for the currently active cell in currently active sheet. More...
 
 getStyleArray ($array)
 Build style array from subcomponents. More...
 
 applyFromArray ($pStyles=null)
 Apply styles from array. More...
 
 getBorderStyle ()
 Get Border style. More...
 
 setBorderStyle ($pValue=PHPExcel_Style_Border::BORDER_NONE)
 Set Border style. More...
 
 getColor ()
 Get Border Color. More...
 
 setColor (PHPExcel_Style_Color $pValue=null)
 Set Border Color. More...
 
 getHashCode ()
 Get hash code. More...
 
- Public Member Functions inherited from PHPExcel_Style_Supervisor
 __construct ($isSupervisor=FALSE)
 Create a new PHPExcel_Style_Alignment. More...
 
 bindParent ($parent, $parentPropertyName=NULL)
 Bind parent. More...
 
 getIsSupervisor ()
 Is this a supervisor or a cell style component? More...
 
 getActiveSheet ()
 Get the currently active sheet. More...
 
 getSelectedCells ()
 Get the currently active cell coordinate in currently active sheet. More...
 
 getActiveCell ()
 Get the currently active cell coordinate in currently active sheet. More...
 
 __clone ()
 Implement PHP __clone to create a deep clone, not just a shallow copy. More...
 

Data Fields

const BORDER_NONE = 'none'
 
const BORDER_DASHDOT = 'dashDot'
 
const BORDER_DASHDOTDOT = 'dashDotDot'
 
const BORDER_DASHED = 'dashed'
 
const BORDER_DOTTED = 'dotted'
 
const BORDER_DOUBLE = 'double'
 
const BORDER_HAIR = 'hair'
 
const BORDER_MEDIUM = 'medium'
 
const BORDER_MEDIUMDASHDOT = 'mediumDashDot'
 
const BORDER_MEDIUMDASHDOTDOT = 'mediumDashDotDot'
 
const BORDER_MEDIUMDASHED = 'mediumDashed'
 
const BORDER_SLANTDASHDOT = 'slantDashDot'
 
const BORDER_THICK = 'thick'
 
const BORDER_THIN = 'thin'
 

Protected Attributes

 $_borderStyle = PHPExcel_Style_Border::BORDER_NONE
 
 $_color
 
 $_parentPropertyName
 
- Protected Attributes inherited from PHPExcel_Style_Supervisor
 $_isSupervisor
 
 $_parent
 

Detailed Description

Definition at line 36 of file Border.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_Style_Border::__construct (   $isSupervisor = FALSE,
  $isConditional = FALSE 
)

Create a new PHPExcel_Style_Border.

Parameters
boolean$isSupervisorFlag indicating if this is a supervisor or not Leave this value at default unless you understand exactly what its ramifications are
boolean$isConditionalFlag indicating if this is a conditional style or not Leave this value at default unless you understand exactly what its ramifications are

Definition at line 85 of file Border.php.

References PHPExcel_Style_Color\COLOR_BLACK.

86  {
87  // Supervisor?
88  parent::__construct($isSupervisor);
89 
90  // Initialise values
91  $this->_color = new PHPExcel_Style_Color(PHPExcel_Style_Color::COLOR_BLACK, $isSupervisor);
92 
93  // bind parent if we are a supervisor
94  if ($isSupervisor) {
95  $this->_color->bindParent($this, '_color');
96  }
97  }

Member Function Documentation

◆ applyFromArray()

PHPExcel_Style_Border::applyFromArray (   $pStyles = null)

Apply styles from array.

$objPHPExcel->getActiveSheet()->getStyle('B2')->getBorders()->getTop()->applyFromArray( array( 'style' => PHPExcel_Style_Border::BORDER_DASHDOT, 'color' => array( 'rgb' => '808080' ) ) );

Parameters
array$pStylesArray containing style information
Exceptions
PHPExcel_Exception
Returns
PHPExcel_Style_Border

Definition at line 195 of file Border.php.

References PHPExcel_Style_Supervisor\getActiveSheet(), getColor(), PHPExcel_Style_Supervisor\getSelectedCells(), getStyleArray(), and setBorderStyle().

195  {
196  if (is_array($pStyles)) {
197  if ($this->_isSupervisor) {
198  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
199  } else {
200  if (isset($pStyles['style'])) {
201  $this->setBorderStyle($pStyles['style']);
202  }
203  if (isset($pStyles['color'])) {
204  $this->getColor()->applyFromArray($pStyles['color']);
205  }
206  }
207  } else {
208  throw new PHPExcel_Exception("Invalid style array passed.");
209  }
210  return $this;
211  }
getColor()
Get Border Color.
Definition: Border.php:254
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:103
setBorderStyle($pValue=PHPExcel_Style_Border::BORDER_NONE)
Set Border style.
Definition: Border.php:233
getStyleArray($array)
Build style array from subcomponents.
Definition: Border.php:150
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:92
+ Here is the call graph for this function:

◆ bindParent()

PHPExcel_Style_Border::bindParent (   $parent,
  $parentPropertyName = NULL 
)

Bind parent.

Only used for supervisor

Parameters
PHPExcel_Style_Borders$parent
string$parentPropertyName
Returns
PHPExcel_Style_Border

Definition at line 106 of file Border.php.

107  {
108  $this->_parent = $parent;
109  $this->_parentPropertyName = $parentPropertyName;
110  return $this;
111  }

◆ getBorderStyle()

PHPExcel_Style_Border::getBorderStyle ( )

Get Border style.

Returns
string

Definition at line 218 of file Border.php.

References $_borderStyle, and getSharedComponent().

Referenced by PHPExcel_Writer_HTML\_createCSSStyleBorder().

218  {
219  if ($this->_isSupervisor) {
220  return $this->getSharedComponent()->getBorderStyle();
221  }
222  return $this->_borderStyle;
223  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Border.php:120
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getColor()

PHPExcel_Style_Border::getColor ( )

Get Border Color.

Returns
PHPExcel_Style_Color

Definition at line 254 of file Border.php.

References $_color.

Referenced by PHPExcel_Writer_HTML\_createCSSStyleBorder(), applyFromArray(), and setColor().

254  {
255  return $this->_color;
256  }
+ Here is the caller graph for this function:

◆ getHashCode()

PHPExcel_Style_Border::getHashCode ( )

Get hash code.

Returns
string Hash code

Implements PHPExcel_IComparable.

Definition at line 283 of file Border.php.

References getSharedComponent().

283  {
284  if ($this->_isSupervisor) {
285  return $this->getSharedComponent()->getHashCode();
286  }
287  return md5(
288  $this->_borderStyle
289  . $this->_color->getHashCode()
290  . __CLASS__
291  );
292  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Border.php:120
+ Here is the call graph for this function:

◆ getSharedComponent()

PHPExcel_Style_Border::getSharedComponent ( )

Get the shared style component for the currently active cell in currently active sheet.

Only used for style supervisor

Returns
PHPExcel_Style_Border
Exceptions
PHPExcel_Exception

Definition at line 120 of file Border.php.

Referenced by getBorderStyle(), and getHashCode().

121  {
122  switch ($this->_parentPropertyName) {
123  case '_allBorders':
124  case '_horizontal':
125  case '_inside':
126  case '_outline':
127  case '_vertical':
128  throw new PHPExcel_Exception('Cannot get shared component for a pseudo-border.');
129  break;
130  case '_bottom':
131  return $this->_parent->getSharedComponent()->getBottom(); break;
132  case '_diagonal':
133  return $this->_parent->getSharedComponent()->getDiagonal(); break;
134  case '_left':
135  return $this->_parent->getSharedComponent()->getLeft(); break;
136  case '_right':
137  return $this->_parent->getSharedComponent()->getRight(); break;
138  case '_top':
139  return $this->_parent->getSharedComponent()->getTop(); break;
140 
141  }
142  }
+ Here is the caller graph for this function:

◆ getStyleArray()

PHPExcel_Style_Border::getStyleArray (   $array)

Build style array from subcomponents.

Parameters
array$array
Returns
array

Definition at line 150 of file Border.php.

References array.

Referenced by applyFromArray(), and setBorderStyle().

151  {
152  switch ($this->_parentPropertyName) {
153  case '_allBorders':
154  $key = 'allborders'; break;
155  case '_bottom':
156  $key = 'bottom'; break;
157  case '_diagonal':
158  $key = 'diagonal'; break;
159  case '_horizontal':
160  $key = 'horizontal'; break;
161  case '_inside':
162  $key = 'inside'; break;
163  case '_left':
164  $key = 'left'; break;
165  case '_outline':
166  $key = 'outline'; break;
167  case '_right':
168  $key = 'right'; break;
169  case '_top':
170  $key = 'top'; break;
171  case '_vertical':
172  $key = 'vertical'; break;
173  }
174  return $this->_parent->getStyleArray(array($key => $array));
175  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ setBorderStyle()

PHPExcel_Style_Border::setBorderStyle (   $pValue = PHPExcel_Style_Border::BORDER_NONE)

Set Border style.

Parameters
string | boolean$pValueWhen passing a boolean, FALSE equates PHPExcel_Style_Border::BORDER_NONE and TRUE to PHPExcel_Style_Border::BORDER_MEDIUM
Returns
PHPExcel_Style_Border

Definition at line 233 of file Border.php.

References array, BORDER_MEDIUM, BORDER_NONE, PHPExcel_Style_Supervisor\getActiveSheet(), PHPExcel_Style_Supervisor\getSelectedCells(), and getStyleArray().

Referenced by applyFromArray().

233  {
234 
235  if (empty($pValue)) {
237  } elseif(is_bool($pValue) && $pValue) {
239  }
240  if ($this->_isSupervisor) {
241  $styleArray = $this->getStyleArray(array('style' => $pValue));
242  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
243  } else {
244  $this->_borderStyle = $pValue;
245  }
246  return $this;
247  }
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:103
getStyleArray($array)
Build style array from subcomponents.
Definition: Border.php:150
Create styles array
The data for the language used.
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:92
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setColor()

PHPExcel_Style_Border::setColor ( PHPExcel_Style_Color  $pValue = null)

Set Border Color.

Parameters
PHPExcel_Style_Color$pValue
Exceptions
PHPExcel_Exception
Returns
PHPExcel_Style_Border

Definition at line 265 of file Border.php.

References array, PHPExcel_Style_Supervisor\getActiveSheet(), getColor(), and PHPExcel_Style_Supervisor\getSelectedCells().

265  {
266  // make sure parameter is a real color and not a supervisor
267  $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
268 
269  if ($this->_isSupervisor) {
270  $styleArray = $this->getColor()->getStyleArray(array('argb' => $color->getARGB()));
271  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
272  } else {
273  $this->_color = $color;
274  }
275  return $this;
276  }
getColor()
Get Border Color.
Definition: Border.php:254
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:103
getIsSupervisor()
Is this a supervisor or a cell style component?
Definition: Supervisor.php:82
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Color.php:114
Create styles array
The data for the language used.
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:92
+ Here is the call graph for this function:

Field Documentation

◆ $_borderStyle

PHPExcel_Style_Border::$_borderStyle = PHPExcel_Style_Border::BORDER_NONE
protected

Definition at line 59 of file Border.php.

Referenced by getBorderStyle().

◆ $_color

PHPExcel_Style_Border::$_color
protected

Definition at line 66 of file Border.php.

Referenced by getColor().

◆ $_parentPropertyName

PHPExcel_Style_Border::$_parentPropertyName
protected

Definition at line 73 of file Border.php.

◆ BORDER_DASHDOT

◆ BORDER_DASHDOTDOT

◆ BORDER_DASHED

◆ BORDER_DOTTED

◆ BORDER_DOUBLE

◆ BORDER_HAIR

const PHPExcel_Style_Border::BORDER_HAIR = 'hair'

◆ BORDER_MEDIUM

◆ BORDER_MEDIUMDASHDOT

const PHPExcel_Style_Border::BORDER_MEDIUMDASHDOT = 'mediumDashDot'

◆ BORDER_MEDIUMDASHDOTDOT

const PHPExcel_Style_Border::BORDER_MEDIUMDASHDOTDOT = 'mediumDashDotDot'

◆ BORDER_MEDIUMDASHED

◆ BORDER_NONE

◆ BORDER_SLANTDASHDOT

◆ BORDER_THICK

◆ BORDER_THIN


The documentation for this class was generated from the following file: