Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250620) (7d9030acd6e)
PhpOffice\PhpSpreadsheet\IOFactory Class Reference

Static Public Member Functions

static createReader (string $readerType)
 Create IReader.
 
static createReaderForFile (string $filename, ?array $readers=null)
 Create Reader::IReader for file using automatic IReader resolution.
 
static createWriter (Spreadsheet $spreadsheet, string $writerType)
 Create Writer::IWriter.
 
static identify (string $filename, ?array $readers=null, bool $fullClassName=false)
 Identify file type using automatic IReader resolution.
 
static load (string $filename, int $flags=0, ?array $readers=null)
 Loads Spreadsheet from file using automatic Reader::IReader resolution.
 
static registerReader (string $readerType, string $readerClass)
 Register a reader with its type and class name.
 
static registerWriter (string $writerType, string $writerClass)
 Register a writer with its type and class name.
 

Public Attributes

const READER_CSV = 'Csv'
 
const READER_GNUMERIC = 'Gnumeric'
 
const READER_HTML = 'Html'
 
const READER_ODS = 'Ods'
 
const READER_SLK = 'Slk'
 
const READER_SYLK = 'Slk'
 
const READER_XLS = 'Xls'
 
const READER_XLSX = 'Xlsx'
 
const READER_XML = 'Xml'
 
const WRITER_CSV = 'Csv'
 
const WRITER_HTML = 'Html'
 
const WRITER_ODS = 'Ods'
 
const WRITER_XLS = 'Xls'
 
const WRITER_XLSX = 'Xlsx'
 

Member Function Documentation

◆ createReaderForFile()

static PhpOffice\PhpSpreadsheet\IOFactory::createReaderForFile ( string $filename,
?array $readers = null )
static

Create Reader::IReader for file using automatic IReader resolution.

Parameters
string[]$readersAn array of Readers to use to identify the file type. By default, load() will try all possible Readers until it finds a match; but this allows you to pass in a list of Readers so it will only try the subset that you specify here. Values in this list can be any of the constant values defined in the set IOFactory::READER_*.

◆ load()

static PhpOffice\PhpSpreadsheet\IOFactory::load ( string $filename,
int $flags = 0,
?array $readers = null )
static

Loads Spreadsheet from file using automatic Reader::IReader resolution.

Parameters
string$filenameThe name of the spreadsheet file
int$flagsthe optional second parameter flags may be used to identify specific elements that should be loaded, but which won't be loaded by default, using these values: IReader::LOAD_WITH_CHARTS - Include any charts that are defined in the loaded file. IReader::READ_DATA_ONLY - Read cell values only, not formatting or merge structure. IReader::IGNORE_EMPTY_CELLS - Don't load empty cells into the model.
string[]$readersAn array of Readers to use to identify the file type. By default, load() will try all possible Readers until it finds a match; but this allows you to pass in a list of Readers so it will only try the subset that you specify here. Values in this list can be any of the constant values defined in the set IOFactory::READER_*.

◆ registerReader()

static PhpOffice\PhpSpreadsheet\IOFactory::registerReader ( string $readerType,
string $readerClass )
static

Register a reader with its type and class name.

Parameters
class-string<IReader>$readerClass

◆ registerWriter()

static PhpOffice\PhpSpreadsheet\IOFactory::registerWriter ( string $writerType,
string $writerClass )
static

Register a writer with its type and class name.

Parameters
class-string<IWriter>$writerClass

The documentation for this class was generated from the following file: