lib/IgraalOSL/StatsTable/Dumper/Excel/ExcelDumper.php
protected function applyValue(Worksheet $sheet, $col, $row, $value, $format, $styleArray = [])
    {
        if (0 == count($styleArray)) {
            $styleArray = $this->getDefaultStyleArrayForRow($row);
        }

        $style = new Style();
        $style->applyFromArray($styleArray);

        switch ($format) {
            case Format::DATE:
                if (!($value instanceof \DateTime)) {
                    $date = new \DateTime($value);
                } else {
                    $date = $value;
                }
                $value = Date::PHPToExcel($date);
                $style->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2);
                break;

            case Format::DATETIME:
                if (!($value instanceof \DateTime)) {
                    $date = new \DateTime($value);
                } else {
                    $date = $value;
                }
                $value = Date::PHPToExcel($date);
                $style->getNumberFormat()->setFormatCode(self::FORMAT_DATETIME);
                break;

            case Format::FLOAT2:
                $style->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1);
                break;

            case Format::INTEGER:
                $style->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_NUMBER);
                break;

            case Format::MONEY:
            case Format::MONEY2:
                $style->getNumberFormat()->setFormatCode(self::FORMAT_EUR);
                break;

            case Format::PCT:
                $style->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_PERCENTAGE);
                break;

            case Format::PCT2:
                $style->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_PERCENTAGE_00);
                break;

            case Format::STRING:
                $style->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_TEXT);
                break;
        }

        $sheet->setCellValueByColumnAndRow($col, $row, $value);
        $sheet->duplicateStyle($style, Coordinate::stringFromColumnIndex($col).$row);
    }
protected function applyValue(Worksheet $sheet, $col, $row, $value, $format, $styleArray = [])
    {
        if (0 == count($styleArray)) {
            $styleArray = $this->getDefaultStyleArrayForRow($row);
        }

        $style = new Style();
        $style->applyFromArray($styleArray);

        switch ($format) {
            case Format::DATE:
                if (!($value instanceof \DateTime)) {
                    $date = new \DateTime($value);
                } else {
                    $date = $value;
                }
                $value = Date::PHPToExcel($date);
                $style->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_DATE_YYYYMMDD2);
                break;

            case Format::DATETIME:
                if (!($value instanceof \DateTime)) {
                    $date = new \DateTime($value);
                } else {
                    $date = $value;
                }
                $value = Date::PHPToExcel($date);
                $style->getNumberFormat()->setFormatCode(self::FORMAT_DATETIME);
                break;

            case Format::FLOAT2:
                $style->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_NUMBER_COMMA_SEPARATED1);
                break;

            case Format::INTEGER:
                $style->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_NUMBER);
                break;

            case Format::MONEY:
            case Format::MONEY2:
                $style->getNumberFormat()->setFormatCode(self::FORMAT_EUR);
                break;

            case Format::PCT:
                $style->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_PERCENTAGE);
                break;

            case Format::PCT2:
                $style->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_PERCENTAGE_00);
                break;

            case Format::STRING:
                $style->getNumberFormat()->setFormatCode(NumberFormat::FORMAT_TEXT);
                break;
        }

        $sheet->setCellValueByColumnAndRow($col, $row, $value);
        $sheet->duplicateStyle($style, Coordinate::stringFromColumnIndex($col).$row);
    }
protected function applyValue ( Worksheet $ sheet , $ col , $ row , $ value , $ format , $ styleArray = [ ] ) { if ( 0 == count ( $ styleArray ) ) { $ styleArray = $ this -> getDefaultStyleArrayForRow ( $ row ) ; } $ style = new Style ( ) ; $ style -> applyFromArray ( $ styleArray ) ; switch ( $ format ) { case Format :: DATE : if ( ! ( $ value instanceof \ DateTime ) ) { $ date = new \ DateTime ( $ value ) ; } else { $ date = $ value ; } $ value = Date :: PHPToExcel ( $ date ) ; $ style -> getNumberFormat ( ) -> setFormatCode ( NumberFormat :: FORMAT_DATE_YYYYMMDD2 ) ; break ; case Format :: DATETIME : if ( ! ( $ value instanceof \ DateTime ) ) { $ date = new \ DateTime ( $ value ) ; } else { $ date = $ value ; } $ value = Date :: PHPToExcel ( $ date ) ; $ style -> getNumberFormat ( ) -> setFormatCode ( self :: FORMAT_DATETIME ) ; break ; case Format :: FLOAT2 : $ style -> getNumberFormat ( ) -> setFormatCode ( NumberFormat :: FORMAT_NUMBER_COMMA_SEPARATED1 ) ; break ; case Format :: INTEGER : $ style -> getNumberFormat ( ) -> setFormatCode ( NumberFormat :: FORMAT_NUMBER ) ; break ; case Format :: MONEY : case Format :: MONEY2 : $ style -> getNumberFormat ( ) -> setFormatCode ( self :: FORMAT_EUR ) ; break ; case Format :: PCT : $ style -> getNumberFormat ( ) -> setFormatCode ( NumberFormat :: FORMAT_PERCENTAGE ) ; break ; case Format :: PCT2 : $ style -> getNumberFormat ( ) -> setFormatCode ( NumberFormat :: FORMAT_PERCENTAGE_00 ) ; break ; case Format :: STRING : $ style -> getNumberFormat ( ) -> setFormatCode ( NumberFormat :: FORMAT_TEXT ) ; break ; } $ sheet -> setCellValueByColumnAndRow ( $ col , $ row , $ value ) ; $ sheet -> duplicateStyle ( $ style , Coordinate :: stringFromColumnIndex ( $ col ) . $ row ) ; }
Set value in specific cell
@param Worksheet $sheet      The worksheet
@param integer             $col        The selected column
@param integer             $row        The selected row
@param array               $value      The values to insert
@param array               $format     Associative arrays with formats
@param array               $styleArray An array representing the style
@throws \Exception
Set value in specific cell