Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Class: Html  - X-Ref

__construct()   X-Ref
Create a new HTML Reader instance.


canRead($pFilename)   X-Ref
Validate that the current file is an HTML file.

param: string $pFilename
return: bool

readBeginning()   X-Ref
No description

readEnding()   X-Ref
No description

startsWithTag($data)   X-Ref
No description

endsWithTag($data)   X-Ref
No description

containsTags($data)   X-Ref
No description

load($pFilename)   X-Ref
Loads Spreadsheet from file.

param: string $pFilename
return: Spreadsheet

setInputEncoding($pValue)   X-Ref
Set input encoding.

param: string $pValue Input encoding, eg: 'ANSI'
return: $this

getInputEncoding()   X-Ref
Get input encoding.

return: string

setTableStartColumn($column)   X-Ref
No description

getTableStartColumn()   X-Ref
No description

releaseTableStartColumn()   X-Ref
No description

flushCell(Worksheet $sheet, $column, $row, &$cellContent)   X-Ref
No description

processDomElementBody(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child)   X-Ref
No description

processDomElementTitle(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray)   X-Ref
No description

processDomElementSpanEtc(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray)   X-Ref
No description

processDomElementHr(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray)   X-Ref
No description

processDomElementBr(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray)   X-Ref
No description

processDomElementA(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray)   X-Ref
No description

processDomElementH1Etc(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray)   X-Ref
No description

processDomElementLi(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray)   X-Ref
No description

processDomElementImg(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray)   X-Ref
No description

processDomElementTable(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray)   X-Ref
No description

processDomElementTr(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray)   X-Ref
No description

processDomElementThTdOther(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray)   X-Ref
No description

processDomElementBgcolor(Worksheet $sheet, int $row, string $column, array $attributeArray)   X-Ref
No description

processDomElementWidth(Worksheet $sheet, string $column, array $attributeArray)   X-Ref
No description

processDomElementHeight(Worksheet $sheet, int $row, array $attributeArray)   X-Ref
No description

processDomElementAlign(Worksheet $sheet, int $row, string $column, array $attributeArray)   X-Ref
No description

processDomElementVAlign(Worksheet $sheet, int $row, string $column, array $attributeArray)   X-Ref
No description

processDomElementDataFormat(Worksheet $sheet, int $row, string $column, array $attributeArray)   X-Ref
No description

processDomElementThTd(Worksheet $sheet, int &$row, string &$column, string &$cellContent, DOMElement $child, array &$attributeArray)   X-Ref
No description

processDomElement(DOMNode $element, Worksheet $sheet, int &$row, string &$column, string &$cellContent)   X-Ref
No description

loadIntoExisting($pFilename, Spreadsheet $spreadsheet)   X-Ref
Loads PhpSpreadsheet from file into PhpSpreadsheet instance.

param: string $pFilename
return: Spreadsheet

loadFromString($content, ?Spreadsheet $spreadsheet = null)   X-Ref
Spreadsheet from content.

param: string $content

loadDocument(DOMDocument $document, Spreadsheet $spreadsheet)   X-Ref
Loads PhpSpreadsheet from DOMDocument into PhpSpreadsheet instance.


getSheetIndex()   X-Ref
Get sheet index.

return: int

setSheetIndex($pValue)   X-Ref
Set sheet index.

param: int $pValue Sheet index
return: $this

applyInlineStyle(&$sheet, $row, $column, $attributeArray)   X-Ref
Apply inline css inline style.

NOTES :
Currently only intended for td & th element,
and only takes 'background-color' and 'color'; property with HEX color

TODO :
- Implement to other propertie, such as border

param: Worksheet $sheet
param: int $row
param: string $column
param: array $attributeArray

getStyleColor($value)   X-Ref
Check if has #, so we can get clean hex.

param: $value
return: null|string

insertImage(Worksheet $sheet, $column, $row, array $attributes)   X-Ref

param: string    $column
param: int       $row

getBorderMappings()   X-Ref
No description

getBorderStyle($style)   X-Ref
Map html border style to PhpSpreadsheet border style.

param: string $style
return: null|string

setBorderStyle(Style $cellStyle, $styleValue, $type)   X-Ref

param: string $styleValue
param: string $type