AUTOSIZE_METHOD_APPROX
AUTOSIZE_METHOD_APPROX = 'approx'
calculateColumnWidth(\PhpOffice\PhpSpreadsheet\Style\Font $font, \PhpOffice\PhpSpreadsheet\RichText\RichText|string $cellText = '', integer $rotation, null|\PhpOffice\PhpSpreadsheet\Style\Font $defaultFont = null) : integer
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 |
integer | $rotation | Rotation angle |
null|\PhpOffice\PhpSpreadsheet\Style\Font | $defaultFont | Font object |
Column width
getTextWidthPixelsExact(string $text, \PhpOffice\PhpSpreadsheet\Style\Font $font, integer $rotation) : integer
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 | |
integer | $rotation |
getTextWidthPixelsApprox(string $columnText, \PhpOffice\PhpSpreadsheet\Style\Font $font, integer $rotation) : integer
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 | |
integer | $rotation |
Text width in pixels (no padding added)
getTrueTypeFontFileFromFont(\PhpOffice\PhpSpreadsheet\Style\Font $font) : string
Returns the font path given the font.
\PhpOffice\PhpSpreadsheet\Style\Font | $font |
Path to TrueType font file
getDefaultColumnWidthByFont(\PhpOffice\PhpSpreadsheet\Style\Font $font, boolean $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 |
boolean | $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