我明白我需要写一个我使用的循环SetCellValue('cell_name', 'value'); 但PHPExcel中是否有一个方法只接受一个数组并将其写入Excel工作表行?
就像是:
$testArray = array('testcelltext1', 'testcelltext2', testcelltext3');
PHPExcel::writeArraytoRow($testArray);
//do the other PHPExcel stuff to actually write the file
.
.
.
// outputs an excel file in which the PHP array was written to the first row
我在附带的文档中找不到类似的内容,但这可能只是糟糕的PDF搜索技巧......
Mar*_*ker 72
$objPHPExcel->getActiveSheet()->fromArray($testArray, NULL, 'A1');
Run Code Online (Sandbox Code Playgroud)
它被用在许多例子中
API文档中描述的参数
/**
* Fill worksheet from values in array
*
* @param array $source Source array
* @param mixed $nullValue Value in source array that stands for blank cell
* @param string $startCell Insert array starting from this cell address as the top left coordinate
* @param boolean $strictNullComparison Apply strict comparison when testing for null values in the array
* @throws Exception
* @return PHPExcel_Worksheet
*/
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
45245 次 |
| 最近记录: |