Class \avadim\FastExcelWriter\Excel¶
- __construct() – Excel constructor
- cellAddress() – Create cell address by row and col numbers
- colIndex() – Convert letter to index (ZERO based)
- colIndexRange() – Convert letter range to array of numbers (ZERO based)
- colLetter() – Convert column number to letter
- colLetterRange() – Convert values to letters array
- colNumber() – Convert letter to number (ONE based)
- colNumberRange() – Convert letter range to array of numbers (ONE based)
- create() – Create a new workbook
- createSheet() – Creates a new sheet
- fullAddress() – Get full address with sheet name
- generateUuid() – Generate UUID v4
- newStyle() – Create a new instance of Style class
- pixelsToEMU() – Convert pixels to EMU (English Metric Units)
- rangeRelOffsets() – Return offsets by relative address (zero based)
- setTempDir() – Set dir for temporary files
- toTimestamp() – Convert value (int or string) to Excel timestamp
- addDefinedName() – Add a defined name
- addNamedRange() – Add a named range
- addSharedString() – Add a string to the shared strings table
- download() – Download generated file to client (send to browser)
- getDefaultFormatStyles() – Get default format styles
- getDefaultSheetName() – Get the default sheet name
- getDefaultStyle() – Get default style
- getDefinedNames() – Get all defined names
- getFileName() – Returns default filename
- getImageFiles() – Get list of all loaded image files
- getMetadata() – Get metadata
- getSharedStrings() – Get the shared strings table
- getSheet() – Alias of sheet()
- getSheets() – Returns all sheets
- getStyleCellStyles()
- getStyleCellStyleXfs()
- getStyleTableStyles()
- getWriter() – Get the writer instance
- isR1C1() – Is R1C1 notation mode enabled?
- isRightToLeft() – Get right-to-left orientation
- makeSheet() – Creates and returns a new sheet
- output() – Alias of download()
- protect() – Protect workbook
- removeSheet() – Removes sheet by index or name of sheet.
- save() – Save generated XLSX-file
- setActiveSheet() – Set active (default) sheet by case-insensitive name
- setAuthor() – Set the author of the document
- setCompany() – Set the company of the document
- setDefaultFont() – Set default font options
- setDefaultFontName() – Set default font name
- setDefaultLocale() – Set default locale from the current environment
- setDefaultStyle() – Set default style
- setDescription() – Set the description of the document
- setFileName() – Sets default filename for saving
- setKeywords() – Set the keywords of the document
- setLocale() – Set locale information
- setMetaAuthor() – Set metadata 'author'
- setMetaCompany() – Set metadata 'company'
- setMetadata() – Set metadata
- setMetaDescription() – Set metadata 'description'
- setMetaKeywords() – Set metadata 'keywords'
- setMetaSubject() – Set metadata 'subject'
- setMetaTitle() – Set metadata 'title'
- setR1C1() – Set R1C1 notation mode
- setRightToLeft() – Set right-to-left orientation
- setSharedString() – Set the usage of shared strings
- setSubject() – Set the subject of the document
- setTitle() – Set the title of the document
- sheet() – Returns sheet by number or name
- unprotect() – Unprotect workbook
__construct()¶
public function __construct($options)
Parameters¶
array|Options|null $options– Optional parameters: ['temp_dir' => ..., 'temp_prefix' => ..., 'auto_convert_number' => ..., 'shared_string' => ...]
cellAddress()¶
public static function cellAddress(int $rowNumber, int $colNumber,
?bool $absolute = false,
?bool $absoluteRow = null): string
Parameters¶
int $rowNumber– ONE basedint $colNumber– ONE basedbool|null $absolutebool|null $absoluteRow
Examples¶
cellAddress(3, 3) => 'C3'
cellAddress(43, 27) => 'AA43'
cellAddress(43, 27, true) => '$AA$43'
cellAddress(43, 27, false, true) => 'AA$43'
colIndex()¶
public static function colIndex(string $colLetter): int
Parameters¶
string $colLetter
colIndexRange()¶
public static function colIndexRange($colLetter): array
Parameters¶
string|int|array $colLetter– e.g.: 'B', 2, 'C:F', ['A', 'B', 'C']
colLetter()¶
public static function colLetter(int $colNumber): string
Parameters¶
int $colNumber– ONE based
colLetterRange()¶
public static function colLetterRange($colKeys, ?int $baseNum = 0): array
Parameters¶
array|string $colKeysint|null $baseNum– 0 or 1
Examples¶
$res = colLetterRange([0, 1, 2]); // returns ['A', 'B', 'C']
$res = colLetterRange([1, 2, 3], 1); // returns ['A', 'B', 'C']
$res = colLetterRange('B, E, F'); // returns ['B', 'E', 'F']
$res = colLetterRange('B-E, F'); // returns ['B', 'C', 'D', 'E', 'F']
$res = colLetterRange('B1-E8'); // returns ['B', 'C', 'D', 'E']
$res = colLetterRange('B1:E8'); // returns ['B:E']
colNumber()¶
public static function colNumber(string $colLetter): int
Parameters¶
string $colLetter
colNumberRange()¶
public static function colNumberRange($colLetter): array
Parameters¶
string|int|array $colLetter– e.g.: 'B', 2, 'C:F', ['A', 'B', 'C']
create()¶
public static function create($sheets, $options): Excel
Parameters¶
array|string|null $sheets– Name of sheet or array of namesarray|Options|null $options– Options
createSheet()¶
public static function createSheet(string $sheetName): Sheet
Parameters¶
string $sheetName
fullAddress()¶
public static function fullAddress(string $sheetName, string $address,
?bool $force = false): string
Parameters¶
string $sheetNamestring $addressbool|null $force
generateUuid()¶
public static function generateUuid(): string
Parameters¶
None
newStyle()¶
public static function newStyle(): Style\Style
Parameters¶
None
pixelsToEMU()¶
public static function pixelsToEMU($pixels): float|int
Parameters¶
int|float $pixels
rangeRelOffsets()¶
public static function rangeRelOffsets(string $relAddress): array
Parameters¶
string $relAddress
setTempDir()¶
public static function setTempDir($tempDir)
Parameters¶
$tempDir
toTimestamp()¶
public static function toTimestamp($value): float|bool
Parameters¶
int|string $value
addDefinedName()¶
public function addDefinedName(string $name, string $range,
?array $attributes = []): Excel
Parameters¶
string $namestring $rangearray|null $attributes
addNamedRange()¶
public function addNamedRange(string $range, string $name): Excel
Parameters¶
string $rangestring $name
addSharedString()¶
public function addSharedString(string $string, ?bool $richText = false): int
Parameters¶
string $stringbool|null $richText
download()¶
public function download(?string $name = null)
Parameters¶
string|null $name
getDefaultFormatStyles()¶
public function getDefaultFormatStyles(): array
Parameters¶
None
getDefaultSheetName()¶
public function getDefaultSheetName(): string
Parameters¶
None
getDefaultStyle()¶
public function getDefaultStyle(): array
Parameters¶
None
getDefinedNames()¶
public function getDefinedNames(): array
Parameters¶
None
getFileName()¶
public function getFileName(): string
Parameters¶
None
getImageFiles()¶
public function getImageFiles(): array
Parameters¶
None
getMetadata()¶
public function getMetadata($key): mixed
Parameters¶
null $key
getSharedStrings()¶
public function getSharedStrings(): array
Parameters¶
None
getSheet()¶
public function getSheet($index): ?Sheet
Parameters¶
int|string|null $index– - number or name of sheet
getSheets()¶
public function getSheets(): array
Parameters¶
None
getStyleCellStyles()¶
public function getStyleCellStyles(): array
Parameters¶
None
getStyleCellStyleXfs()¶
public function getStyleCellStyleXfs(): array
Parameters¶
None
getStyleTableStyles()¶
public function getStyleTableStyles(): array
Parameters¶
None
getWriter()¶
public function getWriter(): Writer
Parameters¶
None
isR1C1()¶
public function isR1C1(): bool
Parameters¶
None
isRightToLeft()¶
public function isRightToLeft(): bool
Parameters¶
None
makeSheet()¶
public function makeSheet(?string $sheetName = null): Sheet
Parameters¶
string|null $sheetName
output()¶
public function output(?string $name = null): void
Parameters¶
string|null $name
protect()¶
public function protect(?string $password = null): Excel
Parameters¶
string|null $password
removeSheet()¶
public function removeSheet($index): Excel
Parameters¶
int|string|null $index
save()¶
public function save(?string $fileName = null, ?bool $overWrite = true): bool
Parameters¶
string|null $fileNamebool|null $overWrite
setActiveSheet()¶
public function setActiveSheet(string $name): Excel
Parameters¶
string $name
setAuthor()¶
public function setAuthor(?string $author = ''): Excel
Parameters¶
string|null $author
setCompany()¶
public function setCompany(?string $company = ''): Excel
Parameters¶
string|null $company
setDefaultFont()¶
public function setDefaultFont(array $fontOptions): Excel
Parameters¶
array $fontOptions
setDefaultFontName()¶
public function setDefaultFontName(string $fontName): Excel
Parameters¶
string $fontName
setDefaultLocale()¶
public function setDefaultLocale()
Parameters¶
None
setDefaultStyle()¶
public function setDefaultStyle(array $style): Excel
Parameters¶
array $style
setDescription()¶
public function setDescription(?string $description = ''): Excel
Parameters¶
string|null $description
setFileName()¶
public function setFileName(string $fileName): Excel
Parameters¶
string $fileName
setKeywords()¶
public function setKeywords($keywords): Excel
Parameters¶
string|array $keywords
setLocale()¶
public function setLocale(string $locale, ?string $dir = null): Excel
Parameters¶
string $localestring|null $dir
setMetaAuthor()¶
public function setMetaAuthor(?string $author = ''): Excel
Parameters¶
string|null $author
setMetaCompany()¶
public function setMetaCompany(?string $company = ''): Excel
Parameters¶
string|null $company
setMetadata()¶
public function setMetadata($key, $value): Excel
Parameters¶
$key$value
setMetaDescription()¶
public function setMetaDescription(?string $description = ''): Excel
Parameters¶
string|null $description
setMetaKeywords()¶
public function setMetaKeywords($keywords): Excel
Parameters¶
mixed $keywords
setMetaSubject()¶
public function setMetaSubject(?string $subject = ''): Excel
Parameters¶
string|null $subject
setMetaTitle()¶
public function setMetaTitle(?string $title = ''): Excel
Parameters¶
string|null $title
setR1C1()¶
public function setR1C1(bool $option = true): Excel
Parameters¶
bool $option
setRightToLeft()¶
public function setRightToLeft(bool $isRightToLeft)
Parameters¶
bool $isRightToLeft
setSharedString()¶
public function setSharedString(bool $option = true): Excel
Parameters¶
bool $option
setSubject()¶
public function setSubject(?string $subject = ''): Excel
Parameters¶
string|null $subject
setTitle()¶
public function setTitle(?string $title = ''): Excel
Parameters¶
string|null $title
sheet()¶
public function sheet($index): ?Sheet
Parameters¶
int|string|null $index– - number or name of sheet
unprotect()¶
public function unprotect(): Excel
Parameters¶
None