Forum


Replies: 1   Views: 289
Setcellvalue
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpxlsx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpxlsx version and check the Documentation available.

Posted by KaiVoigt  · 11-10-2022 - 09:57

If you want to set a cell value by coordinates, for example setting text for cell A1, the correct way is to call this addCell method. This way the whole styles will be kept.

$xlsx = new CreateXlsxFromTemplate($filename);
$xlsx->addCell(array('text' => 'Inserted text'), 'A1', array(), array('useCellStyles' => true));

I think this is not a very reader friendly way to simply change a cell value.

You might wanna think about another method ('setCellValue' for example) which calls the above method and only requires a string and a coordinate parameter. This way the user code is way more readable.

Posted by admin  · 11-10-2022 - 10:02

Hello,

Thanks for your feedback. We have sent it to the dev team.

Regards.