Forum


Replies: 3   Views: 494
Get the style and format from a cell
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 jeroen8087  · 08-02-2023 - 09:24

Thank you for your reply.

In general this is not a real issue, except for cells representing a date. A cell containing a date has a numeric value. Example:

// Cell A1 contains the date 01-01-2023, with cell type "date"
$cellContents = $xlsx->getCell("A1");

echo $cellContents["value"];
// this gives the integer 44927



// Cell A2 contains the number 44927, with cell type "number"
$cellContents = $xlsx->getCell("A2");

echo $cellContents["value"];
// this gives the integer 44927

Converting 44927 to 01-01-2023 is not hard knowing the Excel 1900 date format. But, without knowing the cell format, we do not know if the value represents a date or an integer.