102 $this->italic =
null;
103 $this->superscript =
null;
104 $this->subscript =
null;
105 $this->underline =
null;
106 $this->strikethrough =
null;
113 $this->
color->bindParent($this,
'color');
125 return $this->parent->getSharedComponent()->getFont();
137 return [
'font' => $array];
164 if ($this->isSupervisor) {
167 if (isset($pStyles[
'name'])) {
168 $this->
setName($pStyles[
'name']);
170 if (isset($pStyles[
'bold'])) {
171 $this->
setBold($pStyles[
'bold']);
173 if (isset($pStyles[
'italic'])) {
176 if (isset($pStyles[
'superscript'])) {
179 if (isset($pStyles[
'subscript'])) {
182 if (isset($pStyles[
'underline'])) {
185 if (isset($pStyles[
'strikethrough'])) {
188 if (isset($pStyles[
'color'])) {
189 $this->
getColor()->applyFromArray($pStyles[
'color']);
191 if (isset($pStyles[
'size'])) {
192 $this->
setSize($pStyles[
'size']);
206 if ($this->isSupervisor) {
222 if ($fontname ==
'') {
223 $fontname =
'Calibri';
225 if ($this->isSupervisor) {
229 $this->name = $fontname;
242 if ($this->isSupervisor) {
258 if (is_string($sizeInPoints) || is_int($sizeInPoints)) {
259 $sizeInPoints = (float) $sizeInPoints;
264 if (!is_float($sizeInPoints) || !($sizeInPoints > 0)) {
265 $sizeInPoints = 10.0;
268 if ($this->isSupervisor) {
269 $styleArray = $this->
getStyleArray([
'size' => $sizeInPoints]);
272 $this->
size = $sizeInPoints;
285 if ($this->isSupervisor) {
304 if ($this->isSupervisor) {
308 $this->bold = $pValue;
321 if ($this->isSupervisor) {
340 if ($this->isSupervisor) {
344 $this->italic = $pValue;
357 if ($this->isSupervisor) {
371 if ($this->isSupervisor) {
372 $styleArray = $this->
getStyleArray([
'superscript' => $pValue]);
375 $this->superscript = $pValue;
376 if ($this->superscript) {
377 $this->subscript =
false;
391 if ($this->isSupervisor) {
405 if ($this->isSupervisor) {
406 $styleArray = $this->
getStyleArray([
'subscript' => $pValue]);
409 $this->subscript = $pValue;
410 if ($this->subscript) {
411 $this->superscript =
false;
425 if ($this->isSupervisor) {
443 if (is_bool($pValue)) {
444 $pValue = ($pValue) ? self::UNDERLINE_SINGLE : self::UNDERLINE_NONE;
445 } elseif ($pValue ==
'') {
448 if ($this->isSupervisor) {
449 $styleArray = $this->
getStyleArray([
'underline' => $pValue]);
452 $this->underline = $pValue;
465 if ($this->isSupervisor) {
485 if ($this->isSupervisor) {
486 $styleArray = $this->
getStyleArray([
'strikethrough' => $pValue]);
489 $this->strikethrough = $pValue;
515 if ($this->isSupervisor) {
516 $styleArray = $this->
getColor()->getStyleArray([
'argb' =>
$color->getARGB()]);
532 if ($this->isSupervisor) {
539 ($this->bold ?
't' :
'f') .
540 ($this->italic ?
't' :
'f') .
541 ($this->superscript ?
't' :
'f') .
542 ($this->subscript ?
't' :
'f') .
544 ($this->strikethrough ?
't' :
'f') .
545 $this->
color->getHashCode() .
563 return $exportedArray;
An exception for terminatinating execution or to throw for unit testing.
setBold($pValue)
Set Bold.
getSubscript()
Get Subscript.
getStrikethrough()
Get Strikethrough.
const UNDERLINE_SINGLEACCOUNTING
getSharedComponent()
Get the shared style component for the currently active cell in currently active sheet.
setColor(Color $pValue)
Set Color.
getHashCode()
Get hash code.
setSize($sizeInPoints)
Set Size.
setItalic($pValue)
Set Italic.
setName($fontname)
Set Name.
__construct($isSupervisor=false, $isConditional=false)
Create a new Font.
applyFromArray(array $pStyles)
Apply styles from array.
getSuperscript()
Get Superscript.
setStrikethrough($pValue)
Set Strikethrough.
getStyleArray($array)
Build style array from subcomponents.
setSubscript(bool $pValue)
Set Subscript.
const UNDERLINE_DOUBLEACCOUNTING
setUnderline($pValue)
Set Underline.
getUnderline()
Get Underline.
setSuperscript(bool $pValue)
Set Superscript.
exportArray1()
Abstract method to be implemented in anything which extends this class.
getActiveSheet()
Get the currently active sheet.
getSelectedCells()
Get the currently active cell coordinate in currently active sheet.
getIsSupervisor()
Is this a supervisor or a cell style component?
exportArray2(array &$exportedArray, string $index, $objOrValue)
Populate array from exportArray1.
if(PHP_SAPI !='cli') color