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.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 401 and 402] [Versions 401 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.

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

getEnclosure()   X-Ref
Get enclosure.

return: string

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

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

getLineEnding()   X-Ref
Get line ending.

return: string

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

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

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

return: bool

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

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

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.

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

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.

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

getSheetIndex()   X-Ref
Get sheet index.

return: int

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

param: int $sheetIndex Sheet index
return: $this

getOutputEncoding()   X-Ref
Get output encoding.

return: string

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

param: string $outputEnconding Output encoding
return: $this

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