AUTOSIZE_METHOD_APPROX
AUTOSIZE_METHOD_APPROX = 'approx'
$defaultColumnWidths : array
How wide is a default column for a given default font and size? Empirical data found by inspecting real Excel files and reading off the pixel width in Microsoft Office Excel 2007.
$autoSizeMethod : string
AutoSize method.
$trueTypeFontPath : string
Path to folder containing TrueType font .ttf files.
calculateColumnWidth(\PhpOffice\PhpSpreadsheet\Style\Font $font, \PhpOffice\PhpSpreadsheet\RichText\RichText|string $cellText = '', int $rotation, null|\PhpOffice\PhpSpreadsheet\Style\Font $defaultFont = null) : int
Calculate an (approximate) OpenXML column width, based on font size and text contained.
\PhpOffice\PhpSpreadsheet\Style\Font | $font | Font object |
\PhpOffice\PhpSpreadsheet\RichText\RichText|string | $cellText | Text to calculate width |
int | $rotation | Rotation angle |
null|\PhpOffice\PhpSpreadsheet\Style\Font | $defaultFont | Font object |
Column width
getTextWidthPixelsExact(string $text, \PhpOffice\PhpSpreadsheet\Style\Font $font, int $rotation) : int
Get GD text width in pixels for a string of text in a certain font at a certain rotation angle.
string | $text | |
\PhpOffice\PhpSpreadsheet\Style\Font | $font | |
int | $rotation |
getTextWidthPixelsApprox(string $columnText, \PhpOffice\PhpSpreadsheet\Style\Font $font, int $rotation) : int
Get approximate width in pixels for a string of text in a certain font at a certain rotation angle.
string | $columnText | |
\PhpOffice\PhpSpreadsheet\Style\Font | $font | |
int | $rotation |
Text width in pixels (no padding added)
getDefaultColumnWidthByFont(\PhpOffice\PhpSpreadsheet\Style\Font $font, bool $pPixels = false) : mixed
Get the effective column width for columns without a column dimension or column with width -1 For example, for Calibri 11 this is 9.140625 (64 px).
\PhpOffice\PhpSpreadsheet\Style\Font | $font | The workbooks default font |
bool | $pPixels | true = return column width in pixels, false = return in OOXML units |
Column width
getDefaultRowHeightByFont(\PhpOffice\PhpSpreadsheet\Style\Font $font) : float
Get the effective row height for rows without a row dimension or rows with height -1 For example, for Calibri 11 this is 15 points.
\PhpOffice\PhpSpreadsheet\Style\Font | $font | The workbooks default font |
Row height in points