Skip to content

固定内存模式写入$excel->data()和insertText内存占用一样吗 #557

@liewkaitsan

Description

@liewkaitsan

希望使用固定内存模式写入。但是$excel->data()没法像insertDate一样设置dateFormat
发现导出的时候占用内存还是很大。到5gb了

        ...

        $config = ['path' => dirname($filePath)];
        $excel = new Excel($config);
        $excel->constMemory(basename($filePath), 'Sheet1', false);

        if ($this->isDateType($mapping->fieldType)) {
            $excel->insertDate($row, $col, $timestamp, 'yyyy-mm-dd hh:mm:ss', $format);
        } else {
            if ($format === null) {
                $excel->insertText($row, $col, (string) $value);
            } else {
                $excel->insertText($row, $col, $value, null, $format);
            }
        }

        ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions