小编Von*_*ier的帖子

PhpExcel SUM()返回0

正如标题中所述,我在PHP中使用的SUM()函数始终在生成的文档中显示"0".

有点奇怪的是,当我直接在doc中做同样的公式时,通过选择单元格等,结果很好:/

这是代码:

public function generateDocument($name, $description, $params, $criteres, $options) {

    // création du doc au format xsl
    $doc = new \PHPExcel();
    $doc->getProperties()->setCreator(UASG_NAME)
        ->setTitle($name)
        ->setDescription($description);

    $doc->setActiveSheetIndex(0);
    $worksheet = $doc->getActiveSheet();
    // création du nom de l'onglet pour les datas
    $worksheet->setTitle($this->createSheetTitle($name));

    $dataService = new DataService($this->pdo, $this->context, $this->logger);
    $table=$dataService->search($params, $criteres);

    $this->startTimer("GENEREDATAS");
    $headRow=null;$totalRow=null;
    $this->currencyColumns = array();

    $lineNumber = 1;

    // ajout du titre en haut du fichier
    if(isset($options->heading) && $options->heading!=""){
        $worksheet->mergeCells('A1:Z2');
        $worksheet->setCellValue('A1', $options->heading);
        $worksheet->getStyle('A1')->getFont()->setSize(13);
        $worksheet->getStyle('A1')->getFont()->setBold(true);
        $previousLineNumber=4;
    }else{
        $previousLineNumber=0;
    }

    foreach ($table['rows'] as $rowindex => …
Run Code Online (Sandbox Code Playgroud)

php excel-formula phpexcel

1
推荐指数
1
解决办法
1195
查看次数

标签 统计

excel-formula ×1

php ×1

phpexcel ×1