Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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

(no description)

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

Defines 1 class


Class: Csv  - X-Ref

__construct(Spreadsheet $spreadsheet)   X-Ref
Create a new CSV.

param: Spreadsheet $spreadsheet Spreadsheet object

save($filename, int $flags = 0)   X-Ref
Save PhpSpreadsheet to file.

param: resource|string $filename

getDelimiter()   X-Ref
Get delimiter.

return: string

setDelimiter($delimiter)   X-Ref
Set delimiter.

return: $this
param: string $delimiter Delimiter, defaults to ','

getEnclosure()   X-Ref
Get enclosure.

return: string

setEnclosure($enclosure = '"')   X-Ref
Set enclosure.

return: $this
param: string $enclosure Enclosure, defaults to "

getLineEnding()   X-Ref
Get line ending.

return: string

setLineEnding($lineEnding)   X-Ref
Set line ending.

return: $this
param: string $lineEnding Line ending, defaults to OS line ending (PHP_EOL)

getUseBOM()   X-Ref
Get whether BOM should be used.

return: bool

setUseBOM($useBOM)   X-Ref
Set whether BOM should be used.

return: $this
param: bool $useBOM Use UTF-8 byte-order mark? Defaults to false

getIncludeSeparatorLine()   X-Ref
Get whether a separator line should be included.

return: bool

setIncludeSeparatorLine($includeSeparatorLine)   X-Ref
Set whether a separator line should be included as the first line of the file.

return: $this
param: bool $includeSeparatorLine Use separator line? Defaults to false

getExcelCompatibility()   X-Ref
Get whether the file should be saved with full Excel Compatibility.

return: bool

setExcelCompatibility($excelCompatibility)   X-Ref
Set whether the file should be saved with full Excel Compatibility.

return: $this
param: bool $excelCompatibility Set the file to be written as a fully Excel compatible csv file

getSheetIndex()   X-Ref
Get sheet index.

return: int

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

return: $this
param: int $sheetIndex Sheet index

getOutputEncoding()   X-Ref
Get output encoding.

return: string

setOutputEncoding($outputEnconding)   X-Ref
Set output encoding.

return: $this
param: string $outputEnconding Output encoding

setEnclosureRequired(bool $value)   X-Ref
No description

getEnclosureRequired()   X-Ref
No description

elementToString($element)   X-Ref
Convert boolean to TRUE/FALSE; otherwise return element cast to string.

param: mixed $element

writeLine($fileHandle, array $values)   X-Ref
Write line to CSV file.

param: resource $fileHandle PHP filehandle
param: array $values Array containing values in a row