I
I
Igness_Music2015-11-19 10:38:25
phpspreadsheet
Igness_Music, 2015-11-19 10:38:25

How to save template formatting?

There is a task to fill the account from the coming data. With the help of PHPExcel, I threw in such a script.

$c = 'test1.xls';

$objPHPexcel = PHPExcel_IOFactory::load('orig.xlsx');

$objWorksheet = $objPHPexcel->getActiveSheet();
$objWorksheet->getCell('R17C7')->setValue('Тестовое Имя');

$objWriter = PHPExcel_IOFactory::createWriter($objPHPexcel, 'Exce15');
$objWriter->save($c);?>

It does its job, inserts text into the desired cell, but the appearance flies:
It was: prntscr.com/94fai5
It becomes: prntscr.com/94fb1n
Hence the question: what could be the problem and how to save the formatting?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sergeevVasily, 2020-05-07
@sergeevVasily

There was a similar problem. I was helped by replacing writer with Excel5on Excel2007in the line
Was:

PHPExcel_IOFactory::createWriter($objPHPexcel, 'Exce15');

It became:
PHPExcel_IOFactory::createWriter($objPHPexcel, 'Excel2007');

And, in my opinion, your writer has the wrong name Exce15, probably meantExcel5

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question