douhu4692 2016-04-12 11:10 采纳率: 100%
浏览 121

将公式替换为单元格值PHPExcel

Similar to these documentations.

https://support.office.com/en-us/article/Replace-a-formula-with-its-result-32a9675c-45f0-4a15-b130-d55356437c86 (For Mac) And https://support.office.com/en-us/article/Replace-a-formula-with-its-result-38001951-c0e8-4fbd-9048-37ef81e2891e (For Windows)

Can we replace a Formula with the cell Value using PHPExcel.

For example: Given Cell 'A1' that contains Formula "='Sheet1'!L2". The formula equates to 1. Is there a way to replace the function to hold '1' and erase the input formula with PHPExcel?

If not, that would be really handy for optimization, and to remove the excessive problems that arise from ->getOldCalculatedValue/getCalculatedValue/->setPreCalculateFormulas().

Thanks

  • 写回答

1条回答 默认 最新

  • doubu1970 2016-04-12 11:18
    关注

    Logically

    $objPHPExcel->getActiveSheet()
        ->setCellValue(
            'A1',
            $objPHPExcel->getActiveSheet()
                ->getCell('A1')
                ->getCalculatedValue()
        );
    

    Though I fail to see how it can optimize anything, because you still have to calculate the formula to get the value anyway

    评论

报告相同问题?

悬赏问题

  • ¥15 slam rangenet++配置
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料
  • ¥15 使用R语言marginaleffects包进行边际效应图绘制
  • ¥20 usb设备兼容性问题
  • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