Class \avadim\FastExcelWriter\Sheet¶
- __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
- 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)
Parameters¶
string $sheetName
addCellStyle()¶
public function addCellStyle(string $cellAddr, $style): Sheet
Parameters¶
string $cellAddrarray|Style $style
addChart()¶
public function addChart(string $range,
avadim\FastExcelWriter\Charts\Chart $chart): Sheet
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
Parameters¶
string $rangeConditional|Conditional[] $conditionals
addDataValidation()¶
public function addDataValidation(string $range,
avadim\FastExcelWriter\DataValidation\DataValidation $validation): Sheet
Parameters¶
string $rangeDataValidation $validation
addImage()¶
public function addImage(string $cell, string $imageFile,
?array $imageStyle = []): Sheet
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
Parameters¶
string $rangestring $name
Examples¶
$sheet->addNamedRange('B3:C5', 'Demo');
addNote()¶
public function addNote($cell, $comment, array $noteStyle = []): 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
Parameters¶
string $cellAddrarray|Style $style
allowAutoFilter()¶
public function allowAutoFilter(?bool $allow = true): Sheet
Parameters¶
bool|null $allow
allowDeleteColumns()¶
public function allowDeleteColumns(?bool $allow = true): Sheet
Parameters¶
bool|null $allow
allowDeleteRows()¶
public function allowDeleteRows(?bool $allow = true): Sheet
Parameters¶
bool|null $allow
allowEditObjects()¶
public function allowEditObjects(?bool $allow = true): Sheet
Parameters¶
bool|null $allow
allowEditScenarios()¶
public function allowEditScenarios(?bool $allow = true): Sheet
Parameters¶
bool|null $allow
allowFormatCells()¶
public function allowFormatCells(?bool $allow = true): Sheet
Parameters¶
bool|null $allow
allowFormatColumns()¶
public function allowFormatColumns(?bool $allow = true): Sheet
Parameters¶
bool|null $allow
allowFormatRows()¶
public function allowFormatRows(?bool $allow = true): Sheet
Parameters¶
bool|null $allow
allowInsertColumns()¶
public function allowInsertColumns(?bool $allow = true): Sheet
Parameters¶
bool|null $allow
allowInsertHyperlinks()¶
public function allowInsertHyperlinks(?bool $allow = true): Sheet
Parameters¶
bool|null $allow
allowInsertRows()¶
public function allowInsertRows(?bool $allow = true): Sheet
Parameters¶
bool|null $allow
allowPivotTables()¶
public function allowPivotTables(?bool $allow = true): Sheet
Parameters¶
bool|null $allow
allowSelectCells()¶
public function allowSelectCells(?bool $allow = true): Sheet
Parameters¶
bool|null $allow
allowSelectLockedCells()¶
public function allowSelectLockedCells(?bool $allow = true): Sheet
Parameters¶
bool|null $allow
allowSelectUnlockedCells()¶
public function allowSelectUnlockedCells(?bool $allow = true): Sheet
Parameters¶
bool|null $allow
allowSort()¶
public function allowSort(?bool $allow = true): Sheet
Parameters¶
bool|null $allow
applyAlignLeft()¶
public function applyAlignLeft(): Sheet
Parameters¶
None
applyAlignRight()¶
public function applyAlignRight(): Sheet
Parameters¶
None
applyBgColor()¶
public function applyBgColor(string $color, ?string $pattern = null): Sheet
Parameters¶
string $colorstring|null $pattern
applyBorder()¶
public function applyBorder(string $style, ?string $color = '#000000'): Sheet
Parameters¶
string $stylestring|null $color
applyBorderBottom()¶
public function applyBorderBottom(string $style,
?string $color = '#000000'): Sheet
Parameters¶
string $stylestring|null $color
applyBorderLeft()¶
public function applyBorderLeft(string $style,
?string $color = '#000000'): Sheet
Parameters¶
string $stylestring|null $color
applyBorderRight()¶
public function applyBorderRight(string $style,
?string $color = '#000000'): Sheet
Parameters¶
string $stylestring|null $color
applyBorderTop()¶
public function applyBorderTop(string $style,
?string $color = '#000000'): Sheet
Parameters¶
string $stylestring|null $color
applyColor()¶
public function applyColor(string $color): Sheet
Parameters¶
string $color
applyConditionalFormatting()¶
public function applyConditionalFormatting($conditionals): Sheet
Parameters¶
Conditional|Conditional[] $conditionals
applyDataValidation()¶
public function applyDataValidation(avadim\FastExcelWriter\DataValidation\DataValidation $validation): Sheet
Parameters¶
DataValidation $validation
applyFillColor()¶
public function applyFillColor(string $color, ?string $pattern = null): Sheet
Parameters¶
string $colorstring|null $pattern
applyFillGradient()¶
public function applyFillGradient(string $color1, string $color2,
?int $degree = null): Sheet
Parameters¶
string $color1string $color2int|null $degree
applyFont()¶
public function applyFont(string $fontName, ?int $fontSize = null,
?string $fontStyle = null,
?string $fontColor = null): Sheet
Parameters¶
string $fontNameint|null $fontSizestring|null $fontStylestring|null $fontColor
applyFontColor()¶
public function applyFontColor(string $fontColor): Sheet
Parameters¶
string $fontColor
applyFontName()¶
public function applyFontName(string $fontName): Sheet
Parameters¶
string $fontName
applyFontSize()¶
public function applyFontSize(float $fontSize): Sheet
Parameters¶
float $fontSize
applyFontStyle()¶
public function applyFontStyle(string $fontStyle): Sheet
Parameters¶
string $fontStyle
applyFontStyleBold()¶
public function applyFontStyleBold(): Sheet
Parameters¶
None
applyFontStyleItalic()¶
public function applyFontStyleItalic(): Sheet
Parameters¶
None
applyFontStyleStrikethrough()¶
public function applyFontStyleStrikethrough(): Sheet
Parameters¶
None
applyFontStyleUnderline()¶
public function applyFontStyleUnderline(?bool $double = false): Sheet
Parameters¶
bool|null $double
applyFormat()¶
public function applyFormat($format): Sheet
Parameters¶
string|array $format
applyHide()¶
public function applyHide(?bool $hide = true): Sheet
Parameters¶
bool|null $hide
applyIndentDistributed()¶
public function applyIndentDistributed(int $indent): Sheet
Parameters¶
int $indent
applyIndentLeft()¶
public function applyIndentLeft(int $indent): Sheet
Parameters¶
int $indent
applyIndentRight()¶
public function applyIndentRight(int $indent): Sheet
Parameters¶
int $indent
applyInnerBorder()¶
public function applyInnerBorder(string $style,
?string $color = '#000000'): Sheet
Parameters¶
string $stylestring|null $color
applyNamedRange()¶
public function applyNamedRange(string $name): Sheet
Parameters¶
string $name
applyOuterBorder()¶
public function applyOuterBorder(string $style,
?string $color = '#000000'): Sheet
Parameters¶
string $stylestring|null $color
applyRowHeight()¶
public function applyRowHeight(float $height): Sheet
Parameters¶
float $height
applyRowOutlineLevel()¶
public function applyRowOutlineLevel(int $outlineLevel): Sheet
Parameters¶
int $outlineLevel
applyStyle()¶
public function applyStyle($style): Sheet
Parameters¶
array|Style $style
applyTextAlign()¶
public function applyTextAlign(string $textAlign,
?string $verticalAlign = null): Sheet
Parameters¶
string $textAlignstring|null $verticalAlign
applyTextCenter()¶
public function applyTextCenter(): Sheet
Parameters¶
None
applyTextColor()¶
public function applyTextColor(string $color): Sheet
Parameters¶
string $color
applyTextRotation()¶
public function applyTextRotation(int $degrees): Sheet
Parameters¶
int $degrees
applyTextWrap()¶
public function applyTextWrap(?bool $textWrap = true): Sheet
Parameters¶
bool|null $textWrap
applyUnlock()¶
public function applyUnlock(?bool $unlock = true): Sheet
Parameters¶
bool $unlock
applyVerticalAlign()¶
public function applyVerticalAlign(string $verticalAlign): Sheet
Parameters¶
string $verticalAlign
beginArea()¶
public function beginArea(?string $cellAddress = null): Area
Parameters¶
string|null $cellAddress– Upper left cell of area
beginOutlineLevel()¶
public function beginOutlineLevel(?bool $collapsed = false): Sheet
Parameters¶
bool|null $collapsed
cell()¶
public function cell($cellAddress): Sheet
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
Parameters¶
None
endAreas()¶
public function endAreas(): Sheet
Parameters¶
None
endOutlineLevel()¶
public function endOutlineLevel(): Sheet
Parameters¶
None
getCharts()¶
public function getCharts(): array
Parameters¶
None
getColAttributes()¶
public function getColAttributes(): array
Parameters¶
None
getConditionalFormatting()¶
public function getConditionalFormatting(): array
Parameters¶
None
getCurrentCell()¶
public function getCurrentCell(): string
Parameters¶
None
getCurrentCol()¶
public function getCurrentCol(): string
Parameters¶
None
getCurrentColId()¶
public function getCurrentColId(): int
Parameters¶
None
getCurrentRow()¶
public function getCurrentRow(): int
Parameters¶
None
getCurrentRowId()¶
public function getCurrentRowId(): int
Parameters¶
None
getDataValidations()¶
public function getDataValidations(): array
Parameters¶
None
getDefaultStyle()¶
public function getDefaultStyle(): array
Parameters¶
None
getHeaderFooterOptions()¶
public function getHeaderFooterOptions(): array
Parameters¶
None
getHyperlinks()¶
public function getHyperlinks(): array
Parameters¶
None
getImages()¶
public function getImages(): array
Parameters¶
None
getLastCell()¶
public function getLastCell(?bool $absolute = false): string
Parameters¶
bool|null $absolute
getLastRange()¶
public function getLastRange(?bool $absolute = false): string
Parameters¶
bool|null $absolute
getMergedCells()¶
public function getMergedCells(): array
Parameters¶
None
getName()¶
public function getName(): string
Parameters¶
None
getNamedRanges()¶
public function getNamedRanges(): array
Parameters¶
None
getNotes()¶
public function getNotes(): array
Parameters¶
None
getOutlineLevel()¶
public function getOutlineLevel(): int
Parameters¶
None
isName()¶
public function isName(string $name): bool
Parameters¶
string $name
isRightToLeft()¶
public function isRightToLeft(): bool
Parameters¶
None
makeArea()¶
public function makeArea(string $range): Area
Parameters¶
string $range– A1:Z9 or R1C1:R9C28
mergeCells()¶
public function mergeCells($rangeSet, ?int $mergeFlag = 0): Sheet
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
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
Parameters¶
None
nextRow()¶
public function nextRow($style, ?bool $forceRow = false): Sheet
Parameters¶
array|Style|null $stylebool|null $forceRow
pageFitToHeight()¶
public function pageFitToHeight($numPage): Sheet
Parameters¶
int|string|null $numPage
pageFitToWidth()¶
public function pageFitToWidth($numPage): Sheet
Parameters¶
int|string|null $numPage
pageFooter()¶
public function pageFooter($footer): Sheet
Parameters¶
string|array $footer
pageFooterEven()¶
public function pageFooterEven($footer): Sheet
Parameters¶
string|array $footer
pageFooterFirst()¶
public function pageFooterFirst($footer): Sheet
Parameters¶
string|array $footer
pageFooterOdd()¶
public function pageFooterOdd(string $footer): Sheet
Parameters¶
string $footer
pageHeader()¶
public function pageHeader($header): Sheet
Parameters¶
string|array $header
pageHeaderEven()¶
public function pageHeaderEven($header): Sheet
Parameters¶
string|array $header
pageHeaderFirst()¶
public function pageHeaderFirst($header): Sheet
Parameters¶
string|array $header
pageHeaderFooter()¶
public function pageHeaderFooter(?string $header, ?string $footer): Sheet
Parameters¶
string|null $headerstring|null $footer
pageHeaderOdd()¶
public function pageHeaderOdd($header): Sheet
Parameters¶
string|array $header
pageLandscape()¶
public function pageLandscape(): Sheet
Parameters¶
None
pageMarginBottom()¶
public function pageMarginBottom($value): Sheet
Parameters¶
string|float $value
pageMarginFooter()¶
public function pageMarginFooter($value): Sheet
Parameters¶
string|float $value
pageMarginHeader()¶
public function pageMarginHeader($value): Sheet
Parameters¶
string|float $value
pageMarginLeft()¶
public function pageMarginLeft($value): Sheet
Parameters¶
string|float $value
pageMarginRight()¶
public function pageMarginRight($value): Sheet
Parameters¶
string|float $value
pageMargins()¶
public function pageMargins(array $margins): Sheet
Parameters¶
array $margins
pageMarginTop()¶
public function pageMarginTop($value): Sheet
Parameters¶
string|float $value
pageOrientationLandscape()¶
public function pageOrientationLandscape(): Sheet
Parameters¶
None
pageOrientationPortrait()¶
public function pageOrientationPortrait(): Sheet
Parameters¶
None
pagePaperHeight()¶
public function pagePaperHeight($paperHeight): Sheet
Parameters¶
string|float|int $paperHeight
pagePaperSize()¶
public function pagePaperSize(int $paperSize): Sheet
Parameters¶
int $paperSize
pagePaperSizeA3()¶
public function pagePaperSizeA3(): Sheet
Parameters¶
None
pagePaperSizeA4()¶
public function pagePaperSizeA4(): Sheet
Parameters¶
None
pagePaperSizeLegal()¶
public function pagePaperSizeLegal(): Sheet
Parameters¶
None
pagePaperSizeLetter()¶
public function pagePaperSizeLetter(): Sheet
Parameters¶
None
pagePaperWidth()¶
public function pagePaperWidth($paperWidth): Sheet
Parameters¶
string|float|int $paperWidth
pagePortrait()¶
public function pagePortrait(): Sheet
Parameters¶
None
pageScale()¶
public function pageScale(int $scale): Sheet
Parameters¶
int $scale
protect()¶
public function protect(?string $password = null): Sheet
Parameters¶
string|null $password
setActiveCell()¶
public function setActiveCell($cellAddress): Sheet
Parameters¶
$cellAddress
setAutoFilter()¶
public function setAutoFilter($rowOrCell, ?int $col = 1): Sheet
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
Parameters¶
string $cellAddrstring $color
setBottomNodesOptions()¶
public function setBottomNodesOptions(string $node, array $options): Sheet
Parameters¶
string $nodearray $options
setCellStyle()¶
public function setCellStyle(string $cellAddress, $style,
?bool $mergeStyles = false): Sheet
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
Parameters¶
int|string|array $col– Column number or column letter (or array of these)
setColDataStyle()¶
public function setColDataStyle($colRange, $colStyle): Sheet
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
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
Parameters¶
int|string|array $col– Column number or column letter (or array of these)mixed $format
setColFormats()¶
public function setColFormats(array $formats): Sheet
Parameters¶
array $formats
setColFormula()¶
public function setColFormula($col, string $formula): Sheet
Parameters¶
int|string|array $col– Column number or column letter (or array of these)string $formula
setColHidden()¶
public function setColHidden($col): Sheet
Parameters¶
int|string|array $col– Column number or column letter (or array of these)
setColMinWidth()¶
public function setColMinWidth($col, $width): Sheet
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
Parameters¶
array $widths
Examples¶
$sheet->setColWidths(['B' => 10, 'C' => 'auto', 'E' => 30, 'F' => 40]);
setColOutlineLevel()¶
public function setColOutlineLevel($col, int $outlineLevel): Sheet
Parameters¶
int|string|array $col– Column number or column letter (or array of these)int $outlineLevel
setColStyle()¶
public function setColStyle($colRange, $style): Sheet
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
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
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
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
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
Parameters¶
array $widthsbool|null $min
Examples¶
$sheet->setColWidths(['B' => 10, 'C' => 'auto', 'E' => 30, 'F' => 40]);
setDefaultFont()¶
public function setDefaultFont($font): Sheet
Parameters¶
string|array $font
setDefaultFontColor()¶
public function setDefaultFontColor(string $fontColor): Sheet
Parameters¶
string $fontColor
setDefaultFontName()¶
public function setDefaultFontName(string $fontName): Sheet
Parameters¶
string $fontName
setDefaultFontSize()¶
public function setDefaultFontSize(int $fontSize): Sheet
Parameters¶
int $fontSize
setDefaultFontStyle()¶
public function setDefaultFontStyle(string $fontStyle): Sheet
Parameters¶
string $fontStyle
setDefaultFontStyleBold()¶
public function setDefaultFontStyleBold(): Sheet
Parameters¶
None
setDefaultFontStyleItalic()¶
public function setDefaultFontStyleItalic(): Sheet
Parameters¶
None
setDefaultFontStyleStrikethrough()¶
public function setDefaultFontStyleStrikethrough(): Sheet
Parameters¶
None
setDefaultFontStyleUnderline()¶
public function setDefaultFontStyleUnderline(?bool $double = false): Sheet
Parameters¶
bool|null $double
setDefaultStyle()¶
public function setDefaultStyle($style): Sheet
Parameters¶
array|Style $style
setFormat()¶
public function setFormat(string $cellAddr, string $format): Sheet
Parameters¶
string $cellAddrstring $format
setFormula()¶
public function setFormula($cellAddress, $value, $style): Sheet
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
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
Parameters¶
int $freezeColumns– Number columns to freeze
setFreezeRows()¶
public function setFreezeRows(int $freezeRows): Sheet
Parameters¶
int $freezeRows– Number rows to freeze
setName()¶
public function setName(string $sheetName): Sheet
Parameters¶
string $sheetName
setOuterBorder()¶
public function setOuterBorder(string $range, $style): Sheet
Parameters¶
string $rangestring|array|Style $style
setPrintArea()¶
public function setPrintArea(string $range): Sheet
Parameters¶
string $range
setPrintCentered()¶
public function setPrintCentered(?bool $value = true): Sheet
Parameters¶
bool|null $value
setPrintGridlines()¶
public function setPrintGridlines(?bool $bool = true): Sheet
Parameters¶
bool|null $bool
setPrintHorizontalCentered()¶
public function setPrintHorizontalCentered(?bool $value = true): Sheet
Parameters¶
bool|null $value
setPrintLeftColumns()¶
public function setPrintLeftColumns(string $range): Sheet
Parameters¶
string $range
setPrintRowAndColumnHeading()¶
public function setPrintRowAndColumnHeading(?bool $bool = true): Sheet
Parameters¶
bool|null $bool
setPrintTitles()¶
public function setPrintTitles(?string $rowsAtTop,
?string $colsAtLeft = null): Sheet
Parameters¶
string|null $rowsAtTopstring|null $colsAtLeft
setPrintTopRows()¶
public function setPrintTopRows(string $range): Sheet
Parameters¶
string $range
setPrintVerticalCentered()¶
public function setPrintVerticalCentered(?bool $value = true): Sheet
Parameters¶
bool|null $value
setRowDataStyle()¶
public function setRowDataStyle($rowRange, $style): Sheet
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
Parameters¶
array $rowStyles
Examples¶
$sheet->setRowDataStyleArray([3 => $style1, 5 => $style2]); // styles for rows 3 and 5
setRowHeight()¶
public function setRowHeight($rowNum, $height): Sheet
Parameters¶
$rowNum$height
setRowHeights()¶
public function setRowHeights(array $heights): Sheet
Parameters¶
array $heights
setRowHidden()¶
public function setRowHidden($rowNum): Sheet
Parameters¶
int|array $rowNum
setRowOutlineLevel()¶
public function setRowOutlineLevel($rowNum, int $outlineLevel,
?bool $collapsed = null): Sheet
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
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
Parameters¶
array $rowStyles
Examples¶
$sheet->setRowStyleArray([3 => $style1, 5 => $style2]); // styles for rows 3 and 5
setRowVisible()¶
public function setRowVisible($rowNum, bool $visible): Sheet
Parameters¶
int|array $rowNumbool $visible
setShowGridLines()¶
public function setShowGridLines(bool $flag): void
Parameters¶
bool $flag
setStateHidden()¶
public function setStateHidden(): Sheet
Parameters¶
None
setStateVeryHidden()¶
public function setStateVeryHidden(): Sheet
Parameters¶
None
setStateVisible()¶
public function setStateVisible(): Sheet
Parameters¶
None
setStyle()¶
public function setStyle(string $cellAddress, $style,
?bool $mergeStyles = false): Sheet
Parameters¶
string $cellAddressarray|Style $stylebool|null $mergeStyles
setTabColor()¶
public function setTabColor(?string $color): Sheet
Parameters¶
string|null $color
setTopLeftCell()¶
public function setTopLeftCell($cellAddress): Sheet
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
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
Parameters¶
int|null $rowCount
unprotect()¶
public function unprotect(): Sheet
Parameters¶
None
withLastCell()¶
public function withLastCell(): Sheet
Parameters¶
None
withLastRow()¶
public function withLastRow(): Sheet
Parameters¶
None
withRange()¶
public function withRange($range): Sheet
Parameters¶
array|string $range
writeArray()¶
public function writeArray(array $rowArray = [], $rowStyle): Sheet
Parameters¶
array $rowArray– Array of rowsarray|Style|null $rowStyle– Style applied to each row
writeArrayTo()¶
public function writeArrayTo($topLeftCell, array $data): Sheet
Parameters¶
$topLeftCellarray $data
writeCell()¶
public function writeCell($value, ?array $styles = null): Sheet
Parameters¶
mixed $valuearray|null $styles
writeCells()¶
public function writeCells(array $values, ?array $cellStyles = null): Sheet
Parameters¶
array $valuesarray|null $cellStyles
writeHeader()¶
public function writeHeader(array $header, ?array $rowStyle = null,
?array $colStyles = []): Sheet
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
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
Parameters¶
array $rowArray– Array of rowsarray|null $rowStyle– Style applied to each row
writeTo()¶
public function writeTo($cellAddress, $value, $style,
?int $mergeFlag = 0): Sheet
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