ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
PhpOffice\PhpSpreadsheet\Style\Border Class Reference
+ Inheritance diagram for PhpOffice\PhpSpreadsheet\Style\Border:
+ Collaboration diagram for PhpOffice\PhpSpreadsheet\Style\Border:

Public Member Functions

 __construct ($isSupervisor=false)
 Create a new Border. More...
 
 getStyleArray ($array)
 Build style array from subcomponents. More...
 
 applyFromArray (array $pStyles)
 Apply styles from array. More...
 
 getBorderStyle ()
 Get Border style. More...
 
 setBorderStyle ($pValue)
 Set Border style. More...
 
 getColor ()
 Get Border Color. More...
 
 setColor (Color $pValue)
 Set Border Color. More...
 
 getHashCode ()
 Get hash code. More...
 
- Public Member Functions inherited from PhpOffice\PhpSpreadsheet\Style\Supervisor
 __construct ($isSupervisor=false)
 Create a new Supervisor. 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...
 
 exportArray ()
 Export style as array. 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'
 
 $colorIndex
 

Protected Member Functions

 exportArray1 ()
 
- Protected Member Functions inherited from PhpOffice\PhpSpreadsheet\Style\Supervisor
 exportArray1 ()
 Abstract method to be implemented in anything which extends this class. More...
 
 exportArray2 (array &$exportedArray, string $index, $objOrValue)
 Populate array from exportArray1. More...
 

Protected Attributes

 $borderStyle = self::BORDER_NONE
 
 $color
 
- Protected Attributes inherited from PhpOffice\PhpSpreadsheet\Style\Supervisor
 $isSupervisor
 
 $parent
 
 $parentPropertyName
 

Detailed Description

Definition at line 7 of file Border.php.

Constructor & Destructor Documentation

◆ __construct()

PhpOffice\PhpSpreadsheet\Style\Border::__construct (   $isSupervisor = false)

Create a new Border.

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

Definition at line 51 of file Border.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\$isSupervisor, color, PhpOffice\PhpSpreadsheet\Style\Color\COLOR_BLACK, and PhpOffice\PhpSpreadsheet\Style\Style\getSharedComponent().

52  {
53  // Supervisor?
54  parent::__construct($isSupervisor);
55 
56  // Initialise values
57  $this->color = new Color(Color::COLOR_BLACK, $isSupervisor);
58 
59  // bind parent if we are a supervisor
60  if ($isSupervisor) {
61  $this->color->bindParent($this, 'color');
62  }
63  }
if(PHP_SAPI !='cli') color
Definition: langcheck.php:120
+ Here is the call graph for this function:

Member Function Documentation

◆ applyFromArray()

PhpOffice\PhpSpreadsheet\Style\Border::applyFromArray ( array  $pStyles)

Apply styles from array.

$spreadsheet->getActiveSheet()->getStyle('B2')->getBorders()->getTop()->applyFromArray( [ 'borderStyle' => Border::BORDER_DASHDOT, 'color' => [ 'rgb' => '808080' ] ] );

Parameters
array$pStylesArray containing style information
Returns
$this

Definition at line 121 of file Border.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\getActiveSheet(), PhpOffice\PhpSpreadsheet\Style\Border\getColor(), PhpOffice\PhpSpreadsheet\Style\Supervisor\getSelectedCells(), PhpOffice\PhpSpreadsheet\Style\Border\getStyleArray(), and PhpOffice\PhpSpreadsheet\Style\Border\setBorderStyle().

122  {
123  if ($this->isSupervisor) {
124  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
125  } else {
126  if (isset($pStyles['borderStyle'])) {
127  $this->setBorderStyle($pStyles['borderStyle']);
128  }
129  if (isset($pStyles['color'])) {
130  $this->getColor()->applyFromArray($pStyles['color']);
131  }
132  }
133 
134  return $this;
135  }
getColor()
Get Border Color.
Definition: Border.php:182
getStyleArray($array)
Build style array from subcomponents.
Definition: Border.php:98
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
setBorderStyle($pValue)
Set Border style.
Definition: Border.php:160
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:76
+ Here is the call graph for this function:

