我如何在phpspreadsheet中设置动态创建的数组的样式

时间:2019-02-11 19:11:55

标签: php phpspreadsheet phpoffice

使用phpspreadsheet,我有一个动态数组(数组中的项目数可以更改),我设法为数组中的每个项目动态创建一行,但是由于文本,我还需要通过更改其行高来设置样式在该行中溢出。

// this code creates a row for each item in my array    
$columnArray = array_chunk($result, 1);
$spreadsheet->getActiveSheet()
->fromArray(
    $columnArray,   // The data to set
    NULL,           // Array values with this value will not be set
    'A11'            // Top left coordinate of the worksheet range where
                    //    we want to set these values (default is A1)
);

// i then need to use the following code to set the row height
$spreadsheet->getActiveSheet()->getRowDimension('11')->setRowHeight(30);

我想要的输出是将数组中每个创建的行的行高设置为30,如果有某种类型的循环可以使用此代码,那将会很棒。 谢谢

0 个答案:

没有答案
相关问题