styles

Phpspreadsheet how to set autoheight for merged cell?

为君一笑 提交于 2020-12-06 16:01:26
问题 setWrapText work well for one cell, but not works for merged cell. Here is the code I use to set autosize for merged cell, but it not works. $sheet = $spreadsheet->getActiveSheet(); $sheet->fromArray([["1\n1\n2\n\n3\n"],range(1,3),['188196','test']]); $sheet->mergeCells('A1:D1'); $sheet->getStyle("A1:D1")->getAlignment()->setWrapText(true); unmerged cell: merged cell: 回答1: Maybe you must set a rowhight by calculation. See this article. You could try $spreadsheet->getActiveSheet()-