◆ exportArray1()

PhpOffice\PhpSpreadsheet\Style\Border::exportArray1 ( )
protected

Definition at line 225 of file Border.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\exportArray2(), PhpOffice\PhpSpreadsheet\Style\Border\getBorderStyle(), and PhpOffice\PhpSpreadsheet\Style\Border\getColor().

225  : array
226  {
227  $exportedArray = [];
228  $this->exportArray2($exportedArray, 'borderStyle', $this->getBorderStyle());
229  $this->exportArray2($exportedArray, 'color', $this->getColor());
230 
231  return $exportedArray;
232  }
getColor()
Get Border Color.
Definition: Border.php:182
getBorderStyle()
Get Border style.
Definition: Border.php:142
exportArray2(array &$exportedArray, string $index, $objOrValue)
Populate array from exportArray1.
Definition: Supervisor.php:150
+ Here is the call graph for this function:

◆ getBorderStyle()

PhpOffice\PhpSpreadsheet\Style\Border::getBorderStyle ( )

Get Border style.

Returns
string

Definition at line 142 of file Border.php.

References PhpOffice\PhpSpreadsheet\Style\Border\$borderStyle, and PhpOffice\PhpSpreadsheet\Style\Style\getSharedComponent().

Referenced by PhpOffice\PhpSpreadsheet\Writer\Html\createCSSStyleBorder(), PhpOffice\PhpSpreadsheet\Style\Border\exportArray1(), PhpOffice\PhpSpreadsheet\Writer\Xls\Style\CellBorder\style(), and PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style\writeBorderPr().

