1

I would like to get if the cell is bold or not when importing cell value and other properties into database with PHPExcel

var_dump($worksheet->getCellByColumnAndRow($column, $row)->getStyle()->getFont()->getBold());

I easily get the value, but whenever the cell is bold or not that thing return always false

           while($worksheet->getCellByColumnAndRow($column, $row)->getValue() != NULL) {

                $tableCell = $worksheet->getCellByColumnAndRow($column, $row)->getValue();

                //Test if the field is in bold
                if ($worksheet->getCellByColumnAndRow($column, $row)->getStyle()->getFont()->getBold())
                {
                    $header = true;
                }else
                {
                    $header = false;
                }

                //Test if the field need to be displayed
                if (preg_match($regPattern, $tableCell))
                    $displayOnQuestion = true;
                else
                    $displayOnQuestion = false;

                $inputTableCell = array(
                    "FK_Question" => $idQuestion,
                    "Content" => $tableCell,
                    "Column_Nb" => $nbColumn,
                    "Row_Nb" => $nbRow,
                    "Header" => $header,
                    "Display_In_Question" => $displayOnQuestion,
                    "Creation_Date" => date("Y-m-d H:i:s")
                );`

All datas are inserted correctly except the "Header" that will be true if the cell is bold

Exemple of sheet excel with header

If anyone can help me to get this, that would be great !

Simon Uldry
  • 23
  • 1
  • 7

0 Answers0