插入文字

优质
小牛编辑
128浏览
2023-12-01
insertText(int $row, int $column, string|int|double $data[, string $format, resource $formatHandler])

int $row
$excel = new \Vtiful\Kernel\Excel($config);
​
$textFile = $excel->fileName("free.xlsx")
    ->header(['name', 'money']);
​
for ($index = 0; $index < 10; $index++) {
    $textFile->insertText($index+1, 0, 'viest');
    $textFile->insertText($index+1, 1, 10000, '#,##0'); // #,##0 为单元格数据样式
}
​
$textFile->output();

数字样式示例

更多样式请参考 Excel 微软文档

"0.000"
"#,##0"
"#,##0.00"
"0.00"
"0 \"dollar and\" .00 \"cents\""