D
D
Dmitry Bay2015-07-11 19:43:19
PHP
Dmitry Bay, 2015-07-11 19:43:19

How to force PHPExcel to save a large file?

The problem is this, I'm trying to write empty columns to a page in Excel, the dimension is
A1:TT87 .
In this case, the table is not written to the final excel file. when reducing the dimension of the input data, the excel document is generated normally. which way to look?

$cacheMethod = PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
        $cacheSettings = array( 'memoryCacheSize ' => '256MB');
        PHPExcel_Settings::setCacheStorageMethod($cacheMethod, $cacheSettings);
        $objPHPExcel = PHPExcel_IOFactory::load(dirname($_SERVER['SCRIPT_FILENAME'])."/uploads/example.xls");
// здесь код для вставки ячеек. 
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
        $objWriter->save(Yii::app()->basePath.'/../uploads/'.time().'exles.xls');

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2015-07-11
@kawabanga

Server timeout?
memory limit?
Does it give an error?
You can break the task into stages, launch them with ajax, and show the user the status of the download. And it's beautiful and the server is not loaded.
First we create a file, then we write it in parts, each time we check whether it opens for writing, if the file is too large and kills the RAM, we create a new one. The output is 2 or more files.
You can create csv instead of excel, it's easier. I do not think that you put formulas and pivot tables there.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question