Issue
I am writing to excel row by row and try to get current row height after write to each row.
I tried use getDefaultRowHeightByFont() to get default row height based on font type.
$font_type='times new roman';
$sheet->getDefaultRowHeightByFont(\PhpOffice\PhpSpreadsheet\Style\Font.$font_type)
The row height should be exact value that we get when manually check for row height in excel sheet. But, I got the error
Call to undefined method PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getDefaultRowHeightByFont()
How to call that function correctly? Thanks in advance.
Solution
Able to make it run.
use PhpOffice\PhpSpreadsheet\Shared\Font as SharedFont;
$default_rowheight=SharedFont::getDefaultRowHeightByFont($spreadsheet->getDefaultStyle()->getFont());
But, this method only show row height for default font style in that sheet. So, we could not find accurate row height for row with different font style from default.
Answered By - Premlatha Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.