php的phpExcel类生成excel时列超过26大于Z时解决办法

一、将列的数字序号转成字母使用,代码如下:

$phpExcel = new PHPExcel();

foreach($array as $k => $value){

$title_col = PHPExcel_Cell::stringFromColumnIndex($k); // 从0开始

$phpExcel->getActiveSheet()->setCellValue($title_col."1",$value);//标题行  

}

 

二、将列的字母转成数字序号使用,代码如下:

PHPExcel_Cell::columnIndexFromString('AA');

猜你喜欢

转载自blog.csdn.net/u011477914/article/details/82107159