Object of class PHPExcel_RichText could not be converted to int

论坛 期权论坛 编程之家     
选择匿名的用户   2021-6-2 17:48   2743   0

laravel中使用PhpSpreadsheet对excel导入报错:Object of class PHPExcel_RichText could not be converted to int

原因是单元格中混杂了格式化的文本,string类型和richText类型混杂在一起,richeText类型要使用getPlainText()方法取内容.

if(gettype($cell)=='string'){//多数情况是string
return $cell;
}else if(gettype($cell)=='object'){//偶尔数据格式不一样

//info(get_class($cell);//这里根据反射可以调试具体对象类型
return $cell->getPlainText();
}

https://stackoverflow.com/questions/27439150/object-of-class-phpexcel-richtext-could-not-be-converted-to-int

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP