Class \avadim\FastExcelWriter\Sheet
On this page
- __construct()
- Parameters
- addCellStyle()
- Parameters
- addChart()
- Parameters
- addConditionalFormatting()
- Parameters
- addDataValidation()
- Parameters
- addImage()
- Parameters
- Examples
- addNamedRange()
- Parameters
- Examples
- addNote()
- Parameters
- Examples
- addStyle()
- Parameters
- allowAutoFilter()
- Parameters
- allowDeleteColumns()
- Parameters
- allowDeleteRows()
- Parameters
- allowEditObjects()
- Parameters
- allowEditScenarios()
- Parameters
- allowFormatCells()
- Parameters
- allowFormatColumns()
- Parameters
- allowFormatRows()
- Parameters
- allowInsertColumns()
- Parameters
- allowInsertHyperlinks()
- Parameters
- allowInsertRows()
- Parameters
- allowPivotTables()
- Parameters
- allowSelectCells()
- Parameters
- allowSelectLockedCells()
- Parameters
- allowSelectUnlockedCells()
- Parameters
- allowSort()
- Parameters
- applyAlignLeft()
- Parameters
- applyAlignRight()
- Parameters
- applyBgColor()
- Parameters
- applyBorder()
- Parameters
- applyBorderBottom()
- Parameters
- applyBorderLeft()
- Parameters
- applyBorderRight()
- Parameters
- applyBorderTop()
- Parameters
- applyColor()
- Parameters
- applyConditionalFormatting()
- Parameters
- applyDataValidation()
- Parameters
- applyFillColor()
- Parameters
- applyFillGradient()
- Parameters
- applyFont()
- Parameters
- applyFontColor()
- Parameters
- applyFontName()
- Parameters
- applyFontSize()
- Parameters
- applyFontStyle()
- Parameters
- applyFontStyleBold()
- Parameters
- applyFontStyleItalic()
- Parameters
- applyFontStyleStrikethrough()
- Parameters
- applyFontStyleUnderline()
- Parameters
- applyFormat()
- Parameters
- applyHide()
- Parameters
- applyIndentDistributed()
- Parameters
- applyIndentLeft()
- Parameters
- applyIndentRight()
- Parameters
- applyBorderInner()
- Parameters
- applyBorderOuter()
- Parameters
- applyInnerBorder()
- Parameters
- applyNamedRange()
- Parameters
- applyOuterBorder()
- Parameters
- applyRowHeight()
- Parameters
- applyRowOutlineLevel()
- Parameters
- applyStyle()
- Parameters
- applyTextAlign()
- Parameters
- applyTextCenter()
- Parameters
- applyTextColor()
- Parameters
- applyTextRotation()
- Parameters
- applyTextWrap()
- Parameters
- applyUnlock()
- Parameters
- applyVerticalAlign()
- Parameters
- beginArea()
- Parameters
- beginOutlineLevel()
- Parameters
- cell()
- Parameters
- Examples
- clearAreas()
- Parameters
- endAreas()
- Parameters
- endOutlineLevel()
- Parameters
- getCharts()
- Parameters
- getColAttributes()
- Parameters
- getConditionalFormatting()
- Parameters
- getCurrentCell()
- Parameters
- getCurrentCol()
- Parameters
- getCurrentColId()
- Parameters
- getCurrentRow()
- Parameters
- getCurrentRowId()
- Parameters
- getDataValidations()
- Parameters
- getDefaultStyle()
- Parameters
- getHeaderFooterOptions()
- Parameters
- getHyperlinks()
- Parameters
- getImages()
- Parameters
- getLastCell()
- Parameters
- getLastRange()
- Parameters
- getMergedCells()
- Parameters
- getName()
- Parameters
- getNamedRanges()
- Parameters
- getNotes()
- Parameters
- getOutlineLevel()
- Parameters
- isName()
- Parameters
- isRightToLeft()
- Parameters
- makeArea()
- Parameters
- mergeCells()
- Parameters
- Examples
- mergeRelCells()
- Parameters
- Examples
- nextCell()
- Parameters
- nextRow()
- Parameters
- pageFitToHeight()
- Parameters
- pageFitToWidth()
- Parameters
- pageFooter()
- Parameters
- pageFooterEven()
- Parameters
- pageFooterFirst()
- Parameters
- pageFooterOdd()
- Parameters
- pageHeader()
- Parameters
- pageHeaderEven()
- Parameters
- pageHeaderFirst()
- Parameters
- pageHeaderFooter()
- Parameters
- pageHeaderOdd()
- Parameters
- pageLandscape()
- Parameters
- pageMarginBottom()
- Parameters
- pageMarginFooter()
- Parameters
- pageMarginHeader()
- Parameters
- pageMarginLeft()
- Parameters
- pageMarginRight()
- Parameters
- pageMargins()
- Parameters
- pageMarginTop()
- Parameters
- pageOrientationLandscape()
- Parameters
- pageOrientationPortrait()
- Parameters
- pagePaperHeight()
- Parameters
- pagePaperSize()
- Parameters
- pagePaperSizeA3()
- Parameters
- pagePaperSizeA4()
- Parameters
- pagePaperSizeLegal()
- Parameters
- pagePaperSizeLetter()
- Parameters
- pagePaperWidth()
- Parameters
- pagePortrait()
- Parameters
- pageScale()
- Parameters
- protect()
- Parameters
- setActiveCell()
- Parameters
- setAutoFilter()
- Parameters
- Examples
- setBgColor()
- Parameters
- setBottomNodesOptions()
- Parameters
- setCellStyle()
- Parameters
- setColAutoWidth()
- Parameters
- setColDataStyle()
- Parameters
- Examples
- setColDataStyleArray()
- Parameters
- Examples
- setColFormat()
- Parameters
- setColFormats()
- Parameters
- setColFormula()
- Parameters
- setColHidden()
- Parameters
- setColMinWidth()
- Parameters
- setColMinWidths()
- Parameters
- Examples
- setColOutlineLevel()
- Parameters
- setColStyle()
- Parameters
- Examples
- setColStyleArray()
- Parameters
- Examples
- setColVisible()
- Parameters
- setColWidth()
- Parameters
- setColWidthAuto()
- Parameters
- Examples
- setColWidths()
- Parameters
- Examples
- setDefaultFont()
- Parameters
- setDefaultFontColor()
- Parameters
- setDefaultFontName()
- Parameters
- setDefaultFontSize()
- Parameters
- setDefaultFontStyle()
- Parameters
- setDefaultFontStyleBold()
- Parameters
- setDefaultFontStyleItalic()
- Parameters
- setDefaultFontStyleStrikethrough()
- Parameters
- setDefaultFontStyleUnderline()
- Parameters
- setDefaultStyle()
- Parameters
- setFormat()
- Parameters
- setFormula()
- Parameters
- Examples
- setFreeze()
- Parameters
- Examples
- setFreezeColumns()
- Parameters
- setFreezeRows()
- Parameters
- setName()
- Parameters
- setOuterBorder()
- Parameters
- setPrintArea()
- Parameters
- setPrintCentered()
- Parameters
- setPrintGridlines()
- Parameters
- setPrintHorizontalCentered()
- Parameters
- setPrintLeftColumns()
- Parameters
- setPrintRowAndColumnHeading()
- Parameters
- setPrintTitles()
- Parameters
- setPrintTopRows()
- Parameters
- setPrintVerticalCentered()
- Parameters
- setRowDataStyle()
- Parameters
- Examples
- setRowDataStyleArray()
- Parameters
- Examples
- setRowHeight()
- Parameters
- setRowHeights()
- Parameters
- setRowHidden()
- Parameters
- setRowOutlineLevel()
- Parameters
- Examples
- setRowStyle()
- Parameters
- Examples
- setRowStyleArray()
- Parameters
- Examples
- setRowVisible()
- Parameters
- setShowGridLines()
- Parameters
- setStateHidden()
- Parameters
- setStateVeryHidden()
- Parameters
- setStateVisible()
- Parameters
- setStyle()
- Parameters
- setTabColor()
- Parameters
- setTopLeftCell()
- Parameters
- Examples
- setValue()
- Parameters
- Examples
- skipRow()
- Parameters
- unprotect()
- Parameters
- withLastCell()
- Parameters
- withLastRow()
- Parameters
- withRange()
- Parameters
- writeArray()
- Parameters
- writeArrayTo()
- Parameters
- writeCell()
- Parameters
- writeCells()
- Parameters
- writeHeader()
- Parameters
- Examples
- writeRow()
- Parameters
- writeRows()
- Parameters
- writeTo()
- Parameters
- Examples
- __construct() – Sheet constructor
- addCellStyle() – Add additional styles to a cell
- addChart() – Add a chart object to the specified range of cells
- addConditionalFormatting() – Add a conditional formatting object to the specified range of cells
- addDataValidation() – Add a data validation object to the specified range of cells
- addImage() – Add an image to the sheet from a local file, URL or image string in base64
- addNamedRange() – Define named range
- addNote() – Add a note to the sheet
- addStyle() – Alias for 'addCellStyle()'
- allowAutoFilter() – AutoFilters should be allowed to operate when the sheet is protected
- allowDeleteColumns() – Deleting columns should be allowed when the sheet is protected
- allowDeleteRows() – Deleting rows should be allowed when the sheet is protected
- allowEditObjects() – Objects are allowed to be edited when the sheet is protected
- allowEditScenarios() – Scenarios are allowed to be edited when the sheet is protected
- allowFormatCells() – Formatting cells should be allowed when the sheet is protected
- allowFormatColumns() – Formatting columns should be allowed when the sheet is protected
- allowFormatRows() – Formatting rows should be allowed when the sheet is protected
- allowInsertColumns() – Inserting columns should be allowed when the sheet is protected
- allowInsertHyperlinks() – Inserting hyperlinks should be allowed when the sheet is protected
- allowInsertRows() – Inserting rows should be allowed when the sheet is protected
- allowPivotTables() – PivotTables should be allowed to operate when the sheet is protected
- allowSelectCells() – Selection of any cells should be allowed when the sheet is protected
- allowSelectLockedCells() – Selection of locked cells should be allowed when the sheet is protected
- allowSelectUnlockedCells() – Selection of unlocked cells should be allowed when the sheet is protected
- allowSort() – Sorting should be allowed when the sheet is protected
- applyAlignLeft() – Apply left alignment to content
- applyAlignRight() – Apply right alignment to content
- applyBgColor() – Alias of 'applyFillColor()'
- applyBorder() – Sets all borders style
- applyBorderBottom() – Apply bottom border style and color to the selected area
- applyBorderInner() – Apply inner border style and color to the selected area
- applyBorderLeft() – Apply left border style and color to the selected area
- applyBorderOuter() – Apply outer border style and color to the selected area
- applyBorderRight() – Apply right border style and color to the selected area
- applyBorderTop() – Apply top border style and color to the selected area
- applyColor() – Alias of 'setFontColor()'
- applyConditionalFormatting() – Apply conditional formatting to the selected area
- applyDataValidation() – Apply data validation to the selected area
- applyFillColor() – Fill background color
- applyFillGradient() – Fill background by gradient
- applyFont() – Apply font settings to the selected area
- applyFontColor() – Apply font color to the selected area
- applyFontName() – Apply font name to the selected area
- applyFontSize() – Apply font size to the selected area
- applyFontStyle() – Apply font style (bold, italic, etc.) to the selected area
- applyFontStyleBold() – Apply bold font style to the selected area
- applyFontStyleItalic() – Apply italic font style to the selected area
- applyFontStyleStrikethrough() – Apply strikethrough font style to the selected area
- applyFontStyleUnderline() – Apply underline font style to the selected area
- applyFormat() – Set value format for the selected area
- applyHide() – Set hidden protection for the selected area
- applyIndentDistributed() – Set distributed indent for the selected area
- applyIndentLeft() – Set left indent for the selected area
- applyIndentRight() – Set right indent for the selected area
- applyInnerBorder() – Alias of applyBorderInner()
- applyNamedRange() – Apply named range to the selected area
- applyOuterBorder() – Alias of applyBorderOuter()
- applyRowHeight() – Sets height to the current row
- applyRowOutlineLevel() – Set outline level for the current row
- applyStyle() – Apply the style
- applyTextAlign() – Apply horizontal alignment to the selected area
- applyTextCenter() – Apply horizontal and vertical center alignment to the selected area
- applyTextColor() – Set text color for the selected area
- applyTextRotation() – Set text rotation for the selected area
- applyTextWrap() – Set text wrap for the selected area
- applyUnlock() – Set unlock protection for the selected area
- applyVerticalAlign() – Apply vertical alignment to the selected area
- beginArea() – Begin a new area
- beginOutlineLevel() – Start a new outline level for rows
- cell() – Select a single cell or cell range in the current row
- clearAreas() – Clear all defined areas
- endAreas()
- endOutlineLevel() – End the current outline level for rows
- getCharts() – Get all charts in the sheet
- getColAttributes() – Get columns attributes
- getConditionalFormatting() – Get all conditional formatting in the sheet
- getCurrentCell() – Returns address of the current cell
- getCurrentCol() – Returns current column letter
- getCurrentColId() – Get current column index (0-based)
- getCurrentRow() – Returns current row number
- getCurrentRowId() – Get current row index (0-based)
- getDataValidations() – Get all data validations in the sheet
- getDefaultStyle() – Returns default style
- getHeaderFooterOptions() – Get header and footer options
- getHyperlinks() – Returns added hyperlinks
- getImages() – Get all images in the sheet
- getLastCell() – Get address of the last touched cell
- getLastRange() – Get address of the last touched range
- getMergedCells() – Returns merged cells
- getName() – Get sheet name
- getNamedRanges() – Returns named ranges with full addresses
- getNotes() – Get all notes in the sheet
- getOutlineLevel() – Get the current outline level for rows
- isName() – Case-insensitive name checking
- isRightToLeft() – Check if the sheet is right-to-left
- makeArea() – Make area for writing
- mergeCells() – Merge cells
- mergeRelCells() – Merge relative cells
- nextCell() – Move pointer to the next cell
- nextRow() – Move to the next row
- pageFitToHeight() – Set page to fit to height
- pageFitToWidth() – Set page to fit to width
- pageFooter() – Set the footer for all pages
- pageFooterEven() – Set footer for even pages
- pageFooterFirst() – Set the footer for the first page
- pageFooterOdd() – Set footer for odd pages
- pageHeader() – Set page header for all pages
- pageHeaderEven() – Set header for even pages
- pageHeaderFirst() – Set the header for the first page
- pageHeaderFooter() – Set the center header and footer for all pages
- pageHeaderOdd() – Set header for odd pages
- pageLandscape() – Set page orientation as Landscape
- pageMarginBottom() – Bottom Page Margin in mm|cm|in
- pageMarginFooter() – Footer Page Margin in mm|cm|in
- pageMarginHeader() – Header Page Margin in mm|cm|in
- pageMarginLeft() – Left Page Margin in mm|cm|in
- pageMarginRight() – Right page margin in mm|cm|in
- pageMargins() – Page margins for a sheet or a custom sheet view in mm|cm|in
- pageMarginTop() – Top Page Margin in mm|cm|in
- pageOrientationLandscape() – Set page orientation as Landscape, alias of pageLandscape()
- pageOrientationPortrait() – Set page orientation as Portrait, alias of pagePortrait()
- pagePaperHeight() – Height of custom paper as a number followed by a unit identifier mm|cm|in (ex: 297mm, 11in)
- pagePaperSize() – Set Paper size (when paperHeight and paperWidth are specified, paperSize should be ignored)
- pagePaperSizeA3() – Set Paper Size to A3 (when paperHeight and paperWidth are specified, paperSize should be ignored)
- pagePaperSizeA4() – Set Paper Size to A4 (when paperHeight and paperWidth are specified, paperSize should be ignored)
- pagePaperSizeLegal() – Set Paper Size to Legal (when paperHeight and paperWidth are specified, paperSize should be ignored)
- pagePaperSizeLetter() – Set Paper Size to Letter (when paperHeight and paperWidth are specified, paperSize should be ignored)
- pagePaperWidth() – Width of custom paper as a number followed by a unit identifier mm|cm|in (ex: 21cm, 8.5in)
- pagePortrait() – Set page orientation as Portrait
- pageScale() – Set page scale
- protect() – Protect sheet
- setActiveCell() – Set active cell
- setAutoFilter() – Set auto filter
- setBgColor() – Set background color for the specific cell or range
- setBottomNodesOptions() – Set multiple options for a bottom node
- setCellStyle() – Set style for the specific cell
- setColAutoWidth() – Alias of setColWidthAuto($col)
- setColDataStyle() – Set styles of column cells (colors, formats, etc.)
- setColDataStyleArray() – Set style of column cells (colors, formats, etc.)
- setColFormat() – Set a format of single or multiple column(s)
- setColFormats() – Set formats of columns
- setColFormula() – Set formula for single or multiple column(s)
- setColHidden() – Set a column as hidden
- setColMinWidth() – Setting a minimal column's width
- setColMinWidths() – Setting a multiple column's minimal width
- setColOutlineLevel() – Set a column outline level
- setColStyle() – Set style of single or multiple column(s)
- setColStyleArray() – Set styles of single or multiple column(s)
- setColVisible() – Show/hide a column
- setColWidth() – Set a width of single or multiple column(s)
- setColWidthAuto() – Set auto width of single or multiple column(s)
- setColWidths() – Setting a multiple column's width
- setDefaultFont() – Set default font settings for the sheet
- setDefaultFontColor() – Set default font color
- setDefaultFontName() – Set default font name for the sheet
- setDefaultFontSize() – Set default font size for the sheet
- setDefaultFontStyle() – Set default font style (bold, italic, etc.) for the sheet
- setDefaultFontStyleBold() – Set default font style as bold for the sheet
- setDefaultFontStyleItalic() – Set default font style as italic
- setDefaultFontStyleStrikethrough() – Set default font style as strikethrough
- setDefaultFontStyleUnderline() – Set default font style as underline
- setDefaultStyle() – Sets default style
- setFormat() – Set value format for the specific cell or range
- setFormula() – Set a formula to the single cell or to the cell range
- setFreeze() – Freeze rows/columns
- setFreezeColumns() – Freeze columns
- setFreezeRows() – Freeze rows
- setName() – Set sheet name
- setOuterBorder() – Set outer border for the specific range
- setPrintArea() – Set print area for the sheet
- setPrintCentered() – Center the print area horizontally and vertically
- setPrintGridlines() – Show grid lines in the print area
- setPrintHorizontalCentered() – Center the print area horizontally
- setPrintLeftColumns() – Set left columns to repeat on every printed page
- setPrintRowAndColumnHeading() – Print row and column headings in the printout
- setPrintTitles() – Set rows to repeat at top and columns to repeat at left when printing
- setPrintTopRows() – Set top rows to repeat on every printed page
- setPrintVerticalCentered() – Center the print area vertically
- setRowDataStyle() – Style are applied only to non-empty cells in a row (or row range)
- setRowDataStyleArray() – Styles are applied only to non-empty cells in a rows
- setRowHeight() – Height of a specific row
- setRowHeights() – Multiple rows height
- setRowHidden() – Hide a specific row
- setRowOutlineLevel() – Set an outline level for a specific row or range of rows
- setRowStyle() – The style is applied to the entire sheet row (even if it is empty)
- setRowStyleArray() – Styles are applied to the entire sheet row (even if it is empty)
- setRowVisible() – Hide/show a specific row
- setShowGridLines() – Turn on/off grid lines
- setStateHidden() – Make the sheet hidden
- setStateVeryHidden() – Make the sheet very hidden
- setStateVisible() – Make the sheet visible
- setStyle() – Alias for 'setCellStyle()'
- setTabColor() – Set color for the sheet tab
- setTopLeftCell() – Set the top left cell for writing
- setValue() – Set a value to the single cell or to the cell range
- skipRow() – Skip rows
- unprotect() – Unprotect sheet
- withLastCell() – Select the last written cell for applying
- withLastRow() – Select the last written row for applying
- withRange() – Select a custom range for applying
- writeArray() – Write values from a two-dimensional array (alias of writeRows)
- writeArrayTo() – Write 2d array from the specified cell
- writeCell() – Write value to the current cell and move a pointer to the next cell in the row
- writeCells() – Write several values into cells of one row
- writeHeader() – Write a header row with optional styles and formats for columns
- writeRow() – Write values to the current row
- writeRows() – Write several rows from a two-dimensional array
- writeTo() – Write value to the specified cell and move a pointer to the next cell in the row
__construct()
public function __construct(string $sheetName)
Sheet constructor
Parameters
string $sheetName
addCellStyle()
public function addCellStyle(string $cellAddr, $style): Sheet
Add additional styles to a cell
Parameters
string $cellAddrarray|Style $style
addChart()
public function addChart(string $range,
avadim\FastExcelWriter\Charts\Chart $chart): Sheet
Add a chart object to the specified range of cells
Parameters
string $range– Set the position where the chart should appear in the worksheetChart $chart– Chart object
addConditionalFormatting()
public function addConditionalFormatting(string $range, $conditionals): Sheet
Add a conditional formatting object to the specified range of cells
Parameters
string $rangeConditional|Conditional[] $conditionals
addDataValidation()
public function addDataValidation(string $range,
avadim\FastExcelWriter\DataValidation\DataValidation $validation): Sheet
Add a data validation object to the specified range of cells
Parameters
string $rangeDataValidation $validation
addImage()
public function addImage(string $cell, string $imageFile,
?array $imageStyle = []): Sheet
Add an image to the sheet from a local file, URL or image string in base64
Parameters
string $cell– Cell addressstring $imageFile– URL, local path or image string in base64array|null $imageStyle– ['width' => ..., 'height' => ..., 'hyperlink' => ...]
Examples
$sheet->addImage('A1', 'path/to/file');
$sheet->addImage('A1', 'path/to/file', ['width' => 100]);
addNamedRange()
public function addNamedRange(string $range, string $name): Sheet
Define named range
Parameters
string $rangestring $name
Examples
$sheet->addNamedRange('B3:C5', 'Demo');
addNote()
public function addNote($cell, $comment, array $noteStyle = []): Sheet
Add a note to the sheet
Parameters
string|mixed $cellstring|array|null $commentarray $noteStyle
Examples
$sheet->addNote('A1', $noteText, $noteStyle);
$sheet->writeCell($cellValue)->addNote($noteText, $noteStyle);
addStyle()
public function addStyle(string $cellAddr, $style): Sheet
Alias for 'addCellStyle()'
Parameters
string $cellAddrarray|Style $style
allowAutoFilter()
public function allowAutoFilter(?bool $allow = true): Sheet
AutoFilters should be allowed to operate when the sheet is protected
Parameters
bool|null $allow
allowDeleteColumns()
public function allowDeleteColumns(?bool $allow = true): Sheet
Deleting columns should be allowed when the sheet is protected
Parameters
bool|null $allow
allowDeleteRows()
public function allowDeleteRows(?bool $allow = true): Sheet
Deleting rows should be allowed when the sheet is protected
Parameters
bool|null $allow
allowEditObjects()
public function allowEditObjects(?bool $allow = true): Sheet
Objects are allowed to be edited when the sheet is protected
Parameters
bool|null $allow
allowEditScenarios()
public function allowEditScenarios(?bool $allow = true): Sheet
Scenarios are allowed to be edited when the sheet is protected
Parameters
bool|null $allow
allowFormatCells()
public function allowFormatCells(?bool $allow = true): Sheet
Formatting cells should be allowed when the sheet is protected
Parameters
bool|null $allow
allowFormatColumns()
public function allowFormatColumns(?bool $allow = true): Sheet
Formatting columns should be allowed when the sheet is protected
Parameters
bool|null $allow
allowFormatRows()
public function allowFormatRows(?bool $allow = true): Sheet
Formatting rows should be allowed when the sheet is protected
Parameters
bool|null $allow
allowInsertColumns()
public function allowInsertColumns(?bool $allow = true): Sheet
Inserting columns should be allowed when the sheet is protected
Parameters
bool|null $allow
allowInsertHyperlinks()
public function allowInsertHyperlinks(?bool $allow = true): Sheet
Inserting hyperlinks should be allowed when the sheet is protected
Parameters
bool|null $allow
allowInsertRows()
public function allowInsertRows(?bool $allow = true): Sheet
Inserting rows should be allowed when the sheet is protected
Parameters
bool|null $allow
allowPivotTables()
public function allowPivotTables(?bool $allow = true): Sheet
PivotTables should be allowed to operate when the sheet is protected
Parameters
bool|null $allow
allowSelectCells()
public function allowSelectCells(?bool $allow = true): Sheet
Selection of any cells should be allowed when the sheet is protected
Parameters
bool|null $allow
allowSelectLockedCells()
public function allowSelectLockedCells(?bool $allow = true): Sheet
Selection of locked cells should be allowed when the sheet is protected
Parameters
bool|null $allow
allowSelectUnlockedCells()
public function allowSelectUnlockedCells(?bool $allow = true): Sheet
Selection of unlocked cells should be allowed when the sheet is protected
Parameters
bool|null $allow
allowSort()
public function allowSort(?bool $allow = true): Sheet
Sorting should be allowed when the sheet is protected
Parameters
bool|null $allow
applyAlignLeft()
public function applyAlignLeft(): Sheet
Apply left alignment to content
Parameters
None
applyAlignRight()
public function applyAlignRight(): Sheet
Apply right alignment to content
Parameters
None
applyBgColor()
public function applyBgColor(string $color, ?string $pattern = null): Sheet
Alias of 'applyFillColor()'
Parameters
string $colorstring|null $pattern
applyBorder()
public function applyBorder(string $style, ?string $color = '#000000'): Sheet
Sets all borders style
Parameters
string $stylestring|null $color
applyBorderBottom()
public function applyBorderBottom(string $style,
?string $color = '#000000'): Sheet
Apply bottom border style and color to the selected area
Parameters
string $stylestring|null $color
applyBorderLeft()
public function applyBorderLeft(string $style,
?string $color = '#000000'): Sheet
Apply left border style and color to the selected area
Parameters
string $stylestring|null $color
applyBorderRight()
public function applyBorderRight(string $style,
?string $color = '#000000'): Sheet
Apply right border style and color to the selected area
Parameters
string $stylestring|null $color
applyBorderTop()
public function applyBorderTop(string $style,
?string $color = '#000000'): Sheet
Apply top border style and color to the selected area
Parameters
string $stylestring|null $color
applyColor()
public function applyColor(string $color): Sheet
Alias of 'setFontColor()'
Parameters
string $color
applyConditionalFormatting()
public function applyConditionalFormatting($conditionals): Sheet
Apply conditional formatting to the selected area
Parameters
Conditional|Conditional[] $conditionals
applyDataValidation()
public function applyDataValidation(avadim\FastExcelWriter\DataValidation\DataValidation $validation): Sheet
Apply data validation to the selected area
Parameters
DataValidation $validation
applyFillColor()
public function applyFillColor(string $color, ?string $pattern = null): Sheet
Fill background color
Parameters
string $colorstring|null $pattern
applyFillGradient()
public function applyFillGradient(string $color1, string $color2,
?int $degree = null): Sheet
Fill background by gradient
Parameters
string $color1string $color2int|null $degree
applyFont()
public function applyFont(string $fontName, ?int $fontSize = null,
?string $fontStyle = null,
?string $fontColor = null): Sheet
Apply font settings to the selected area
Parameters
string $fontNameint|null $fontSizestring|null $fontStylestring|null $fontColor
applyFontColor()
public function applyFontColor(string $fontColor): Sheet
Apply font color to the selected area
Parameters
string $fontColor
applyFontName()
public function applyFontName(string $fontName): Sheet
Apply font name to the selected area
Parameters
string $fontName
applyFontSize()
public function applyFontSize(float $fontSize): Sheet
Apply font size to the selected area
Parameters
float $fontSize
applyFontStyle()
public function applyFontStyle(string $fontStyle): Sheet
Apply font style (bold, italic, etc.) to the selected area
Parameters
string $fontStyle
applyFontStyleBold()
public function applyFontStyleBold(): Sheet
Apply bold font style to the selected area
Parameters
None
applyFontStyleItalic()
public function applyFontStyleItalic(): Sheet
Apply italic font style to the selected area
Parameters
None
applyFontStyleStrikethrough()
public function applyFontStyleStrikethrough(): Sheet
Apply strikethrough font style to the selected area
Parameters
None
applyFontStyleUnderline()
public function applyFontStyleUnderline(?bool $double = false): Sheet
Apply underline font style to the selected area
Parameters
bool|null $double
applyFormat()
public function applyFormat($format): Sheet
Set value format for the selected area
Parameters
string|array $format
applyHide()
public function applyHide(?bool $hide = true): Sheet
Set hidden protection for the selected area
Parameters
bool|null $hide
applyIndentDistributed()
public function applyIndentDistributed(int $indent): Sheet
Set distributed indent for the selected area
Parameters
int $indent
applyIndentLeft()
public function applyIndentLeft(int $indent): Sheet
Set left indent for the selected area
Parameters
int $indent
applyIndentRight()
public function applyIndentRight(int $indent): Sheet
Set right indent for the selected area
Parameters
int $indent
applyBorderInner()
public function applyBorderInner(string $style,
?string $color = '#000000'): Sheet
Apply inner border style and color to the selected area
Parameters
string $stylestring|null $color
applyBorderOuter()
public function applyBorderOuter(string $style,
?string $color = '#000000'): Sheet
Apply outer border style and color to the selected area
Parameters
string $stylestring|null $color
applyInnerBorder()
public function applyInnerBorder(string $style,
?string $color = '#000000'): Sheet
Alias of applyBorderInner()
Parameters
string $stylestring|null $color
applyNamedRange()
public function applyNamedRange(string $name): Sheet
Apply named range to the selected area
Parameters
string $name
applyOuterBorder()
public function applyOuterBorder(string $style,
?string $color = '#000000'): Sheet
Alias of applyBorderOuter()
Parameters
string $stylestring|null $color
applyRowHeight()
public function applyRowHeight(float $height): Sheet
Sets height to the current row
Parameters
float $height
applyRowOutlineLevel()
public function applyRowOutlineLevel(int $outlineLevel): Sheet
Set outline level for the current row
Parameters
int $outlineLevel
applyStyle()
public function applyStyle($style): Sheet
Apply the style
Parameters
array|Style $style
applyTextAlign()
public function applyTextAlign(string $textAlign,
?string $verticalAlign = null): Sheet
Apply horizontal alignment to the selected area
Parameters
string $textAlignstring|null $verticalAlign
applyTextCenter()
public function applyTextCenter(): Sheet
Apply horizontal and vertical center alignment to the selected area
Parameters
None
applyTextColor()
public function applyTextColor(string $color): Sheet
Set text color for the selected area
Parameters
string $color
applyTextRotation()
public function applyTextRotation(int $degrees): Sheet
Set text rotation for the selected area
Parameters
int $degrees
applyTextWrap()
public function applyTextWrap(?bool $textWrap = true): Sheet
Set text wrap for the selected area
Parameters
bool|null $textWrap
applyUnlock()
public function applyUnlock(?bool $unlock = true): Sheet
Set unlock protection for the selected area
Parameters
bool $unlock
applyVerticalAlign()
public function applyVerticalAlign(string $verticalAlign): Sheet
Apply vertical alignment to the selected area
Parameters
string $verticalAlign
beginArea()
public function beginArea(?string $cellAddress = null): Area
Begin a new area
Parameters
string|null $cellAddress– Upper left cell of area
beginOutlineLevel()
public function beginOutlineLevel(?bool $collapsed = false): Sheet
Start a new outline level for rows
Parameters
bool|null $collapsed
cell()
public function cell($cellAddress): Sheet
Select a single cell or cell range in the current row
Parameters
string|array $cellAddress
Examples
$sheet->cell('B5')->writeCell($value);
$sheet->cell('B5:C7')->applyBorder('thin');
$sheet->cell(['col' => 2, 'row' => 5])->applyUnlock();
$sheet->cell([2, 5])->applyColor($color);
clearAreas()
public function clearAreas(): Sheet
Clear all defined areas
Parameters
None
endAreas()
public function endAreas(): Sheet
Parameters
None
endOutlineLevel()
public function endOutlineLevel(): Sheet
End the current outline level for rows
Parameters
None
getCharts()
public function getCharts(): array
Get all charts in the sheet
Parameters
None
getColAttributes()
public function getColAttributes(): array
Get columns attributes
Parameters
None
getConditionalFormatting()
public function getConditionalFormatting(): array
Get all conditional formatting in the sheet
Parameters
None
getCurrentCell()
public function getCurrentCell(): string
Returns address of the current cell
Parameters
None
getCurrentCol()
public function getCurrentCol(): string
Returns current column letter
Parameters
None
getCurrentColId()
public function getCurrentColId(): int
Get current column index (0-based)
Parameters
None
getCurrentRow()
public function getCurrentRow(): int
Returns current row number
Parameters
None
getCurrentRowId()
public function getCurrentRowId(): int
Get current row index (0-based)
Parameters
None
getDataValidations()
public function getDataValidations(): array
Get all data validations in the sheet
Parameters
None
getDefaultStyle()
public function getDefaultStyle(): array
Returns default style
Parameters
None
getHeaderFooterOptions()
public function getHeaderFooterOptions(): array
Get header and footer options
Parameters
None
getHyperlinks()
public function getHyperlinks(): array
Returns added hyperlinks
Parameters
None
getImages()
public function getImages(): array
Get all images in the sheet
Parameters
None
getLastCell()
public function getLastCell(?bool $absolute = false): string
Get address of the last touched cell
Parameters
bool|null $absolute
getLastRange()
public function getLastRange(?bool $absolute = false): string
Get address of the last touched range
Parameters
bool|null $absolute
getMergedCells()
public function getMergedCells(): array
Returns merged cells
Parameters
None
getName()
public function getName(): string
Get sheet name
Parameters
None
getNamedRanges()
public function getNamedRanges(): array
Returns named ranges with full addresses
Parameters
None
getNotes()
public function getNotes(): array
Get all notes in the sheet
Parameters
None
getOutlineLevel()
public function getOutlineLevel(): int
Get the current outline level for rows
Parameters
None
isName()
public function isName(string $name): bool
Case-insensitive name checking
Parameters
string $name
isRightToLeft()
public function isRightToLeft(): bool
Check if the sheet is right-to-left
Parameters
None
makeArea()
public function makeArea(string $range): Area
Make area for writing
Parameters
string $range– A1:Z9 or R1C1:R9C28
mergeCells()
public function mergeCells($rangeSet, ?int $mergeFlag = 0): Sheet
Merge cells
Parameters
array|string|int $rangeSetint|null $mergeFlag– Action in case of intersection: 0 - exception; 1 - replace; 2 - keep; -1 - skip intersection check
Examples
$sheet->mergeCells('A1:C3');
$sheet->mergeCells(['A1:B2', 'C1:D2']);
$sheet->mergeCells('B5:C7', $value, Sheet:MERGE_NO_CHECK); // don't check for intersection of merged cells
mergeRelCells()
public function mergeRelCells($rangeSet): Sheet
Merge relative cells
Parameters
array|string|int $rangeSet
Examples
$sheet->mergeCells('C3:E8');
$sheet->mergeCells(3); // 3 columns of current row, equivalent of mergeCells('A5:C5') if current row is 5
$sheet->mergeCells(['RC3:RC5', 'RC6:RC7']); // equivalent of mergeCells(['C7:E7', 'F7:G7']) if current row is 7
nextCell()
public function nextCell(): Sheet
Move pointer to the next cell
Parameters
None
nextRow()
public function nextRow($style, ?bool $forceRow = false): Sheet
Move to the next row
Parameters
array|Style|null $stylebool|null $forceRow
pageFitToHeight()
public function pageFitToHeight($numPage): Sheet
Set page to fit to height
Parameters
int|string|null $numPage
pageFitToWidth()
public function pageFitToWidth($numPage): Sheet
Set page to fit to width
Parameters
int|string|null $numPage
pageFooter()
public function pageFooter($footer): Sheet
Set the footer for all pages
Parameters
string|array $footer
pageFooterEven()
public function pageFooterEven($footer): Sheet
Set footer for even pages
Parameters
string|array $footer
pageFooterFirst()
public function pageFooterFirst($footer): Sheet
Set the footer for the first page
Parameters
string|array $footer
pageFooterOdd()
public function pageFooterOdd(string $footer): Sheet
Set footer for odd pages
Parameters
string $footer
pageHeader()
public function pageHeader($header): Sheet
Set page header for all pages
Parameters
string|array $header
pageHeaderEven()
public function pageHeaderEven($header): Sheet
Set header for even pages
Parameters
string|array $header
pageHeaderFirst()
public function pageHeaderFirst($header): Sheet
Set the header for the first page
Parameters
string|array $header
pageHeaderFooter()
public function pageHeaderFooter(?string $header, ?string $footer): Sheet
Set the center header and footer for all pages
Parameters
string|null $headerstring|null $footer
pageHeaderOdd()
public function pageHeaderOdd($header): Sheet
Set header for odd pages
Parameters
string|array $header
pageLandscape()
public function pageLandscape(): Sheet
Set page orientation as Landscape
Parameters
None
pageMarginBottom()
public function pageMarginBottom($value): Sheet
Bottom Page Margin in mm|cm|in
Parameters
string|float $value
pageMarginFooter()
public function pageMarginFooter($value): Sheet
Footer Page Margin in mm|cm|in
Parameters
string|float $value
pageMarginHeader()
public function pageMarginHeader($value): Sheet
Header Page Margin in mm|cm|in
Parameters
string|float $value
pageMarginLeft()
public function pageMarginLeft($value): Sheet
Left Page Margin in mm|cm|in
Parameters
string|float $value
pageMarginRight()
public function pageMarginRight($value): Sheet
Right page margin in mm|cm|in
Parameters
string|float $value
pageMargins()
public function pageMargins(array $margins): Sheet
Page margins for a sheet or a custom sheet view in mm|cm|in
Parameters
array $margins
pageMarginTop()
public function pageMarginTop($value): Sheet
Top Page Margin in mm|cm|in
Parameters
string|float $value
pageOrientationLandscape()
public function pageOrientationLandscape(): Sheet
Set page orientation as Landscape, alias of pageLandscape()
Parameters
None
pageOrientationPortrait()
public function pageOrientationPortrait(): Sheet
Set page orientation as Portrait, alias of pagePortrait()
Parameters
None
pagePaperHeight()
public function pagePaperHeight($paperHeight): Sheet
Height of custom paper as a number followed by a unit identifier mm|cm|in (ex: 297mm, 11in)
Parameters
string|float|int $paperHeight
pagePaperSize()
public function pagePaperSize(int $paperSize): Sheet
Set Paper size (when paperHeight and paperWidth are specified, paperSize should be ignored)
Parameters
int $paperSize
pagePaperSizeA3()
public function pagePaperSizeA3(): Sheet
Set Paper Size to A3 (when paperHeight and paperWidth are specified, paperSize should be ignored)
Parameters
None
pagePaperSizeA4()
public function pagePaperSizeA4(): Sheet
Set Paper Size to A4 (when paperHeight and paperWidth are specified, paperSize should be ignored)
Parameters
None
pagePaperSizeLegal()
public function pagePaperSizeLegal(): Sheet
Set Paper Size to Legal (when paperHeight and paperWidth are specified, paperSize should be ignored)
Parameters
None
pagePaperSizeLetter()
public function pagePaperSizeLetter(): Sheet
Set Paper Size to Letter (when paperHeight and paperWidth are specified, paperSize should be ignored)
Parameters
None
pagePaperWidth()
public function pagePaperWidth($paperWidth): Sheet
Width of custom paper as a number followed by a unit identifier mm|cm|in (ex: 21cm, 8.5in)
Parameters
string|float|int $paperWidth
pagePortrait()
public function pagePortrait(): Sheet
Set page orientation as Portrait
Parameters
None
pageScale()
public function pageScale(int $scale): Sheet
Set page scale
Parameters
int $scale
protect()
public function protect(?string $password = null): Sheet
Protect sheet
Parameters
string|null $password
setActiveCell()
public function setActiveCell($cellAddress): Sheet
Set active cell
Parameters
$cellAddress
setAutoFilter()
public function setAutoFilter($rowOrCell, ?int $col = 1): Sheet
Set auto filter
Parameters
mixed|null $rowOrCellint|null $col
Examples
$sheet->setAutoFilter(2);
$sheet->setAutoFilter('B2');
$sheet->setAutoFilter('B2:C4');
setBgColor()
public function setBgColor(string $cellAddr, string $color): Sheet
Set background color for the specific cell or range
Parameters
string $cellAddrstring $color
setBottomNodesOptions()
public function setBottomNodesOptions(string $node, array $options): Sheet
Set multiple options for a bottom node
Parameters
string $nodearray $options
setCellStyle()
public function setCellStyle(string $cellAddress, $style,
?bool $mergeStyles = false): Sheet
Set style for the specific cell
Parameters
string $cellAddress– Cell addressarray|Style $style– Style array or objectbool|null $mergeStyles– True - merge style with previous style for this cell (if exists)
setColAutoWidth()
public function setColAutoWidth($col): Sheet
Alias of setColWidthAuto($col)
Parameters
int|string|array $col– Column number or column letter (or array of these)
setColDataStyle()
public function setColDataStyle($colRange, $colStyle): Sheet
Set styles of column cells (colors, formats, etc.)
Styles are applied only to non-empty cells in a column and only take effect starting with the current row
Parameters
int|string|array $colRangearray|Style $colStyle
Examples
$sheet->setColDataStyle('B', ['width' = 20]); // style for cells of column 'B'
$sheet->setColDataStyle(2, ['width' = 20]); // 'B' is number 2 column
$sheet->setColDataStyle('B:D', ['width' = 'auto']); // options for range of columns
$sheet->setColDataStyle(['A', 'B', 'C'], $style); // options for several columns 'A', 'B' and 'C'
setColDataStyleArray()
public function setColDataStyleArray(array $colStyles): Sheet
Set style of column cells (colors, formats, etc.)
Styles are applied only to non-empty cells in a column and only take effect starting with the current row
Parameters
array $colStyles
Examples
$sheet->setColDataStyleArray(['B' => $style1, 'C' => $style2]); // options for columns 'B' and 'C'
setColFormat()
public function setColFormat($col, $format): Sheet
Set a format of single or multiple column(s)
Parameters
int|string|array $col– Column number or column letter (or array of these)mixed $format
setColFormats()
public function setColFormats(array $formats): Sheet
Set formats of columns
Parameters
array $formats
setColFormula()
public function setColFormula($col, string $formula): Sheet
Set formula for single or multiple column(s)
Parameters
int|string|array $col– Column number or column letter (or array of these)string $formula
setColHidden()
public function setColHidden($col): Sheet
Set a column as hidden
Parameters
int|string|array $col– Column number or column letter (or array of these)
setColMinWidth()
public function setColMinWidth($col, $width): Sheet
Setting a minimal column's width
Parameters
int|string|array $col– Column number or column letter (or array of these)int|float|string $width
setColMinWidths()
public function setColMinWidths(array $widths): Sheet
Setting a multiple column's minimal width
Parameters
array $widths
Examples
$sheet->setColWidths(['B' => 10, 'C' => 'auto', 'E' => 30, 'F' => 40]);
setColOutlineLevel()
public function setColOutlineLevel($col, int $outlineLevel): Sheet
Set a column outline level
Parameters
int|string|array $col– Column number or column letter (or array of these)int $outlineLevel
setColStyle()
public function setColStyle($colRange, $style): Sheet
Set style of single or multiple column(s)
Styles are applied to the entire sheet column(s) (even if it is empty)
Parameters
int|string|array $colRange– Column number or column letter or column range (or array of these)array|Style $style
Examples
$sheet->setColStyle('B', $style);
$sheet->setColStyle(2, $style); // 'B' is number 2 column
$sheet->setColStyle('C:F', $style);
$sheet->setColStyle(['A', 'B', 'C'], $style);
setColStyleArray()
public function setColStyleArray($colStyles): Sheet
Set styles of single or multiple column(s)
Styles are applied to the entire sheet column(s) (even if it is empty)
Parameters
array|Style $colStyles
Examples
$style1 = ['width' = 20];
$style2 = (new Style())->setColor('red');
$sheet->setColStyleArray(['B' => $style1, 'C' => $style2]);
setColVisible()
public function setColVisible($col, bool $val): Sheet
Show/hide a column
Parameters
int|string|array $col– Column number or column letter (or array of these)bool $val
setColWidth()
public function setColWidth($col, $width, ?bool $min = false): Sheet
Set a width of single or multiple column(s)
Parameters
int|string|array $col– Column number or column letter (or array of these)int|float|string $widthbool|null $min
setColWidthAuto()
public function setColWidthAuto($col): Sheet
Set auto width of single or multiple column(s)
Parameters
int|string|array $col– Column number or column letter (or array of these)
Examples
$sheet->setColWidthAuto(2);
$sheet->setColWidthAuto('B');
$sheet->setColWidthAuto(['B', 'C']);
$sheet->setColWidthAuto(['B:D']);
setColWidths()
public function setColWidths(array $widths, ?bool $min = false): Sheet
Setting a multiple column's width
Parameters
array $widthsbool|null $min
Examples
$sheet->setColWidths(['B' => 10, 'C' => 'auto', 'E' => 30, 'F' => 40]);
setDefaultFont()
public function setDefaultFont($font): Sheet
Set default font settings for the sheet
Parameters
string|array $font
setDefaultFontColor()
public function setDefaultFontColor(string $fontColor): Sheet
Set default font color
Parameters
string $fontColor
setDefaultFontName()
public function setDefaultFontName(string $fontName): Sheet
Set default font name for the sheet
Parameters
string $fontName
setDefaultFontSize()
public function setDefaultFontSize(int $fontSize): Sheet
Set default font size for the sheet
Parameters
int $fontSize
setDefaultFontStyle()
public function setDefaultFontStyle(string $fontStyle): Sheet
Set default font style (bold, italic, etc.) for the sheet
Parameters
string $fontStyle
setDefaultFontStyleBold()
public function setDefaultFontStyleBold(): Sheet
Set default font style as bold for the sheet
Parameters
None
setDefaultFontStyleItalic()
public function setDefaultFontStyleItalic(): Sheet
Set default font style as italic
Parameters
None
setDefaultFontStyleStrikethrough()
public function setDefaultFontStyleStrikethrough(): Sheet
Set default font style as strikethrough
Parameters
None
setDefaultFontStyleUnderline()
public function setDefaultFontStyleUnderline(?bool $double = false): Sheet
Set default font style as underline
Parameters
bool|null $double
setDefaultStyle()
public function setDefaultStyle($style): Sheet
Sets default style
Parameters
array|Style $style
setFormat()
public function setFormat(string $cellAddr, string $format): Sheet
Set value format for the specific cell or range
Parameters
string $cellAddrstring $format
setFormula()
public function setFormula($cellAddress, $value, $style): Sheet
Set a formula to the single cell or to the cell range
Parameters
string|array $cellAddressmixed $valuearray|Style|null $style
Examples
$sheet->setFormula('B5', '=F23');
$sheet->setFormula('B5:C7', $formula, $style);
$sheet->setFormula(['col' => 2, 'row' => 5], '=R2C3+R3C4');
$sheet->setFormula([2, 5], '=SUM(A4:A18)');
setFreeze()
public function setFreeze($freezeRows, $freezeColumns): Sheet
Freeze rows/columns
Parameters
mixed $freezeRowsmixed $freezeColumns
Examples
$sheet->setFreeze(3, 3); // number rows and columns to freeze
$sheet->setFreeze('C3'); // left top cell of the free area
setFreezeColumns()
public function setFreezeColumns(int $freezeColumns): Sheet
Freeze columns
Parameters
int $freezeColumns– Number columns to freeze
setFreezeRows()
public function setFreezeRows(int $freezeRows): Sheet
Freeze rows
Parameters
int $freezeRows– Number rows to freeze
setName()
public function setName(string $sheetName): Sheet
Set sheet name
Parameters
string $sheetName
setOuterBorder()
public function setOuterBorder(string $range, $style): Sheet
Set outer border for the specific range
Parameters
string $rangestring|array|Style $style
setPrintArea()
public function setPrintArea(string $range): Sheet
Set print area for the sheet
Parameters
string $range
setPrintCentered()
public function setPrintCentered(?bool $value = true): Sheet
Center the print area horizontally and vertically
Parameters
bool|null $value
setPrintGridlines()
public function setPrintGridlines(?bool $bool = true): Sheet
Show grid lines in the print area
Parameters
bool|null $bool
setPrintHorizontalCentered()
public function setPrintHorizontalCentered(?bool $value = true): Sheet
Center the print area horizontally
Parameters
bool|null $value
setPrintLeftColumns()
public function setPrintLeftColumns(string $range): Sheet
Set left columns to repeat on every printed page
Parameters
string $range
setPrintRowAndColumnHeading()
public function setPrintRowAndColumnHeading(?bool $bool = true): Sheet
Print row and column headings in the printout
Parameters
bool|null $bool
setPrintTitles()
public function setPrintTitles(?string $rowsAtTop,
?string $colsAtLeft = null): Sheet
Set rows to repeat at top and columns to repeat at left when printing
Parameters
string|null $rowsAtTopstring|null $colsAtLeft
setPrintTopRows()
public function setPrintTopRows(string $range): Sheet
Set top rows to repeat on every printed page
Parameters
string $range
setPrintVerticalCentered()
public function setPrintVerticalCentered(?bool $value = true): Sheet
Center the print area vertically
Parameters
bool|null $value
setRowDataStyle()
public function setRowDataStyle($rowRange, $style): Sheet
Style are applied only to non-empty cells in a row (or row range)
Parameters
int|string|array $rowRangearray|Style $style
Examples
$sheet->setRowDataStyle(3, ['height' = 20]); // options for row number 3
$sheet->setRowDataStyle('2:5', ['font-color' = '#f00']); // options for range of rows
setRowDataStyleArray()
public function setRowDataStyleArray(array $rowStyles): Sheet
Styles are applied only to non-empty cells in a rows
Parameters
array $rowStyles
Examples
$sheet->setRowDataStyleArray([3 => $style1, 5 => $style2]); // styles for rows 3 and 5
setRowHeight()
public function setRowHeight($rowNum, $height): Sheet
Height of a specific row
Parameters
$rowNum$height
setRowHeights()
public function setRowHeights(array $heights): Sheet
Multiple rows height
Parameters
array $heights
setRowHidden()
public function setRowHidden($rowNum): Sheet
Hide a specific row
Parameters
int|array $rowNum
setRowOutlineLevel()
public function setRowOutlineLevel($rowNum, int $outlineLevel,
?bool $collapsed = null): Sheet
Set an outline level for a specific row or range of rows
Parameters
int|array|string $rowNumint $outlineLevelbool|null $collapsed
Examples
setRowOutlineLevel(5, 1)
setRowOutlineLevel([5, 6, 7], 1)
setRowOutlineLevel('5:7', 1)
setRowStyle()
public function setRowStyle($rowRange, $style): Sheet
The style is applied to the entire sheet row (even if it is empty)
Parameters
int|string|array $rowRangearray|Style $style
Examples
$sheet->setRowStyle(3, ['height' = 20]); // options for row number 3
$sheet->setRowStyle('2:5', ['font-color' = '#f00']); // options for range of rows
setRowStyleArray()
public function setRowStyleArray(array $rowStyles): Sheet
Styles are applied to the entire sheet row (even if it is empty)
Parameters
array $rowStyles
Examples
$sheet->setRowStyleArray([3 => $style1, 5 => $style2]); // styles for rows 3 and 5
setRowVisible()
public function setRowVisible($rowNum, bool $visible): Sheet
Hide/show a specific row
Parameters
int|array $rowNumbool $visible
setShowGridLines()
public function setShowGridLines(bool $flag): void
Turn on/off grid lines
Parameters
bool $flag
setStateHidden()
public function setStateHidden(): Sheet
Make the sheet hidden
Parameters
None
setStateVeryHidden()
public function setStateVeryHidden(): Sheet
Make the sheet very hidden
Parameters
None
setStateVisible()
public function setStateVisible(): Sheet
Make the sheet visible
Parameters
None
setStyle()
public function setStyle(string $cellAddress, $style,
?bool $mergeStyles = false): Sheet
Alias for 'setCellStyle()'
Parameters
string $cellAddressarray|Style $stylebool|null $mergeStyles
setTabColor()
public function setTabColor(?string $color): Sheet
Set color for the sheet tab
Parameters
string|null $color
setTopLeftCell()
public function setTopLeftCell($cellAddress): Sheet
Set the top left cell for writing
Parameters
string|array $cellAddress
Examples
$sheet->setTopLeftCell('C3');
$sheet->writeRow([11, 22, 33]); // Will be written in cells C3, D3, E3
$sheet->setTopLeftCell('G7');
$sheet->writeRow([44, 55]); // Will be written in cells G7, H7
setValue()
public function setValue($cellAddress, $value, $style): Sheet
Set a value to the single cell or to the cell range
Parameters
string|array $cellAddressmixed $valuearray|Style|null $style
Examples
$sheet->setValue('B5', $value);
$sheet->setValue('B5:C7', $value, $style);
$sheet->setValue(['col' => 2, 'row' => 5], $value, $style);
$sheet->setValue([2, 5], $value);
skipRow()
public function skipRow(?int $rowCount = 1): Sheet
Skip rows
Parameters
int|null $rowCount
unprotect()
public function unprotect(): Sheet
Unprotect sheet
Parameters
None
withLastCell()
public function withLastCell(): Sheet
Select the last written cell for applying
Parameters
None
withLastRow()
public function withLastRow(): Sheet
Select the last written row for applying
Parameters
None
withRange()
public function withRange($range): Sheet
Select a custom range for applying
Parameters
array|string $range
writeArray()
public function writeArray(array $rowArray = [], $rowStyle): Sheet
Write values from a two-dimensional array (alias of writeRows)
Parameters
array $rowArray– Array of rowsarray|Style|null $rowStyle– Style applied to each row
writeArrayTo()
public function writeArrayTo($topLeftCell, array $data): Sheet
Write 2d array from the specified cell
Parameters
$topLeftCellarray $data
writeCell()
public function writeCell($value, ?array $styles = null): Sheet
Write value to the current cell and move a pointer to the next cell in the row
Parameters
mixed $valuearray|null $styles
writeCells()
public function writeCells(array $values, ?array $cellStyles = null): Sheet
Write several values into cells of one row
Parameters
array $valuesarray|null $cellStyles
writeHeader()
public function writeHeader(array $header, ?array $rowStyle = null,
?array $colStyles = []): Sheet
Write a header row with optional styles and formats for columns
Parameters
array $headerarray|null $rowStylearray|null $colStyles
Examples
$sheet->writeHeader(['title1', 'title2', 'title3']); // texts for cells of header
$sheet->writeHeader(['title1' => '@text', 'title2' => 'YYYY-MM-DD', 'title3' => ['format' => ..., 'font' => ...]]); // texts and formats of columns
$sheet->writeHeader($cellValues, $rowStyle, $colStyles); // texts and formats of columns and options of row
writeRow()
public function writeRow(array $rowValues = [], $rowStyle,
?array $cellStyles = null): Sheet
Write values to the current row
Parameters
array $rowValues– Values of cellsarray|Style|null $rowStyle– Style applied to the entire rowarray|null $cellStyles– Styles of specified cells in the row
writeRows()
public function writeRows(array $rowArray = [],
?array $rowStyle = null): Sheet
Write several rows from a two-dimensional array
Parameters
array $rowArray– Array of rowsarray|null $rowStyle– Style applied to each row
writeTo()
public function writeTo($cellAddress, $value, $style,
?int $mergeFlag = 0): Sheet
Write value to the specified cell and move a pointer to the next cell in the row
Parameters
string|array $cellAddressmixed $valuearray|Style|null $styleint|null $mergeFlag
Examples
$sheet->writeTo('B5', $value); // write to single cell
$sheet->writeTo(['col' => 2, 'row' => 5], $value); // address as an array
$sheet->writeTo([2, 5], $value); // address as an array
$sheet->writeTo('B5:C7', $value); // write a value to merged cells
$sheet->writeTo('B5:C7', $value, $styles, Sheet:MERGE_NO_CHECK); // don't check for intersection of merged cells