Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 310 and 311] [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]

(no description)

File Size: 641 lines (21 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Style:: (19 methods):
  __construct()
  getSharedComponent()
  getParent()
  getStyleArray()
  applyFromArray()
  getFill()
  getFont()
  setFont()
  getBorders()
  getAlignment()
  getNumberFormat()
  getConditionalStyles()
  setConditionalStyles()
  getProtection()
  getQuotePrefix()
  setQuotePrefix()
  getHashCode()
  getIndex()
  setIndex()


Class: Style  - X-Ref

__construct($isSupervisor = false, $isConditional = false)   X-Ref
Create a new Style.

param: bool $isSupervisor Flag indicating if this is a supervisor or not
param: bool $isConditional Flag indicating if this is a conditional style or not

getSharedComponent()   X-Ref
Get the shared style component for the currently active cell in currently active sheet.
Only used for style supervisor.

return: Style

getParent()   X-Ref
Get parent. Only used for style supervisor.

return: Spreadsheet

getStyleArray($array)   X-Ref
Build style array from subcomponents.

param: array $array
return: array

applyFromArray(array $pStyles, $pAdvanced = true)   X-Ref
Apply styles from array.

<code>
$spreadsheet->getActiveSheet()->getStyle('B2')->applyFromArray(
[
'font' => [
'name' => 'Arial',
'bold' => true,
'italic' => false,
'underline' => Font::UNDERLINE_DOUBLE,
'strikethrough' => false,
'color' => [
'rgb' => '808080'
]
],
'borders' => [
'bottom' => [
'borderStyle' => Border::BORDER_DASHDOT,
'color' => [
'rgb' => '808080'
]
],
'top' => [
'borderStyle' => Border::BORDER_DASHDOT,
'color' => [
'rgb' => '808080'
]
]
],
'alignment' => [
'horizontal' => Alignment::HORIZONTAL_CENTER,
'vertical' => Alignment::VERTICAL_CENTER,
'wrapText' => true,
],
'quotePrefix'    => true
]
);
</code>

param: array $pStyles Array containing style information
param: bool $pAdvanced advanced mode for setting borders
return: Style

getFill()   X-Ref
Get Fill.

return: Fill

getFont()   X-Ref
Get Font.

return: Font

setFont(Font $font)   X-Ref
Set font.

param: Font $font
return: Style

getBorders()   X-Ref
Get Borders.

return: Borders

getAlignment()   X-Ref
Get Alignment.

return: Alignment

getNumberFormat()   X-Ref
Get Number Format.

return: NumberFormat

getConditionalStyles()   X-Ref
Get Conditional Styles. Only used on supervisor.

return: Conditional[]

setConditionalStyles(array $pValue)   X-Ref
Set Conditional Styles. Only used on supervisor.

param: Conditional[] $pValue Array of conditional styles
return: Style

getProtection()   X-Ref
Get Protection.

return: Protection

getQuotePrefix()   X-Ref
Get quote prefix.

return: bool

setQuotePrefix($pValue)   X-Ref
Set quote prefix.

param: bool $pValue
return: Style

getHashCode()   X-Ref
Get hash code.

return: string Hash code

getIndex()   X-Ref
Get own index in style collection.

return: int

setIndex($pValue)   X-Ref
Set own index in style collection.

param: int $pValue