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

Public Member Functions

 __construct ($isSupervisor=false, $isConditional=false)
 Create a new Font. 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 (array $pStyles)
 Apply styles from array. More...
 
 getName ()
 Get Name. More...
 
 setName ($fontname)
 Set Name. More...
 
 getSize ()
 Get Size. More...
 
 setSize ($sizeInPoints)
 Set Size. More...
 
 getBold ()
 Get Bold. More...
 
 setBold ($pValue)
 Set Bold. More...
 
 getItalic ()
 Get Italic. More...
 
 setItalic ($pValue)
 Set Italic. More...
 
 getSuperscript ()
 Get Superscript. More...
 
 setSuperscript (bool $pValue)
 Set Superscript. More...
 
 getSubscript ()
 Get Subscript. More...
 
 setSubscript (bool $pValue)
 Set Subscript. More...
 
 getUnderline ()
 Get Underline. More...
 
 setUnderline ($pValue)
 Set Underline. More...
 
 getStrikethrough ()
 Get Strikethrough. More...
 
 setStrikethrough ($pValue)
 Set Strikethrough. More...
 
 getColor ()
 Get Color. More...
 
 setColor (Color $pValue)
 Set 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 UNDERLINE_NONE = 'none'
 
const UNDERLINE_DOUBLE = 'double'
 
const UNDERLINE_DOUBLEACCOUNTING = 'doubleAccounting'
 
const UNDERLINE_SINGLE = 'single'
 
const UNDERLINE_SINGLEACCOUNTING = 'singleAccounting'
 
 $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

 $name = 'Calibri'
 
 $size = 11
 
 $bold = false
 
 $italic = false
 
 $superscript = false
 
 $subscript = false
 
 $underline = self::UNDERLINE_NONE
 
 $strikethrough = false
 
 $color
 
- Protected Attributes inherited from PhpOffice\PhpSpreadsheet\Style\Supervisor
 $isSupervisor
 
 $parent
 
 $parentPropertyName
 

Detailed Description

Definition at line 5 of file Font.php.

Constructor & Destructor Documentation

◆ __construct()

PhpOffice\PhpSpreadsheet\Style\Font::__construct (   $isSupervisor = false,
  $isConditional = false 
)

Create a new Font.

Parameters
bool$isSupervisorFlag indicating if this is a supervisor or not Leave this value at default unless you understand exactly what its ramifications are
bool$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 92 of file Font.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\$isSupervisor, color, PhpOffice\PhpSpreadsheet\Style\Color\COLOR_BLACK, and size.

93  {
94  // Supervisor?
95  parent::__construct($isSupervisor);
96 
97  // Initialise values
98  if ($isConditional) {
99  $this->name = null;
100  $this->size = null;
101  $this->bold = null;
102  $this->italic = null;
103  $this->superscript = null;
104  $this->subscript = null;
105  $this->underline = null;
106  $this->strikethrough = null;
107  $this->color = new Color(Color::COLOR_BLACK, $isSupervisor, $isConditional);
108  } else {
109  $this->color = new Color(Color::COLOR_BLACK, $isSupervisor);
110  }
111  // bind parent if we are a supervisor
112  if ($isSupervisor) {
113  $this->color->bindParent($this, 'color');
114  }
115  }
if(PHP_SAPI !='cli') color
Definition: langcheck.php:120
font size
Definition: langcheck.php:162

Member Function Documentation

◆ applyFromArray()

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

Apply styles from array.

$spreadsheet->getActiveSheet()->getStyle('B2')->getFont()->applyFromArray( [ 'name' => 'Arial', 'bold' => TRUE, 'italic' => FALSE, 'underline' => ::UNDERLINE_DOUBLE, 'strikethrough' => FALSE, 'color' => [ 'rgb' => '808080' ] ] );

Parameters
array$pStylesArray containing style information
Returns
$this

