Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Class: Html  - X-Ref

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


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


readBeginning()   X-Ref
No description

readEnding()   X-Ref
No description

startsWithTag(string $data)   X-Ref
No description

endsWithTag(string $data)   X-Ref
No description

containsTags(string $data)   X-Ref
No description

loadSpreadsheetFromFile(string $filename)   X-Ref
Loads Spreadsheet from file.


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

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

getInputEncoding()   X-Ref
Get input encoding.

return: string

setTableStartColumn(string $column)   X-Ref
No description

getTableStartColumn()   X-Ref
No description

releaseTableStartColumn()   X-Ref
No description

flushCell(Worksheet $sheet, $column, $row, &$cellContent)   X-Ref
Flush cell.

param: string $column
param: int|string $row
param: mixed $cellContent

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($filename, Spreadsheet $spreadsheet)   X-Ref
Loads PhpSpreadsheet from file into PhpSpreadsheet instance.

param: string $filename
return: Spreadsheet

replaceNonAscii(array $matches)   X-Ref
No description

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($sheetIndex)   X-Ref
Set sheet index.

param: int $sheetIndex Sheet index
return: $this

applyInlineStyle(Worksheet &$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: int $row
param: string $column
param: array $attributeArray

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

param: mixed $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