phpSpreadsheet公式丢失

时间:2018-08-20 15:41:26

标签: phpspreadsheet

在读写具有公式的现有电子表格时遇到问题。保存后,我的公式将丢失。

    $inputFileType = IOFactory::identify($inputFileName);
    $reader = IOFactory::createReader($inputFileType);
    $reader->setLoadSheetsOnly($sheetname);
    $spreadsheet = $reader->load($inputFileName);
    $spreadsheet->getProperties()->setCreator('TEST');
    $writer = IOFactory::createWriter($spreadsheet, $inputFileType);
    $writer->save($inputFileName);

示例公式:

=IF(COUNTIF(L4:V4;"")>0;"testing1";IF(SUMPRODUCT(($L4:$V4="n")*($L$2:$V$2={"K1"\"K2"}))>0;"testing2";IF(SUMPRODUCT(2*($L4:$V4="n")*($L$2:$V$2="K3"))+SUMPRODUCT(($L4:$V4="n")*($L$2:$V$2="K4"))>4;"testing3";IF(SUMPRODUCT(2*($L4:$V4="n")*($L$2:$V$2="K3"))+SUMPRODUCT(($L4:$V4="n")*($L$2:$V$2="K4"))>0;"testing4";"testing5"))))

0 个答案:

没有答案