dps43633 2017-07-06 21:12
浏览 39
已采纳

PHPExcel没有正确格式化项目符号点

I'm exporting a report from Oracle service cloud database to Excel. Everything is working as expected but when there is a bullet points it show as a weird Characters. Filling the report is being done by a form which insert into the database and then I'm exporting this report to Excel using PHPExcel and Excel5.php class. When I use the HTML.php class I see the bullet point with no problem but then I lose some of Excel formatting. Below is my code

header('Content-Type: application/xls');
    header('Content-Disposition: attachment;filename="' . $fileName . '.xls"');
    header('Cache-Control: max-age=0');

    header('Cache-Control: max-age=1');

    header ('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); 
    header ('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
    header ('Cache-Control: cache, must-revalidate'); // HTTP/1.1
    header ('Pragma: public'); // HTTP/1.0
    $objWriter = \PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
    $objWriter->save('php://output');

I did research this issue and some advice to make all data type as a string but that did not make any changes. $objPHPExcel->getActiveSheet()->setCellValueExplicit('A1','0987', PHPExcel_Cell_DataType::TYPE_STRING);

Used the UTF-8 still did not change anything.

Can you please help?

  • 写回答

1条回答 默认 最新

  • doume1301 2017-07-12 17:28
    关注

    So I like to share my solution on this. I'm still unable to export bullet points but I was able to convert them to another character.

    $colValue = htmlentities($colValue);
    $colValue = html_entity_decode($colValue,ENT_QUOTES,'UTF-8');
    $colValue = str_replace("•",":-","$colValue");
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 matlab求解平差
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
  • ¥15 安装svn网络有问题怎么办
  • ¥15 vue2登录调用后端接口如何实现