private function writeCells(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Worksheet_Row $row)
    {
        $number_cols_repeated = self::NUMBER_COLS_REPEATED_MAX;
        $prev_column = -1;
        $cells = $row->getCellIterator();
        while ($cells->valid()) {
            $cell = $cells->current();
            $column = PHPExcel_Cell::columnIndexFromString($cell->getColumn()) - 1;

            $this->writeCellSpan($objWriter, $column, $prev_column);
            $objWriter->startElement('table:table-cell');

            switch ($cell->getDataType()) {
                case PHPExcel_Cell_DataType::TYPE_BOOL:
                    $objWriter->writeAttribute('office:value-type', 'boolean');
                    $objWriter->writeAttribute('office:value', $cell->getValue());
                    $objWriter->writeElement('text:p', $cell->getValue());
                    break;

                case PHPExcel_Cell_DataType::TYPE_ERROR:
                    throw new PHPExcel_Writer_Exception('Writing of error not implemented yet.');
                    break;

                case PHPExcel_Cell_DataType::TYPE_FORMULA:
                    try {
                        $formula_value = $cell->getCalculatedValue();
                    } catch (Exception $e) {
                        $formula_value = $cell->getValue();
                    }
                    $objWriter->writeAttribute('table:formula', 'of:' . $cell->getValue());
                    if (is_numeric($formula_value)) {
                        $objWriter->writeAttribute('office:value-type', 'float');
                    } else {
                        $objWriter->writeAttribute('office:value-type', 'string');
                    }
                    $objWriter->writeAttribute('office:value', $formula_value);
                    $objWriter->writeElement('text:p', $formula_value);
                    break;

                case PHPExcel_Cell_DataType::TYPE_INLINE:
                    throw new PHPExcel_Writer_Exception('Writing of inline not implemented yet.');
                    break;

                case PHPExcel_Cell_DataType::TYPE_NUMERIC:
                    $objWriter->writeAttribute('office:value-type', 'float');
                    $objWriter->writeAttribute('office:value', $cell->getValue());
                    $objWriter->writeElement('text:p', $cell->getValue());
                    break;

                case PHPExcel_Cell_DataType::TYPE_STRING:
                    $objWriter->writeAttribute('office:value-type', 'string');
                    $objWriter->writeElement('text:p', $cell->getValue());
                    break;
            }
            PHPExcel_Writer_OpenDocument_Cell_Comment::write($objWriter, $cell);
            $objWriter->endElement();
            $prev_column = $column;
            $cells->next();
        }
        $number_cols_repeated = $number_cols_repeated - $prev_column - 1;
        if ($number_cols_repeated > 0) {
            if ($number_cols_repeated > 1) {
                $objWriter->startElement('table:table-cell');
                $objWriter->writeAttribute('table:number-columns-repeated', $number_cols_repeated);
                $objWriter->endElement();
            } else {
                $objWriter->writeElement('table:table-cell');
            }
        }
    }