phpphpexcelphpspreadsheet

PHPOffice/PhpSpreadsheet: Reset cell style


In the docs

i didn't find any useful function for my need.

Is it possible to "reset" / "delete the entire formatting" of a single cell? Return the cell to its original state.


Solution

  • explicitly undoing the previous format should work:

    $ws->getStyle('A1')->applyFromArray(array(
        'font' => array('bold' => false)
    ));
    

    when importing, one can also skip formats altogether: $reader->setReadDataOnly(true);