Definition at line 162 of file Font.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\getActiveSheet(), PhpOffice\PhpSpreadsheet\Style\Font\getColor(), PhpOffice\PhpSpreadsheet\Style\Supervisor\getSelectedCells(), PhpOffice\PhpSpreadsheet\Style\Font\getStyleArray(), PhpOffice\PhpSpreadsheet\Style\Font\setBold(), PhpOffice\PhpSpreadsheet\Style\Font\setItalic(), PhpOffice\PhpSpreadsheet\Style\Font\setName(), PhpOffice\PhpSpreadsheet\Style\Font\setSize(), PhpOffice\PhpSpreadsheet\Style\Font\setStrikethrough(), PhpOffice\PhpSpreadsheet\Style\Font\setSubscript(), PhpOffice\PhpSpreadsheet\Style\Font\setSuperscript(), and PhpOffice\PhpSpreadsheet\Style\Font\setUnderline().

163  {
164  if ($this->isSupervisor) {
165  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($this->getStyleArray($pStyles));
166  } else {
167  if (isset($pStyles['name'])) {
168  $this->setName($pStyles['name']);
169  }
170  if (isset($pStyles['bold'])) {
171  $this->setBold($pStyles['bold']);
172  }
173  if (isset($pStyles['italic'])) {
174  $this->setItalic($pStyles['italic']);
175  }
176  if (isset($pStyles['superscript'])) {
177  $this->setSuperscript($pStyles['superscript']);
178  }
179  if (isset($pStyles['subscript'])) {
180  $this->setSubscript($pStyles['subscript']);
181  }
182  if (isset($pStyles['underline'])) {
183  $this->setUnderline($pStyles['underline']);
184  }
185  if (isset($pStyles['strikethrough'])) {
186  $this->setStrikethrough($pStyles['strikethrough']);
187  }
188  if (isset($pStyles['color'])) {
189  $this->getColor()->applyFromArray($pStyles['color']);
190  }
191  if (isset($pStyles['size'])) {
192  $this->setSize($pStyles['size']);
193  }
194  }
195 
196  return $this;
197  }
setItalic($pValue)
Set Italic.
Definition: Font.php:335
setSubscript(bool $pValue)
Set Subscript.
Definition: Font.php:403
setSize($sizeInPoints)
Set Size.
Definition: Font.php:256
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
setSuperscript(bool $pValue)
Set Superscript.
Definition: Font.php:369
setUnderline($pValue)
Set Underline.
Definition: Font.php:441
getStyleArray($array)
Build style array from subcomponents.
Definition: Font.php:135
setStrikethrough($pValue)
Set Strikethrough.
Definition: Font.php:479
setName($fontname)
Set Name.
Definition: Font.php:220
getActiveSheet()
Get the currently active sheet.
Definition: Supervisor.php:76
setBold($pValue)
Set Bold.
Definition: Font.php:299
+ Here is the call graph for this function:

◆ exportArray1()

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

Definition at line 550 of file Font.php.

References PhpOffice\PhpSpreadsheet\Style\Supervisor\exportArray2(), PhpOffice\PhpSpreadsheet\Style\Font\getBold(), PhpOffice\PhpSpreadsheet\Style\Font\getColor(), PhpOffice\PhpSpreadsheet\Style\Font\getItalic(), PhpOffice\PhpSpreadsheet\Style\Font\getName(), PhpOffice\PhpSpreadsheet\Style\Font\getSize(), PhpOffice\PhpSpreadsheet\Style\Font\getStrikethrough(), PhpOffice\PhpSpreadsheet\Style\Font\getSubscript(), PhpOffice\PhpSpreadsheet\Style\Font\getSuperscript(), and PhpOffice\PhpSpreadsheet\Style\Font\getUnderline().

550  : array
551  {
552  $exportedArray = [];
553  $this->exportArray2($exportedArray, 'bold', $this->getBold());
554  $this->exportArray2($exportedArray, 'color', $this->getColor());
555  $this->exportArray2($exportedArray, 'italic', $this->getItalic());
556  $this->exportArray2($exportedArray, 'name', $this->getName());
557  $this->exportArray2($exportedArray, 'size', $this->getSize());
558  $this->exportArray2($exportedArray, 'strikethrough', $this->getStrikethrough());
559  $this->exportArray2($exportedArray, 'subscript', $this->getSubscript());
560  $this->exportArray2($exportedArray, 'superscript', $this->getSuperscript());
561  $this->exportArray2($exportedArray, 'underline', $this->getUnderline());
562 
563  return $exportedArray;
564  }
getUnderline()
Get Underline.
Definition: Font.php:423
getStrikethrough()
Get Strikethrough.
Definition: Font.php:463
getSuperscript()
Get Superscript.
Definition: Font.php:355
getSubscript()
Get Subscript.
Definition: Font.php:389
exportArray2(array &$exportedArray, string $index, $objOrValue)
Populate array from exportArray1.
Definition: Supervisor.php:150
+ Here is the call graph for this function:

