我正在逐行写入excel,并在写入每一行后尝试获取当前行高。
我尝试使用getDefaultRowHeightByFont()根据字体类型获取默认行高。
$font_type='times new roman';
$sheet->getDefaultRowHeightByFont(\PhpOffice\PhpSpreadsheet\Style\Font.$font_type)
行高应该是我们在excel表中手动检查行高时获得的精确值。但是,我收到了错误
Call to undefined method PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::getDefaultRowHeightByFont()
如何正确调用该功能?提前致谢。
能够让它运行。
use PhpOffice\PhpSpreadsheet\Shared\Font as SharedFont;
$default_rowheight=SharedFont::getDefaultRowHeightByFont($spreadsheet->getDefaultStyle()->getFont());
但是,此方法仅显示该工作表中默认字体样式的行高。因此,我们无法找到具有默认字体样式的行的准确行高。