• Resolved maroxis

    (@maroxis)


    I’ve made some formulas using ‘Custom php to modify output’
    In
    add_action( ‘woe_xls_print_footer’, function ($objXls,$formatter) {}
    I’ve used
    $sheet->setCellValue( “G”. ($row+2), “=SUMIF(L4:L$row;23;G4:G$row)”);

    But in exported excel sheet it appeared as Error508 until user manually edited formula (adding space and removing worked)
    According to docs https://phpspreadsheet.readthedocs.io/en/latest/topics/recipes/#write-a-formula-into-a-cell I’m supposed to use setCellValueExplicit but using:

    $sheet->setCellValueExplicit( “G”. ($row+1), “=SUM(G4:G$row)”, \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

    throws error:

    PHP Fatal error:  Uncaught Error: Class “PhpOffice\PhpSpreadsheet\Cell\DataType” not found in […]/wp-content/plugins/woo-order-export-lite/classes/core/class-wc-order-export-engine.php(370) : eval()’d code:49

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support aprokaev

    (@aprokaev)

    hello

    We use PHPExcel, so replace

    \PhpOffice\PhpSpreadsheet\Cell\DataType::TYPE_STRING);

    with

    PHPExcel_Cell_DataType::TYPE_STRING

    Thread Starter maroxis

    (@maroxis)

    Changing it to PHPExcel_Cell_DataType::TYPE_FORMULA fixed PHP error, but I still got formulas showing as Error 508, doesn’t matter if I use setCellValueExplicit or setCellValue

    Plugin Support aprokaev

    (@aprokaev)

    please, submit your settings as new ticket to https://algolplus.freshdesk.com/

    use tab Tools to get them.

    but I will reply only tomorrow , it’s late here

    Thread Starter maroxis

    (@maroxis)

    Thanks,
    It seems that I had to replace ; with , in formula. Probably language formula conversion error. There is another problem that it sometimes shows 0 instead of calculated value, but it looks like libre office specific problem.

    Plugin Support aprokaev

    (@aprokaev)

    You’re welcome

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Export Critical error with XLS PHP setCellValueExplicit’ is closed to new replies.