Class \avadim\FastExcelLaravel\SheetWriter
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
- 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
- exportModel()
- Parameters
- formatAttributes()
- 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
- mapping()
- 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
- withHeadings()
- Parameters
- withLastCell()
- Parameters
- withLastRow()
- Parameters
- withRange()
- Parameters
- writeArray()
- Parameters
- writeArrayTo()
- Parameters
- writeCell()
- Parameters
- writeCells()
- Parameters
- writeData()
- 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
- applyBorderLeft() -- Apply left 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() -- Apply inner border style and color to the selected area
- applyNamedRange() -- Apply named range to the selected area
- applyOuterBorder() -- Apply outer border style and color to the selected area
- 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
- exportModel() -- Export a model to the sheet
- formatAttributes() -- Set format attributes
- 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
- mapping() -- Set mapping callback for the sheet
- 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
- withHeadings() -- Set headings for the 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
- writeData() -- Write data to the sheet
- 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): avadim\FastExcelWriter\Sheet
Add additional styles to a cell
Parameters
string $cellAddrarray|Style $style
addChart()
public function addChart(string $range,
avadim\FastExcelWriter\Charts\Chart $chart): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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 = []): avadim\FastExcelWriter\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): avadim\FastExcelWriter\Sheet
Define named range
Parameters
string $rangestring $name
Examples
$sheet->addNamedRange('B3:C5', 'Demo');
addNote()
public function addNote($cell, $comment,
array $noteStyle = []): avadim\FastExcelWriter\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): avadim\FastExcelWriter\Sheet
Alias for 'addCellStyle()'
Parameters
string $cellAddrarray|Style $style
allowAutoFilter()
public function allowAutoFilter(?bool $allow = true): avadim\FastExcelWriter\Sheet
AutoFilters should be allowed to operate when the sheet is protected
Parameters
bool|null $allow
allowDeleteColumns()
public function allowDeleteColumns(?bool $allow = true): avadim\FastExcelWriter\Sheet
Deleting columns should be allowed when the sheet is protected
Parameters
bool|null $allow
allowDeleteRows()
public function allowDeleteRows(?bool $allow = true): avadim\FastExcelWriter\Sheet
Deleting rows should be allowed when the sheet is protected
Parameters
bool|null $allow
allowEditObjects()
public function allowEditObjects(?bool $allow = true): avadim\FastExcelWriter\Sheet
Objects are allowed to be edited when the sheet is protected
Parameters
bool|null $allow
allowEditScenarios()
public function allowEditScenarios(?bool $allow = true): avadim\FastExcelWriter\Sheet
Scenarios are allowed to be edited when the sheet is protected
Parameters
bool|null $allow
allowFormatCells()
public function allowFormatCells(?bool $allow = true): avadim\FastExcelWriter\Sheet
Formatting cells should be allowed when the sheet is protected
Parameters
bool|null $allow
allowFormatColumns()
public function allowFormatColumns(?bool $allow = true): avadim\FastExcelWriter\Sheet
Formatting columns should be allowed when the sheet is protected
Parameters
bool|null $allow
allowFormatRows()
public function allowFormatRows(?bool $allow = true): avadim\FastExcelWriter\Sheet
Formatting rows should be allowed when the sheet is protected
Parameters
bool|null $allow
allowInsertColumns()
public function allowInsertColumns(?bool $allow = true): avadim\FastExcelWriter\Sheet
Inserting columns should be allowed when the sheet is protected
Parameters
bool|null $allow
allowInsertHyperlinks()
public function allowInsertHyperlinks(?bool $allow = true): avadim\FastExcelWriter\Sheet
Inserting hyperlinks should be allowed when the sheet is protected
Parameters
bool|null $allow
allowInsertRows()
public function allowInsertRows(?bool $allow = true): avadim\FastExcelWriter\Sheet
Inserting rows should be allowed when the sheet is protected
Parameters
bool|null $allow
allowPivotTables()
public function allowPivotTables(?bool $allow = true): avadim\FastExcelWriter\Sheet
PivotTables should be allowed to operate when the sheet is protected
Parameters
bool|null $allow
allowSelectCells()
public function allowSelectCells(?bool $allow = true): avadim\FastExcelWriter\Sheet
Selection of any cells should be allowed when the sheet is protected
Parameters
bool|null $allow
allowSelectLockedCells()
public function allowSelectLockedCells(?bool $allow = true): avadim\FastExcelWriter\Sheet
Selection of locked cells should be allowed when the sheet is protected
Parameters
bool|null $allow
allowSelectUnlockedCells()
public function allowSelectUnlockedCells(?bool $allow = true): avadim\FastExcelWriter\Sheet
Selection of unlocked cells should be allowed when the sheet is protected
Parameters
bool|null $allow
allowSort()
public function allowSort(?bool $allow = true): avadim\FastExcelWriter\Sheet
Sorting should be allowed when the sheet is protected
Parameters
bool|null $allow
applyAlignLeft()
public function applyAlignLeft(): avadim\FastExcelWriter\Sheet
Apply left alignment to content
Parameters
None
applyAlignRight()
public function applyAlignRight(): avadim\FastExcelWriter\Sheet
Apply right alignment to content
Parameters
None
applyBgColor()
public function applyBgColor(string $color,
?string $pattern = null): avadim\FastExcelWriter\Sheet
Alias of 'applyFillColor()'
Parameters
string $colorstring|null $pattern
applyBorder()
public function applyBorder(string $style,
?string $color = '#000000'): avadim\FastExcelWriter\Sheet
Sets all borders style
Parameters
string $stylestring|null $color
applyBorderBottom()
public function applyBorderBottom(string $style,
?string $color = '#000000'): avadim\FastExcelWriter\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'): avadim\FastExcelWriter\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'): avadim\FastExcelWriter\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'): avadim\FastExcelWriter\Sheet
Apply top border style and color to the selected area
Parameters
string $stylestring|null $color
applyColor()
public function applyColor(string $color): avadim\FastExcelWriter\Sheet
Alias of 'setFontColor()'
Parameters
string $color
applyConditionalFormatting()
public function applyConditionalFormatting($conditionals): avadim\FastExcelWriter\Sheet
Apply conditional formatting to the selected area
Parameters
Conditional|Conditional[] $conditionals
applyDataValidation()
public function applyDataValidation(avadim\FastExcelWriter\DataValidation\DataValidation $validation): avadim\FastExcelWriter\Sheet
Apply data validation to the selected area
Parameters
DataValidation $validation
applyFillColor()
public function applyFillColor(string $color,
?string $pattern = null): avadim\FastExcelWriter\Sheet
Fill background color
Parameters
string $colorstring|null $pattern
applyFillGradient()
public function applyFillGradient(string $color1, string $color2,
?int $degree = null): avadim\FastExcelWriter\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): avadim\FastExcelWriter\Sheet
Apply font settings to the selected area
Parameters
string $fontNameint|null $fontSizestring|null $fontStylestring|null $fontColor
applyFontColor()
public function applyFontColor(string $fontColor): avadim\FastExcelWriter\Sheet
Apply font color to the selected area
Parameters
string $fontColor
applyFontName()
public function applyFontName(string $fontName): avadim\FastExcelWriter\Sheet
Apply font name to the selected area
Parameters
string $fontName
applyFontSize()
public function applyFontSize(float $fontSize): avadim\FastExcelWriter\Sheet
Apply font size to the selected area
Parameters
float $fontSize
applyFontStyle()
public function applyFontStyle(string $fontStyle): avadim\FastExcelWriter\Sheet
Apply font style (bold, italic, etc.) to the selected area
Parameters
string $fontStyle
applyFontStyleBold()
public function applyFontStyleBold(): avadim\FastExcelWriter\Sheet
Apply bold font style to the selected area
Parameters
None
applyFontStyleItalic()
public function applyFontStyleItalic(): avadim\FastExcelWriter\Sheet
Apply italic font style to the selected area
Parameters
None
applyFontStyleStrikethrough()
public function applyFontStyleStrikethrough(): avadim\FastExcelWriter\Sheet
Apply strikethrough font style to the selected area
Parameters
None
applyFontStyleUnderline()
public function applyFontStyleUnderline(?bool $double = false): avadim\FastExcelWriter\Sheet
Apply underline font style to the selected area
Parameters
bool|null $double
applyFormat()
public function applyFormat($format): avadim\FastExcelWriter\Sheet
Set value format for the selected area
Parameters
string|array $format
applyHide()
public function applyHide(?bool $hide = true): avadim\FastExcelWriter\Sheet
Set hidden protection for the selected area
Parameters
bool|null $hide
applyIndentDistributed()
public function applyIndentDistributed(int $indent): avadim\FastExcelWriter\Sheet
Set distributed indent for the selected area
Parameters
int $indent
applyIndentLeft()
public function applyIndentLeft(int $indent): avadim\FastExcelWriter\Sheet
Set left indent for the selected area
Parameters
int $indent
applyIndentRight()
public function applyIndentRight(int $indent): avadim\FastExcelWriter\Sheet
Set right indent for the selected area
Parameters
int $indent
applyInnerBorder()
public function applyInnerBorder(string $style,
?string $color = '#000000'): avadim\FastExcelWriter\Sheet
Apply inner border style and color to the selected area
Parameters
string $stylestring|null $color
applyNamedRange()
public function applyNamedRange(string $name): avadim\FastExcelWriter\Sheet
Apply named range to the selected area
Parameters
string $name
applyOuterBorder()
public function applyOuterBorder(string $style,
?string $color = '#000000'): avadim\FastExcelWriter\Sheet
Apply outer border style and color to the selected area
Parameters
string $stylestring|null $color
applyRowHeight()
public function applyRowHeight(float $height): avadim\FastExcelWriter\Sheet
Sets height to the current row
Parameters
float $height
applyRowOutlineLevel()
public function applyRowOutlineLevel(int $outlineLevel): avadim\FastExcelWriter\Sheet
Set outline level for the current row
Parameters
int $outlineLevel
applyStyle()
public function applyStyle($style): avadim\FastExcelWriter\Sheet
Apply the style
Parameters
array|Style $style
applyTextAlign()
public function applyTextAlign(string $textAlign,
?string $verticalAlign = null): avadim\FastExcelWriter\Sheet
Apply horizontal alignment to the selected area
Parameters
string $textAlignstring|null $verticalAlign
applyTextCenter()
public function applyTextCenter(): avadim\FastExcelWriter\Sheet
Apply horizontal and vertical center alignment to the selected area
Parameters
None
applyTextColor()
public function applyTextColor(string $color): avadim\FastExcelWriter\Sheet
Set text color for the selected area
Parameters
string $color
applyTextRotation()
public function applyTextRotation(int $degrees): avadim\FastExcelWriter\Sheet
Set text rotation for the selected area
Parameters
int $degrees
applyTextWrap()
public function applyTextWrap(?bool $textWrap = true): avadim\FastExcelWriter\Sheet
Set text wrap for the selected area
Parameters
bool|null $textWrap
applyUnlock()
public function applyUnlock(?bool $unlock = true): avadim\FastExcelWriter\Sheet
Set unlock protection for the selected area
Parameters
bool $unlock
applyVerticalAlign()
public function applyVerticalAlign(string $verticalAlign): avadim\FastExcelWriter\Sheet
Apply vertical alignment to the selected area
Parameters
string $verticalAlign
beginArea()
public function beginArea(?string $cellAddress = null): avadim\FastExcelWriter\Area
Begin a new area
Parameters
string|null $cellAddress-- Upper left cell of area
beginOutlineLevel()
public function beginOutlineLevel(?bool $collapsed = false): avadim\FastExcelWriter\Sheet
Start a new outline level for rows
Parameters
bool|null $collapsed
cell()
public function cell($cellAddress): avadim\FastExcelWriter\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(): avadim\FastExcelWriter\Sheet
Clear all defined areas
Parameters
None
endAreas()
public function endAreas(): avadim\FastExcelWriter\Sheet
Parameters
None
endOutlineLevel()
public function endOutlineLevel(): avadim\FastExcelWriter\Sheet
End the current outline level for rows
Parameters
None
exportModel()
public function exportModel($model, $rowStyle,
?array $colStyles = null): SheetWriter
Export a model to the sheet. Accepts a model class name or instance (all records are exported), an Eloquent builder, a query builder or a relation (only the matching records are exported). Records are read lazily through cursor()
Parameters
string|Model|EloquentBuilder|QueryBuilder|Relation $modelarray|Style|null $rowStylearray|null $colStyles
formatAttributes()
public function formatAttributes(array $formats): SheetWriter
Set format attributes
Parameters
array $formats
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): avadim\FastExcelWriter\Area
Make area for writing
Parameters
string $range-- A1:Z9 or R1C1:R9C28
mapping()
public function mapping($callback): SheetWriter
Set mapping callback for the sheet
Parameters
$callback
mergeCells()
public function mergeCells($rangeSet,
?int $mergeFlag = 0): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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(): avadim\FastExcelWriter\Sheet
Move pointer to the next cell
Parameters
None
nextRow()
public function nextRow($style,
?bool $forceRow = false): avadim\FastExcelWriter\Sheet
Move to the next row
Parameters
array|Style|null $stylebool|null $forceRow
pageFitToHeight()
public function pageFitToHeight($numPage): avadim\FastExcelWriter\Sheet
Set page to fit to height
Parameters
int|string|null $numPage
pageFitToWidth()
public function pageFitToWidth($numPage): avadim\FastExcelWriter\Sheet
Set page to fit to width
Parameters
int|string|null $numPage
pageFooter()
public function pageFooter($footer): avadim\FastExcelWriter\Sheet
Set the footer for all pages
Parameters
string|array $footer
pageFooterEven()
public function pageFooterEven($footer): avadim\FastExcelWriter\Sheet
Set footer for even pages
Parameters
string|array $footer
pageFooterFirst()
public function pageFooterFirst($footer): avadim\FastExcelWriter\Sheet
Set the footer for the first page
Parameters
string|array $footer
pageFooterOdd()
public function pageFooterOdd(string $footer): avadim\FastExcelWriter\Sheet
Set footer for odd pages
Parameters
string $footer
pageHeader()
public function pageHeader($header): avadim\FastExcelWriter\Sheet
Set page header for all pages
Parameters
string|array $header
pageHeaderEven()
public function pageHeaderEven($header): avadim\FastExcelWriter\Sheet
Set header for even pages
Parameters
string|array $header
pageHeaderFirst()
public function pageHeaderFirst($header): avadim\FastExcelWriter\Sheet
Set the header for the first page
Parameters
string|array $header
pageHeaderFooter()
public function pageHeaderFooter(?string $header,
?string $footer): avadim\FastExcelWriter\Sheet
Set the center header and footer for all pages
Parameters
string|null $headerstring|null $footer
pageHeaderOdd()
public function pageHeaderOdd($header): avadim\FastExcelWriter\Sheet
Set header for odd pages
Parameters
string|array $header
pageLandscape()
public function pageLandscape(): avadim\FastExcelWriter\Sheet
Set page orientation as Landscape
Parameters
None
pageMarginBottom()
public function pageMarginBottom($value): avadim\FastExcelWriter\Sheet
Bottom Page Margin in mm|cm|in
Parameters
string|float $value
pageMarginFooter()
public function pageMarginFooter($value): avadim\FastExcelWriter\Sheet
Footer Page Margin in mm|cm|in
Parameters
string|float $value
pageMarginHeader()
public function pageMarginHeader($value): avadim\FastExcelWriter\Sheet
Header Page Margin in mm|cm|in
Parameters
string|float $value
pageMarginLeft()
public function pageMarginLeft($value): avadim\FastExcelWriter\Sheet
Left Page Margin in mm|cm|in
Parameters
string|float $value
pageMarginRight()
public function pageMarginRight($value): avadim\FastExcelWriter\Sheet
Right page margin in mm|cm|in
Parameters
string|float $value
pageMargins()
public function pageMargins(array $margins): avadim\FastExcelWriter\Sheet
Page margins for a sheet or a custom sheet view in mm|cm|in
Parameters
array $margins
pageMarginTop()
public function pageMarginTop($value): avadim\FastExcelWriter\Sheet
Top Page Margin in mm|cm|in
Parameters
string|float $value
pageOrientationLandscape()
public function pageOrientationLandscape(): avadim\FastExcelWriter\Sheet
Set page orientation as Landscape, alias of pageLandscape()
Parameters
None
pageOrientationPortrait()
public function pageOrientationPortrait(): avadim\FastExcelWriter\Sheet
Set page orientation as Portrait, alias of pagePortrait()
Parameters
None
pagePaperHeight()
public function pagePaperHeight($paperHeight): avadim\FastExcelWriter\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): avadim\FastExcelWriter\Sheet
Set Paper size (when paperHeight and paperWidth are specified, paperSize should be ignored)
Parameters
int $paperSize
pagePaperSizeA3()
public function pagePaperSizeA3(): avadim\FastExcelWriter\Sheet
Set Paper Size to A3 (when paperHeight and paperWidth are specified, paperSize should be ignored)
Parameters
None
pagePaperSizeA4()
public function pagePaperSizeA4(): avadim\FastExcelWriter\Sheet
Set Paper Size to A4 (when paperHeight and paperWidth are specified, paperSize should be ignored)
Parameters
None
pagePaperSizeLegal()
public function pagePaperSizeLegal(): avadim\FastExcelWriter\Sheet
Set Paper Size to Legal (when paperHeight and paperWidth are specified, paperSize should be ignored)
Parameters
None
pagePaperSizeLetter()
public function pagePaperSizeLetter(): avadim\FastExcelWriter\Sheet
Set Paper Size to Letter (when paperHeight and paperWidth are specified, paperSize should be ignored)
Parameters
None
pagePaperWidth()
public function pagePaperWidth($paperWidth): avadim\FastExcelWriter\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(): avadim\FastExcelWriter\Sheet
Set page orientation as Portrait
Parameters
None
pageScale()
public function pageScale(int $scale): avadim\FastExcelWriter\Sheet
Set page scale
Parameters
int $scale
protect()
public function protect(?string $password = null): avadim\FastExcelWriter\Sheet
Protect sheet
Parameters
string|null $password
setActiveCell()
public function setActiveCell($cellAddress): avadim\FastExcelWriter\Sheet
Set active cell
Parameters
$cellAddress
setAutoFilter()
public function setAutoFilter($rowOrCell,
?int $col = 1): avadim\FastExcelWriter\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): avadim\FastExcelWriter\Sheet
Set background color for the specific cell or range
Parameters
string $cellAddrstring $color
setBottomNodesOptions()
public function setBottomNodesOptions(string $node,
array $options): avadim\FastExcelWriter\Sheet
Set multiple options for a bottom node
Parameters
string $nodearray $options
setCellStyle()
public function setCellStyle(string $cellAddress, $style,
?bool $mergeStyles = false): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\Sheet
Set formats of columns
Parameters
array $formats
setColFormula()
public function setColFormula($col,
string $formula): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\Sheet
Set default font settings for the sheet
Parameters
string|array $font
setDefaultFontColor()
public function setDefaultFontColor(string $fontColor): avadim\FastExcelWriter\Sheet
Set default font color
Parameters
string $fontColor
setDefaultFontName()
public function setDefaultFontName(string $fontName): avadim\FastExcelWriter\Sheet
Set default font name for the sheet
Parameters
string $fontName
setDefaultFontSize()
public function setDefaultFontSize(int $fontSize): avadim\FastExcelWriter\Sheet
Set default font size for the sheet
Parameters
int $fontSize
setDefaultFontStyle()
public function setDefaultFontStyle(string $fontStyle): avadim\FastExcelWriter\Sheet
Set default font style (bold, italic, etc.) for the sheet
Parameters
string $fontStyle
setDefaultFontStyleBold()
public function setDefaultFontStyleBold(): avadim\FastExcelWriter\Sheet
Set default font style as bold for the sheet
Parameters
None
setDefaultFontStyleItalic()
public function setDefaultFontStyleItalic(): avadim\FastExcelWriter\Sheet
Set default font style as italic
Parameters
None
setDefaultFontStyleStrikethrough()
public function setDefaultFontStyleStrikethrough(): avadim\FastExcelWriter\Sheet
Set default font style as strikethrough
Parameters
None
setDefaultFontStyleUnderline()
public function setDefaultFontStyleUnderline(?bool $double = false): avadim\FastExcelWriter\Sheet
Set default font style as underline
Parameters
bool|null $double
setDefaultStyle()
public function setDefaultStyle($style): avadim\FastExcelWriter\Sheet
Sets default style
Parameters
array|Style $style
setFormat()
public function setFormat(string $cellAddr,
string $format): avadim\FastExcelWriter\Sheet
Set value format for the specific cell or range
Parameters
string $cellAddrstring $format
setFormula()
public function setFormula($cellAddress, $value,
$style): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\Sheet
Freeze columns
Parameters
int $freezeColumns-- Number columns to freeze
setFreezeRows()
public function setFreezeRows(int $freezeRows): avadim\FastExcelWriter\Sheet
Freeze rows
Parameters
int $freezeRows-- Number rows to freeze
setName()
public function setName(string $sheetName): avadim\FastExcelWriter\Sheet
Set sheet name
Parameters
string $sheetName
setOuterBorder()
public function setOuterBorder(string $range,
$style): avadim\FastExcelWriter\Sheet
Set outer border for the specific range
Parameters
string $rangestring|array|Style $style
setPrintArea()
public function setPrintArea(string $range): avadim\FastExcelWriter\Sheet
Set print area for the sheet
Parameters
string $range
setPrintCentered()
public function setPrintCentered(?bool $value = true): avadim\FastExcelWriter\Sheet
Center the print area horizontally and vertically
Parameters
bool|null $value
setPrintGridlines()
public function setPrintGridlines(?bool $bool = true): avadim\FastExcelWriter\Sheet
Show grid lines in the print area
Parameters
bool|null $bool
setPrintHorizontalCentered()
public function setPrintHorizontalCentered(?bool $value = true): avadim\FastExcelWriter\Sheet
Center the print area horizontally
Parameters
bool|null $value
setPrintLeftColumns()
public function setPrintLeftColumns(string $range): avadim\FastExcelWriter\Sheet
Set left columns to repeat on every printed page
Parameters
string $range
setPrintRowAndColumnHeading()
public function setPrintRowAndColumnHeading(?bool $bool = true): avadim\FastExcelWriter\Sheet
Print row and column headings in the printout
Parameters
bool|null $bool
setPrintTitles()
public function setPrintTitles(?string $rowsAtTop,
?string $colsAtLeft = null): avadim\FastExcelWriter\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): avadim\FastExcelWriter\Sheet
Set top rows to repeat on every printed page
Parameters
string $range
setPrintVerticalCentered()
public function setPrintVerticalCentered(?bool $value = true): avadim\FastExcelWriter\Sheet
Center the print area vertically
Parameters
bool|null $value
setRowDataStyle()
public function setRowDataStyle($rowRange,
$style): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\Sheet
Height of a specific row
Parameters
$rowNum$height
setRowHeights()
public function setRowHeights(array $heights): avadim\FastExcelWriter\Sheet
Multiple rows height
Parameters
array $heights
setRowHidden()
public function setRowHidden($rowNum): avadim\FastExcelWriter\Sheet
Hide a specific row
Parameters
int|array $rowNum
setRowOutlineLevel()
public function setRowOutlineLevel($rowNum, int $outlineLevel,
?bool $collapsed = null): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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(): avadim\FastExcelWriter\Sheet
Make the sheet hidden
Parameters
None
setStateVeryHidden()
public function setStateVeryHidden(): avadim\FastExcelWriter\Sheet
Make the sheet very hidden
Parameters
None
setStateVisible()
public function setStateVisible(): avadim\FastExcelWriter\Sheet
Make the sheet visible
Parameters
None
setStyle()
public function setStyle(string $cellAddress, $style,
?bool $mergeStyles = false): avadim\FastExcelWriter\Sheet
Alias for 'setCellStyle()'
Parameters
string $cellAddressarray|Style $stylebool|null $mergeStyles
setTabColor()
public function setTabColor(?string $color): avadim\FastExcelWriter\Sheet
Set color for the sheet tab
Parameters
string|null $color
setTopLeftCell()
public function setTopLeftCell($cellAddress): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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): avadim\FastExcelWriter\Sheet
Skip rows
Parameters
int|null $rowCount
unprotect()
public function unprotect(): avadim\FastExcelWriter\Sheet
Unprotect sheet
Parameters
None
withHeadings()
public function withHeadings(?array $headers = [], ?array $rowStyle = [],
?array $colStyles = []): SheetWriter
Set headings for the sheet
Naming. The wrapper uses
withHeadings()to match the Laravel ecosystem convention (as in maatwebsite/excel). The underlying writer has nowithHeader(); it writes a header row imperatively via writeHeader().withHeadings()instead defers the headings and writes them when the data is exported.
Without $headers the headings are the keys of the first record; if a mapping() is set, the keys
of the mapped record are used. With $headers as key => title pairs the rows are rearranged by the keys.
Parameters
array|null $headersarray|null $rowStylearray|null $colStyles
withLastCell()
public function withLastCell(): avadim\FastExcelWriter\Sheet
Select the last written cell for applying
Parameters
None
withLastRow()
public function withLastRow(): avadim\FastExcelWriter\Sheet
Select the last written row for applying
Parameters
None
withRange()
public function withRange($range): avadim\FastExcelWriter\Sheet
Select a custom range for applying
Parameters
array|string $range
writeArray()
public function writeArray(array $rowArray = [],
$rowStyle): avadim\FastExcelWriter\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): avadim\FastExcelWriter\Sheet
Write 2d array from the specified cell
Parameters
$topLeftCellarray $data
writeCell()
public function writeCell($value,
?array $styles = null): avadim\FastExcelWriter\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): avadim\FastExcelWriter\Sheet
Write several values into cells of one row
Parameters
array $valuesarray|null $cellStyles
writeData()
public function writeData($data, $rowStyle,
?array $colStyles = null): SheetWriter
Write data to the sheet. Accepts any iterable (array, Collection, LazyCollection, Model::cursor(), a generator, ...) or a callable that returns an iterable; any other value throws InvalidArgumentException
Parameters
iterable|callable $dataarray|Style|null $rowStylearray|null $colStyles
writeHeader()
public function writeHeader(array $header, ?array $rowStyle = null,
?array $colStyles = []): avadim\FastExcelWriter\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): SheetWriter
Write values to the current row
Parameters
array $rowValuesarray|Style|null $rowStylearray|null $cellStyles
writeRows()
public function writeRows(array $rowArray = [],
?array $rowStyle = null): avadim\FastExcelWriter\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): avadim\FastExcelWriter\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