143  {
144  if ($this->isSupervisor) {
145  return $this->getSharedComponent()->getBorderStyle();
146  }
147 
148  return $this->borderStyle;
149  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Style.php:105
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getColor()

◆ getHashCode()

PhpOffice\PhpSpreadsheet\Style\Border::getHashCode ( )

Get hash code.

Returns
string Hash code

Implements PhpOffice\PhpSpreadsheet\IComparable.

Definition at line 212 of file Border.php.

References color, and PhpOffice\PhpSpreadsheet\Style\Style\getSharedComponent().

213  {
214  if ($this->isSupervisor) {
215  return $this->getSharedComponent()->getHashCode();
216  }
217 
218  return md5(
219  $this->borderStyle .
220  $this->color->getHashCode() .
221  __CLASS__
222  );
223  }
if(PHP_SAPI !='cli') color
Definition: langcheck.php:120
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Style.php:105
+ Here is the call graph for this function:

◆ getStyleArray()

PhpOffice\PhpSpreadsheet\Style\Border::getStyleArray (   $array)

Build style array from subcomponents.

Parameters
array$array
Returns
array

Definition at line 98 of file Border.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\Border\applyFromArray(), and PhpOffice\PhpSpreadsheet\Style\Border\setBorderStyle().

99  {
100  return $this->parent->getStyleArray([$this->parentPropertyName => $array]);
101  }
+ Here is the caller graph for this function:

◆ setBorderStyle()

PhpOffice\PhpSpreadsheet\Style\Border::setBorderStyle (   $pValue)

Set Border style.

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

Definition at line 160 of file Border.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\getActiveSheet(), PhpOffice\PhpSpreadsheet\Style\Supervisor\getSelectedCells(), and PhpOffice\PhpSpreadsheet\Style\Border\getStyleArray().

Referenced by PhpOffice\PhpSpreadsheet\Style\Border\applyFromArray(), and PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles\readBorder().

161  {
162  if (empty($pValue)) {
163  $pValue = self::BORDER_NONE;
164  } elseif (is_bool($pValue) && $pValue) {
165  $pValue = self::BORDER_MEDIUM;
166  }
167  if ($this->isSupervisor) {
168  $styleArray = $this->getStyleArray(['borderStyle' => $pValue]);
169  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
170  } else {
171  $this->borderStyle = $pValue;
172  }
173 
174  return $this;
175  }
getStyleArray($array)
Build style array from subcomponents.
Definition: Border.php:98
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:76
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setColor()

PhpOffice\PhpSpreadsheet\Style\Border::setColor ( Color  $pValue)

Set Border Color.

Returns
$this

Definition at line 192 of file Border.php.

References PhpOffice\PhpSpreadsheet\Style\Border\$color, color, PhpOffice\PhpSpreadsheet\Style\Supervisor\getActiveSheet(), PhpOffice\PhpSpreadsheet\Style\Border\getColor(), PhpOffice\PhpSpreadsheet\Style\Supervisor\getIsSupervisor(), and PhpOffice\PhpSpreadsheet\Style\Supervisor\getSelectedCells().

193  {
194  // make sure parameter is a real color and not a supervisor
195  $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
196 
197  if ($this->isSupervisor) {
198  $styleArray = $this->getColor()->getStyleArray(['argb' => $color->getARGB()]);
199  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
200  } else {
201  $this->color = $color;
202  }
203 
204  return $this;
205  }
getColor()
Get Border Color.
Definition: Border.php:182
if(PHP_SAPI !='cli') color
Definition: langcheck.php:120
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:76
+ Here is the call graph for this function:

Field Documentation

◆ $borderStyle

PhpOffice\PhpSpreadsheet\Style\Border::$borderStyle = self::BORDER_NONE
protected

Definition at line 30 of file Border.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\Border\getBorderStyle().

◆ $color

PhpOffice\PhpSpreadsheet\Style\Border::$color
protected

◆ $colorIndex

PhpOffice\PhpSpreadsheet\Style\Border::$colorIndex

Definition at line 42 of file Border.php.

◆ BORDER_DASHDOT

const PhpOffice\PhpSpreadsheet\Style\Border::BORDER_DASHDOT = 'dashDot'

Definition at line 11 of file Border.php.

◆ BORDER_DASHDOTDOT

const PhpOffice\PhpSpreadsheet\Style\Border::BORDER_DASHDOTDOT = 'dashDotDot'

Definition at line 12 of file Border.php.

◆ BORDER_DASHED

const PhpOffice\PhpSpreadsheet\Style\Border::BORDER_DASHED = 'dashed'

Definition at line 13 of file Border.php.

◆ BORDER_DOTTED

const PhpOffice\PhpSpreadsheet\Style\Border::BORDER_DOTTED = 'dotted'

Definition at line 14 of file Border.php.

◆ BORDER_DOUBLE

const PhpOffice\PhpSpreadsheet\Style\Border::BORDER_DOUBLE = 'double'

Definition at line 15 of file Border.php.

◆ BORDER_HAIR

const PhpOffice\PhpSpreadsheet\Style\Border::BORDER_HAIR = 'hair'

Definition at line 16 of file Border.php.

◆ BORDER_MEDIUM

const PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUM = 'medium'

Definition at line 17 of file Border.php.

◆ BORDER_MEDIUMDASHDOT

const PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUMDASHDOT = 'mediumDashDot'

Definition at line 18 of file Border.php.

◆ BORDER_MEDIUMDASHDOTDOT

const PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUMDASHDOTDOT = 'mediumDashDotDot'

Definition at line 19 of file Border.php.

◆ BORDER_MEDIUMDASHED

const PhpOffice\PhpSpreadsheet\Style\Border::BORDER_MEDIUMDASHED = 'mediumDashed'

Definition at line 20 of file Border.php.

◆ BORDER_NONE

◆ BORDER_SLANTDASHDOT

const PhpOffice\PhpSpreadsheet\Style\Border::BORDER_SLANTDASHDOT = 'slantDashDot'

Definition at line 21 of file Border.php.

◆ BORDER_THICK

const PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THICK = 'thick'

Definition at line 22 of file Border.php.

◆ BORDER_THIN

const PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN = 'thin'

Definition at line 23 of file Border.php.

Referenced by PhpOffice\PhpSpreadsheet\Reader\Slk\styleSettings().


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