Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
OpenSpout\Writer\AbstractWriter Class Reference
Inheritance diagram for OpenSpout\Writer\AbstractWriter:
OpenSpout\Writer\WriterInterface OpenSpout\Writer\AbstractWriterMultiSheets OpenSpout\Writer\CSV\Writer OpenSpout\Writer\ODS\Writer OpenSpout\Writer\XLSX\Writer

Public Member Functions

 addRow (Row $row)
 Appends a row to the end of the stream.
 
 addRows (array $rows)
 Appends the rows to the end of the stream.
 
 close ()
 Closes the writer.
 
 getWrittenRowCount ()
 
 openToBrowser ($outputFileName)
 @codeCoverageIgnore
 
 openToBrowser (string $outputFileName)
 Initializes the writer and opens it to accept data.
 
 openToFile ($outputFilePath)
 
 openToFile (string $outputFilePath)
 
 setCreator (string $creator)
 Set document creator.
 

Protected Member Functions

 addRowToWriter (Row $row)
 Adds a row to the currently opened writer.
 
 closeWriter ()
 Closes the streamer, preventing any additional writing.
 
 openWriter ()
 Opens the streamer and makes it ready to accept data.
 

Protected Attributes

string string $creator = 'OpenSpout'
 document creator
 
resource file home runner work phpdoc phpdoc moodle lib openspout src Writer AbstractWriter php $filePointer
 Pointer to the file/stream we will write to.
 

Static Protected Attributes

static string string $headerContentType
 Content-Type value for the header - to be defined by child class.
 

Member Function Documentation

◆ addRow()

OpenSpout\Writer\AbstractWriter::addRow ( Row $row)
final

Appends a row to the end of the stream.

Parameters
Row$rowThe row to be appended to the stream
Exceptions
OpenSpout\Writer\Exception\WriterNotOpenedExceptionIf the writer has not been opened yet
OpenSpout\Common\Exception\IOExceptionIf unable to write data

Implements OpenSpout\Writer\WriterInterface.

◆ addRows()

OpenSpout\Writer\AbstractWriter::addRows ( array $rows)
final

Appends the rows to the end of the stream.

Parameters
Row[]$rowsThe rows to be appended to the stream
Exceptions
OpenSpout\Common\Exception\InvalidArgumentExceptionIf the input param is not valid
OpenSpout\Writer\Exception\WriterNotOpenedExceptionIf the writer has not been opened yet
OpenSpout\Common\Exception\IOExceptionIf unable to write data

Implements OpenSpout\Writer\WriterInterface.

◆ addRowToWriter()

OpenSpout\Writer\AbstractWriter::addRowToWriter ( Row $row)
abstractprotected

Adds a row to the currently opened writer.

Parameters
Row$rowThe row containing cells and styles
Exceptions
WriterNotOpenedExceptionIf the workbook is not created yet
IOExceptionIf unable to write data

Reimplemented in OpenSpout\Writer\AbstractWriterMultiSheets, and OpenSpout\Writer\CSV\Writer.

◆ close()

OpenSpout\Writer\AbstractWriter::close ( )
final

Closes the writer.

This will close the streamer as well, preventing new data to be written to the file.

Implements OpenSpout\Writer\WriterInterface.

◆ closeWriter()

OpenSpout\Writer\AbstractWriter::closeWriter ( )
abstractprotected

Closes the streamer, preventing any additional writing.

Reimplemented in OpenSpout\Writer\AbstractWriterMultiSheets, and OpenSpout\Writer\CSV\Writer.

◆ getWrittenRowCount()

OpenSpout\Writer\AbstractWriter::getWrittenRowCount ( )
final
Return values
0|positive-int

Implements OpenSpout\Writer\WriterInterface.

◆ openToBrowser() [1/2]

OpenSpout\Writer\AbstractWriter::openToBrowser ( $outputFileName)
final

@codeCoverageIgnore

Parameters
mixed$outputFileName

◆ openToBrowser() [2/2]

OpenSpout\Writer\WriterInterface::openToBrowser ( string $outputFileName)
inherited

Initializes the writer and opens it to accept data.

By using this method, the data will be outputted directly to the browser.

Parameters
string$outputFileNameName of the output file that will contain the data. If a path is passed in, only the file name will be kept
Exceptions
OpenSpout\Common\Exception\IOExceptionIf the writer cannot be opened

◆ openWriter()

OpenSpout\Writer\AbstractWriter::openWriter ( )
abstractprotected

Opens the streamer and makes it ready to accept data.

Exceptions
IOExceptionIf the writer cannot be opened

Reimplemented in OpenSpout\Writer\AbstractWriterMultiSheets, and OpenSpout\Writer\CSV\Writer.

◆ setCreator()

OpenSpout\Writer\AbstractWriter::setCreator ( string $creator)
final

Set document creator.

Parameters
string$creatordocument creator

Implements OpenSpout\Writer\WriterInterface.


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