Search code examples
phppear

PHP/PEAR - Retain trailing zeros when creating spreadsheets


I'm using the PHP PEAR package to generate excel spreadsheets. I have data of type double with trailing zeros that need to be retained. How can I preserve this data without having the Worksheet::writeNumber function truncate the zeros? I've tried changing the format string in the pack function but no luck yet.


Solution

  • Add a ' before it, e.g.

    "'" . $number