无效的单元格坐标phpExcel

问题描述 投票:1回答:2

我已经测试了如果使用vlookup在自助表中搜索“= vlookup(h2,A2:B2000,2,False)”并从其他表单返回值“= SupplierList!A2”和“= vlookup(SupplierList!H3,A2) :B2000,2,假)“也没关系。

那么为什么只有“= vlookup(h3,SupplierList!A2:B2000,2,False)”才会出错?

- - - - - - - - - - - - - - 错误信息 - - - - - - - - - - - ----------

Fatal error: Uncaught exception 'Exception' with message 'PO!G2 -> Invalid cell coordinate A' in C:\Program Files\EasyPHP-5.3.6.0\www\ExcelImporter\Classes\PHPExcel\Cell.php:288 Stack trace: #0 C:\Program Files\EasyPHP-5.3.6.0\www\ExcelImporter\Classes\PHPExcel\Cell.php(204): PHPExcel_Cell->getCalculatedValue() #1 C:\Program Files\EasyPHP-5.3.6.0\www\ExcelImporter\Documentation\Examples\index.php(36): PHPExcel_Cell->getFormattedValue() #2 {main} thrown in C:\Program Files\EasyPHP-5.3.6.0\www\ExcelImporter\Classes\PHPExcel\Cell.php on line 288

- - - - - - - - - - - - - - 错误信息 - - - - - - - - - - - ----------

Cell的配方就像这个**=IF(ISERROR(VLOOKUP(H2349,'Supplier List'!A:B,2,FALSE)),"-",VLOOKUP(H2349,'Supplier List'!A:B,2,FALSE))**

cell phpexcel coordinate
2个回答
0
投票

评论太久了...

调试计算错误时,我使用以下内容:

function testFormula($sheet,$cell) {
    $formulaValue = $sheet->getCell($cell)->getValue();
    echo '<b>'.$cell.' Value is </b>'.$formulaValue."<br />\n";
    $expectedValue = $sheet->getCell($cell)->getOldCalculatedValue();
    echo '<b>'.$cell.' Expected Value is </b>'.((!is_null($expectedValue)) ? $expectedValue : 'UNKNOWN')."<br />\n";


    $calculate = false;
    try {
        $tokens = PHPExcel_Calculation::getInstance()->parseFormula($formulaValue,$sheet->getCell($cell));
        echo '<b>Parser Stack :-</b><pre>';
        print_r($tokens);
        echo '</pre>';
        $calculate = true;
    } catch (Exception $e) {
        echo "PARSER ERROR: ".$e->getMessage()."<br />\n";

        echo '<b>Parser Stack :-</b><pre>';
        print_r($tokens);
        echo '</pre>';
    }

    if ($calculate) {
        try {
            $cellValue = $sheet->getCell($cell)->getCalculatedValue();
            echo '<b>'.$cell.' Calculated Value is </b>'.$cellValue."<br />\n";

            echo '<h3>Evaluation Log:</h3><pre>';
            print_r(PHPExcel_Calculation::getInstance()->debugLog);
            echo '</pre>';
        } catch (Exception $e) {
            echo "CALCULATION ENGINE ERROR: ".$e->getMessage()."<br />\n";

            echo '<h3>Evaluation Log:</h3><pre>';
            print_r(PHPExcel_Calculation::getInstance()->debugLog);
            echo '</pre>';
        }
    }
}


$sheet = $objPHPExcel->getActiveSheet();
PHPExcel_Calculation::getInstance()->writeDebugLog = true;


testFormula($sheet,'A4');

这提供了计算引擎正在执行的所有操作的相当详细的日志,从而可以识别问题的原因。

如果您只想在保存文件时禁用单元格值计算,则可以在实例化yor writer之后但在发出save命令之前发出以下命令:

$objWriter->setPreCalculateFormulas(FALSE);

-1
投票

para resolver esse problema“无效的单元格坐标”$ this-> caracteres = array('','A','B','C','D','E','F','G','H ','我','J','K','L','M','N','O','P','Q','R','S','T', 'U','V','X','Y','W','Z','AA','AB','AC','AD','AE','AF','AG ','AH','AI','AJ','AK','AL','AM','AN','AO','AP','AQ','AR','AS', 'AT','AU','AV','AX','AY','AW','AZ');

添加更多字符,'AA','AB','AC','AD','AE','AF','AG','AH','AI','AJ','AK','AL ','AM','AN','AO','AP','AQ','AR','AS','AT','AU','AV','AX','AY', 'AW','AZ'); ....

英语解决这个问题“无效的单元格坐标”$ this-> characters = array('','A','B','C','D','E','F','G',' H','我','J','K','L','M','N','O','P','Q','R','S','T' ,'U','V','X','Y','W','Z''AA','AB','AC','AD','AE','AF','AG ','AH','AI','AJ','AK','AL','AM''AN','AO','AP','AQ','AR','AS',' AT','AU','AV','AX','AY','AW','AZ');

添加更多字符,'AA','AB','AC','AD','AE','AF','AG','AH','AI','AJ','AK','AL ','AM''AN','AO','AP','AQ','AR','AS','AT','AU','AV','AX','AY',' AW','AZ'); ....

© www.soinside.com 2019 - 2024. All rights reserved.