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

Public Member Functions

 __construct (?Options $options=null)
 
 addNewSheetAndMakeItCurrent ()
 Creates a new sheet and make it the current sheet.
 
 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.
 
 getCurrentSheet ()
 Returns the current sheet.
 
 getOptions ()
 
 getSheets ()
 
 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.
 
 setCurrentSheet (Sheet $sheet)
 Sets the given sheet as the current one.
 

Protected Member Functions

 addRowToWriter (Row $row)
 
 closeWriter ()
 Closes the streamer, preventing any additional writing.
 
 createWorkbookManager ()
 
 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

string file home runner work phpdoc phpdoc moodle lib openspout src Writer XLSX Writer php static string $headerContentType = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
 Content-Type value for the header.
 

Member Function Documentation

◆ addNewSheetAndMakeItCurrent()

OpenSpout\Writer\AbstractWriterMultiSheets::addNewSheetAndMakeItCurrent ( )
finalinherited

Creates a new sheet and make it the current sheet.

The data will now be written to this sheet.

Return values
SheetThe created sheet
Exceptions
IOException
WriterNotOpenedExceptionIf the writer has not been opened yet

◆ addRow()

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

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)
finalinherited

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\AbstractWriterMultiSheets::addRowToWriter ( Row $row)
protectedinherited
Exceptions
Exception\WriterException

Reimplemented from OpenSpout\Writer\AbstractWriter.

◆ close()

OpenSpout\Writer\AbstractWriter::close ( )
finalinherited

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\AbstractWriterMultiSheets::closeWriter ( )
protectedinherited

Closes the streamer, preventing any additional writing.

Reimplemented from OpenSpout\Writer\AbstractWriter.

◆ createWorkbookManager()

OpenSpout\Writer\XLSX\Writer::createWorkbookManager ( )
protected

◆ getCurrentSheet()

OpenSpout\Writer\AbstractWriterMultiSheets::getCurrentSheet ( )
finalinherited

Returns the current sheet.

Return values
SheetThe current sheet
Exceptions
WriterNotOpenedExceptionIf the writer has not been opened yet

◆ getWrittenRowCount()

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

Implements OpenSpout\Writer\WriterInterface.

◆ openToBrowser() [1/2]

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

@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\AbstractWriterMultiSheets::openWriter ( )
protectedinherited

Opens the streamer and makes it ready to accept data.

Exceptions
IOExceptionIf the writer cannot be opened

Reimplemented from OpenSpout\Writer\AbstractWriter.

◆ setCreator()

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

Set document creator.

Parameters
string$creatordocument creator

Implements OpenSpout\Writer\WriterInterface.

◆ setCurrentSheet()

OpenSpout\Writer\AbstractWriterMultiSheets::setCurrentSheet ( Sheet $sheet)
finalinherited

Sets the given sheet as the current one.

New data will be written to this sheet. The writing will resume where it stopped (i.e. data won't be truncated).

Parameters
Sheet$sheetThe sheet to set as current
Exceptions
SheetNotFoundExceptionIf the given sheet does not exist in the workbook
WriterNotOpenedExceptionIf the writer has not been opened yet

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