0

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.

Premlatha
  • 1,676
  • 2
  • 20
  • 40

1 Answers1

0

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.

Premlatha
  • 1,676
  • 2
  • 20
  • 40