◆ getBold()

PhpOffice\PhpSpreadsheet\Style\Font::getBold ( )

Get Bold.

Returns
null|bool

Definition at line 283 of file Font.php.

References PhpOffice\PhpSpreadsheet\Style\Font\$bold, and PhpOffice\PhpSpreadsheet\Style\Font\getSharedComponent().

Referenced by PhpOffice\PhpSpreadsheet\Writer\Html\createCSSStyleFont(), PhpOffice\PhpSpreadsheet\Style\Font\exportArray1(), and PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style\writeFont().

284  {
285  if ($this->isSupervisor) {
286  return $this->getSharedComponent()->getBold();
287  }
288 
289  return $this->bold;
290  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Font.php:123
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getColor()

◆ getHashCode()

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

Get hash code.

Returns
string Hash code

Implements PhpOffice\PhpSpreadsheet\IComparable.

Definition at line 530 of file Font.php.

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

531  {
532  if ($this->isSupervisor) {
533  return $this->getSharedComponent()->getHashCode();
534  }
535 
536  return md5(
537  $this->name .
538  $this->size .
539  ($this->bold ? 't' : 'f') .
540  ($this->italic ? 't' : 'f') .
541  ($this->superscript ? 't' : 'f') .
542  ($this->subscript ? 't' : 'f') .
543  $this->underline .
544  ($this->strikethrough ? 't' : 'f') .
545  $this->color->getHashCode() .
546  __CLASS__
547  );
548  }
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: Font.php:123
font size
Definition: langcheck.php:162
+ Here is the call graph for this function:

◆ getItalic()

PhpOffice\PhpSpreadsheet\Style\Font::getItalic ( )

Get Italic.

Returns
null|bool

Definition at line 319 of file Font.php.

References PhpOffice\PhpSpreadsheet\Style\Font\$italic, and PhpOffice\PhpSpreadsheet\Style\Font\getSharedComponent().

Referenced by PhpOffice\PhpSpreadsheet\Writer\Html\createCSSStyleFont(), PhpOffice\PhpSpreadsheet\Style\Font\exportArray1(), and PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style\writeFont().

320  {
321  if ($this->isSupervisor) {
322  return $this->getSharedComponent()->getItalic();
323  }
324 
325  return $this->italic;
326  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Font.php:123
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getName()

PhpOffice\PhpSpreadsheet\Style\Font::getName ( )

Get Name.

Returns
null|string

Definition at line 204 of file Font.php.

References PhpOffice\PhpSpreadsheet\Style\Font\$name, and PhpOffice\PhpSpreadsheet\Style\Font\getSharedComponent().

Referenced by PhpOffice\PhpSpreadsheet\Writer\Html\createCSSStyleFont(), PhpOffice\PhpSpreadsheet\Style\Font\exportArray1(), and PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style\writeFont().

205  {
206  if ($this->isSupervisor) {
207  return $this->getSharedComponent()->getName();
208  }
209 
210  return $this->name;
211  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Font.php:123
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSharedComponent()

PhpOffice\PhpSpreadsheet\Style\Font::getSharedComponent ( )

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

Only used for style supervisor.

Returns
Font

Definition at line 123 of file Font.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\getBold(), PhpOffice\PhpSpreadsheet\Style\Font\getHashCode(), PhpOffice\PhpSpreadsheet\Style\Font\getItalic(), PhpOffice\PhpSpreadsheet\Style\Font\getName(), PhpOffice\PhpSpreadsheet\Style\Font\getSize(), PhpOffice\PhpSpreadsheet\Style\Font\getStrikethrough(), PhpOffice\PhpSpreadsheet\Style\Font\getSubscript(), PhpOffice\PhpSpreadsheet\Style\Font\getSuperscript(), and PhpOffice\PhpSpreadsheet\Style\Font\getUnderline().

124  {
125  return $this->parent->getSharedComponent()->getFont();
126  }
+ Here is the caller graph for this function:

◆ getSize()

PhpOffice\PhpSpreadsheet\Style\Font::getSize ( )

Get Size.

Returns
null|float

Definition at line 240 of file Font.php.

References PhpOffice\PhpSpreadsheet\Style\Font\$size, and PhpOffice\PhpSpreadsheet\Style\Font\getSharedComponent().

Referenced by PhpOffice\PhpSpreadsheet\Writer\Html\createCSSStyleFont(), PhpOffice\PhpSpreadsheet\Style\Font\exportArray1(), and PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style\writeFont().

241  {
242  if ($this->isSupervisor) {
243  return $this->getSharedComponent()->getSize();
244  }
245 
246  return $this->size;
247  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Font.php:123
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStrikethrough()

PhpOffice\PhpSpreadsheet\Style\Font::getStrikethrough ( )

Get Strikethrough.

Returns
null|bool

Definition at line 463 of file Font.php.

References PhpOffice\PhpSpreadsheet\Style\Font\$strikethrough, and PhpOffice\PhpSpreadsheet\Style\Font\getSharedComponent().

Referenced by PhpOffice\PhpSpreadsheet\Writer\Html\createCSSStyleFont(), PhpOffice\PhpSpreadsheet\Style\Font\exportArray1(), and PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style\writeFont().

464  {
465  if ($this->isSupervisor) {
466  return $this->getSharedComponent()->getStrikethrough();
467  }
468 
469  return $this->strikethrough;
470  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Font.php:123
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getStyleArray()

◆ getSubscript()

PhpOffice\PhpSpreadsheet\Style\Font::getSubscript ( )

Get Subscript.

Returns
null|bool

Definition at line 389 of file Font.php.

References PhpOffice\PhpSpreadsheet\Style\Font\$subscript, and PhpOffice\PhpSpreadsheet\Style\Font\getSharedComponent().

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\exportArray1(), and PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style\writeFont().

390  {
391  if ($this->isSupervisor) {
392  return $this->getSharedComponent()->getSubscript();
393  }
394 
395  return $this->subscript;
396  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Font.php:123
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSuperscript()

PhpOffice\PhpSpreadsheet\Style\Font::getSuperscript ( )

Get Superscript.

Returns
null|bool

Definition at line 355 of file Font.php.

References PhpOffice\PhpSpreadsheet\Style\Font\$superscript, and PhpOffice\PhpSpreadsheet\Style\Font\getSharedComponent().

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\exportArray1(), and PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style\writeFont().

356  {
357  if ($this->isSupervisor) {
358  return $this->getSharedComponent()->getSuperscript();
359  }
360 
361  return $this->superscript;
362  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Font.php:123
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUnderline()

PhpOffice\PhpSpreadsheet\Style\Font::getUnderline ( )

Get Underline.

Returns
null|string

Definition at line 423 of file Font.php.

References PhpOffice\PhpSpreadsheet\Style\Font\$underline, and PhpOffice\PhpSpreadsheet\Style\Font\getSharedComponent().

Referenced by PhpOffice\PhpSpreadsheet\Writer\Html\createCSSStyleFont(), PhpOffice\PhpSpreadsheet\Style\Font\exportArray1(), PhpOffice\PhpSpreadsheet\Writer\Ods\Cell\Style\mapUnderlineStyle(), and PhpOffice\PhpSpreadsheet\Writer\Xlsx\Style\writeFont().

424  {
425  if ($this->isSupervisor) {
426  return $this->getSharedComponent()->getUnderline();
427  }
428 
429  return $this->underline;
430  }
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
Definition: Font.php:123
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setBold()

PhpOffice\PhpSpreadsheet\Style\Font::setBold (   $pValue)

Set Bold.

Parameters
bool$pValue
Returns
$this

Definition at line 299 of file Font.php.

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

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\applyFromArray(), and PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles\readFontStyle().

300  {
301  if ($pValue == '') {
302  $pValue = false;
303  }
304  if ($this->isSupervisor) {
305  $styleArray = $this->getStyleArray(['bold' => $pValue]);
306  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
307  } else {
308  $this->bold = $pValue;
309  }
310 
311  return $this;
312  }
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getStyleArray($array)
Build style array from subcomponents.
Definition: Font.php:135
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\Font::setColor ( Color  $pValue)

Set Color.

Returns
$this

Definition at line 510 of file Font.php.

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

511  {
512  // make sure parameter is a real color and not a supervisor
513  $color = $pValue->getIsSupervisor() ? $pValue->getSharedComponent() : $pValue;
514 
515  if ($this->isSupervisor) {
516  $styleArray = $this->getColor()->getStyleArray(['argb' => $color->getARGB()]);
517  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
518  } else {
519  $this->color = $color;
520  }
521 
522  return $this;
523  }
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:

◆ setItalic()

PhpOffice\PhpSpreadsheet\Style\Font::setItalic (   $pValue)

Set Italic.

Parameters
bool$pValue
Returns
$this

Definition at line 335 of file Font.php.

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

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\applyFromArray(), and PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles\readFontStyle().

336  {
337  if ($pValue == '') {
338  $pValue = false;
339  }
340  if ($this->isSupervisor) {
341  $styleArray = $this->getStyleArray(['italic' => $pValue]);
342  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
343  } else {
344  $this->italic = $pValue;
345  }
346 
347  return $this;
348  }
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getStyleArray($array)
Build style array from subcomponents.
Definition: Font.php:135
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:

◆ setName()

PhpOffice\PhpSpreadsheet\Style\Font::setName (   $fontname)

Set Name.

Parameters
string$fontname
Returns
$this

Definition at line 220 of file Font.php.

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

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\applyFromArray(), and PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles\readFontStyle().

221  {
222  if ($fontname == '') {
223  $fontname = 'Calibri';
224  }
225  if ($this->isSupervisor) {
226  $styleArray = $this->getStyleArray(['name' => $fontname]);
227  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
228  } else {
229  $this->name = $fontname;
230  }
231 
232  return $this;
233  }
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getStyleArray($array)
Build style array from subcomponents.
Definition: Font.php:135
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:

◆ setSize()

PhpOffice\PhpSpreadsheet\Style\Font::setSize (   $sizeInPoints)

Set Size.

Parameters
mixed$sizeInPointsA float representing the value of a positive measurement in points (1/72 of an inch)
Returns
$this

Definition at line 256 of file Font.php.

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

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\applyFromArray(), and PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles\readFontStyle().

257  {
258  if (is_string($sizeInPoints) || is_int($sizeInPoints)) {
259  $sizeInPoints = (float) $sizeInPoints; // $pValue = 0 if given string is not numeric
260  }
261 
262  // Size must be a positive floating point number
263  // ECMA-376-1:2016, part 1, chapter 18.4.11 sz (Font Size), p. 1536
264  if (!is_float($sizeInPoints) || !($sizeInPoints > 0)) {
265  $sizeInPoints = 10.0;
266  }
267 
268  if ($this->isSupervisor) {
269  $styleArray = $this->getStyleArray(['size' => $sizeInPoints]);
270  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
271  } else {
272  $this->size = $sizeInPoints;
273  }
274 
275  return $this;
276  }
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getStyleArray($array)
Build style array from subcomponents.
Definition: Font.php:135
font size
Definition: langcheck.php:162
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:

◆ setStrikethrough()

PhpOffice\PhpSpreadsheet\Style\Font::setStrikethrough (   $pValue)

Set Strikethrough.

Parameters
bool$pValue
Returns
$this

Definition at line 479 of file Font.php.

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

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\applyFromArray(), and PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles\readFontStyle().

480  {
481  if ($pValue == '') {
482  $pValue = false;
483  }
484 
485  if ($this->isSupervisor) {
486  $styleArray = $this->getStyleArray(['strikethrough' => $pValue]);
487  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
488  } else {
489  $this->strikethrough = $pValue;
490  }
491 
492  return $this;
493  }
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getStyleArray($array)
Build style array from subcomponents.
Definition: Font.php:135
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:

◆ setSubscript()

PhpOffice\PhpSpreadsheet\Style\Font::setSubscript ( bool  $pValue)

Set Subscript.

Returns
$this

Definition at line 403 of file Font.php.

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

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\applyFromArray(), PhpOffice\PhpSpreadsheet\Reader\Xls\Style\CellFont\escapement(), and PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles\readFontStyle().

404  {
405  if ($this->isSupervisor) {
406  $styleArray = $this->getStyleArray(['subscript' => $pValue]);
407  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
408  } else {
409  $this->subscript = $pValue;
410  if ($this->subscript) {
411  $this->superscript = false;
412  }
413  }
414 
415  return $this;
416  }
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getStyleArray($array)
Build style array from subcomponents.
Definition: Font.php:135
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:

◆ setSuperscript()

PhpOffice\PhpSpreadsheet\Style\Font::setSuperscript ( bool  $pValue)

Set Superscript.

Returns
$this

Definition at line 369 of file Font.php.

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

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\applyFromArray(), PhpOffice\PhpSpreadsheet\Reader\Xls\Style\CellFont\escapement(), and PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles\readFontStyle().

370  {
371  if ($this->isSupervisor) {
372  $styleArray = $this->getStyleArray(['superscript' => $pValue]);
373  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
374  } else {
375  $this->superscript = $pValue;
376  if ($this->superscript) {
377  $this->subscript = false;
378  }
379  }
380 
381  return $this;
382  }
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getStyleArray($array)
Build style array from subcomponents.
Definition: Font.php:135
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:

◆ setUnderline()

PhpOffice\PhpSpreadsheet\Style\Font::setUnderline (   $pValue)

Set Underline.

Parameters
bool | string$pValueunderline type If a boolean is passed, then TRUE equates to UNDERLINE_SINGLE, false equates to UNDERLINE_NONE
Returns
$this

Definition at line 441 of file Font.php.

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

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\applyFromArray(), PhpOffice\PhpSpreadsheet\Reader\Xlsx\Styles\readFontStyle(), and PhpOffice\PhpSpreadsheet\Reader\Xls\Style\CellFont\underline().

442  {
443  if (is_bool($pValue)) {
444  $pValue = ($pValue) ? self::UNDERLINE_SINGLE : self::UNDERLINE_NONE;
445  } elseif ($pValue == '') {
446  $pValue = self::UNDERLINE_NONE;
447  }
448  if ($this->isSupervisor) {
449  $styleArray = $this->getStyleArray(['underline' => $pValue]);
450  $this->getActiveSheet()->getStyle($this->getSelectedCells())->applyFromArray($styleArray);
451  } else {
452  $this->underline = $pValue;
453  }
454 
455  return $this;
456  }
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
Definition: Supervisor.php:87
getStyleArray($array)
Build style array from subcomponents.
Definition: Font.php:135
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:

Field Documentation

◆ $bold

PhpOffice\PhpSpreadsheet\Style\Font::$bold = false
protected

Definition at line 33 of file Font.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\getBold().

◆ $color

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

◆ $colorIndex

PhpOffice\PhpSpreadsheet\Style\Font::$colorIndex

Definition at line 80 of file Font.php.

◆ $italic

PhpOffice\PhpSpreadsheet\Style\Font::$italic = false
protected

Definition at line 40 of file Font.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\getItalic().

◆ $name

PhpOffice\PhpSpreadsheet\Style\Font::$name = 'Calibri'
protected

Definition at line 19 of file Font.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\getName().

◆ $size

PhpOffice\PhpSpreadsheet\Style\Font::$size = 11
protected

Definition at line 26 of file Font.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\getSize().

◆ $strikethrough

PhpOffice\PhpSpreadsheet\Style\Font::$strikethrough = false
protected

Definition at line 68 of file Font.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\getStrikethrough().

◆ $subscript

PhpOffice\PhpSpreadsheet\Style\Font::$subscript = false
protected

Definition at line 54 of file Font.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\getSubscript().

◆ $superscript

PhpOffice\PhpSpreadsheet\Style\Font::$superscript = false
protected

Definition at line 47 of file Font.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\getSuperscript().

◆ $underline

PhpOffice\PhpSpreadsheet\Style\Font::$underline = self::UNDERLINE_NONE
protected

Definition at line 61 of file Font.php.

Referenced by PhpOffice\PhpSpreadsheet\Style\Font\getUnderline().

◆ UNDERLINE_DOUBLE

const PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLE = 'double'

◆ UNDERLINE_DOUBLEACCOUNTING

const PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_DOUBLEACCOUNTING = 'doubleAccounting'

◆ UNDERLINE_NONE

const PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_NONE = 'none'

◆ UNDERLINE_SINGLE

const PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLE = 'single'

◆ UNDERLINE_SINGLEACCOUNTING

const PhpOffice\PhpSpreadsheet\Style\Font::UNDERLINE_SINGLEACCOUNTING = 'singleAccounting'

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