PHP Class Box\Spout\Writer\XLSX\Internal\Worksheet

Datei anzeigen Open project: box/spout

Protected Properties

Property Type Description
$externalSheet The "external" sheet
$lastWrittenRowIndex Index of the last written row
$sharedStringsHelper Helper to write shared strings
$sheetFilePointer Pointer to the sheet data file (e.g. xl/worksheets/sheet1.xml)
$shouldUseInlineStrings Whether inline or shared strings should be used
$stringHelper String helper
$stringsEscaper Strings escaper
$styleHelper Helper to work with styles
$worksheetFilePath Path to the XML file that will contain the sheet data

Public Methods

Method Description
__construct ( Sheet $externalSheet, string $worksheetFilesFolder, Box\Spout\Writer\XLSX\Helper\SharedStringsHelper $sharedStringsHelper, $styleHelper, boolean $shouldUseInlineStrings )
addRow ( array $dataRow, Style $style ) : void Adds data to the worksheet.
close ( ) : void Closes the worksheet
getExternalSheet ( ) : Sheet
getId ( ) : integer
getLastWrittenRowIndex ( ) : integer

Protected Methods

Method Description
startSheet ( ) : void Prepares the worksheet to accept data
throwIfSheetFilePointerIsNotAvailable ( ) : void Checks if the book has been created. Throws an exception if not created yet.

Private Methods

Method Description
addNonEmptyRow ( array $dataRow, Style $style ) : void Adds non empty row to the worksheet.
getCellXML ( integer $rowIndex, integer $cellNumber, mixed $cellValue, integer $styleId ) : string Build and return xml for a single cell.
getCellXMLFragmentForNonEmptyString ( string $cellValue ) : string Returns the XML fragment for a cell containing a non empty string
isEmptyRow ( array $dataRow ) : boolean Returns whether the given row is empty

Method Details

__construct() public method

public __construct ( Sheet $externalSheet, string $worksheetFilesFolder, Box\Spout\Writer\XLSX\Helper\SharedStringsHelper $sharedStringsHelper, $styleHelper, boolean $shouldUseInlineStrings )
$externalSheet Box\Spout\Writer\Common\Sheet The associated "external" sheet
$worksheetFilesFolder string Temporary folder where the files to create the XLSX will be stored
$sharedStringsHelper Box\Spout\Writer\XLSX\Helper\SharedStringsHelper Helper for shared strings
$shouldUseInlineStrings boolean Whether inline or shared strings should be used

addRow() public method

Adds data to the worksheet.
public addRow ( array $dataRow, Style $style ) : void
$dataRow array Array containing data to be written. Cannot be empty. Example $dataRow = ['data1', 1234, null, '', 'data5'];
$style Box\Spout\Writer\Style\Style Style to be applied to the row. NULL means use default style.
return void

close() public method

Closes the worksheet
public close ( ) : void
return void

getExternalSheet() public method

public getExternalSheet ( ) : Sheet
return Box\Spout\Writer\Common\Sheet The "external" sheet

getId() public method

public getId ( ) : integer
return integer The ID of the worksheet

getLastWrittenRowIndex() public method

public getLastWrittenRowIndex ( ) : integer
return integer The index of the last written row

startSheet() protected method

Prepares the worksheet to accept data
protected startSheet ( ) : void
return void

throwIfSheetFilePointerIsNotAvailable() protected method

Checks if the book has been created. Throws an exception if not created yet.

Property Details

$externalSheet protected_oe property

The "external" sheet
protected $externalSheet

$lastWrittenRowIndex protected_oe property

Index of the last written row
protected $lastWrittenRowIndex

$sharedStringsHelper protected_oe property

Helper to write shared strings
protected $sharedStringsHelper

$sheetFilePointer protected_oe property

Pointer to the sheet data file (e.g. xl/worksheets/sheet1.xml)
protected $sheetFilePointer

$shouldUseInlineStrings protected_oe property

Whether inline or shared strings should be used
protected $shouldUseInlineStrings

$stringHelper protected_oe property

String helper
protected $stringHelper

$stringsEscaper protected_oe property

Strings escaper
protected $stringsEscaper

$styleHelper protected_oe property

Helper to work with styles
protected $styleHelper

$worksheetFilePath protected_oe property

Path to the XML file that will contain the sheet data
protected $worksheetFilePath