Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Ods/Content.php
private function writeXfStyles(XMLWriter $writer, Spreadsheet $spreadsheet)
    {
        foreach ($spreadsheet->getCellXfCollection() as $style) {
            $writer->startElement('style:style');
            $writer->writeAttribute('style:name', self::CELL_STYLE_PREFIX . $style->getIndex());
            $writer->writeAttribute('style:family', 'table-cell');
            $writer->writeAttribute('style:parent-style-name', 'Default');

            // style:text-properties

            // Font
            $writer->startElement('style:text-properties');

            $font = $style->getFont();

            if ($font->getBold()) {
                $writer->writeAttribute('fo:font-weight', 'bold');
                $writer->writeAttribute('style:font-weight-complex', 'bold');
                $writer->writeAttribute('style:font-weight-asian', 'bold');
            }

            if ($font->getItalic()) {
                $writer->writeAttribute('fo:font-style', 'italic');
            }

            if ($color = $font->getColor()) {
                $writer->writeAttribute('fo:color', sprintf('#%s', $color->getRGB()));
            }

            if ($family = $font->getName()) {
                $writer->writeAttribute('fo:font-family', $family);
            }

            if ($size = $font->getSize()) {
                $writer->writeAttribute('fo:font-size', sprintf('%.1fpt', $size));
            }

            if ($font->getUnderline() && $font->getUnderline() != Font::UNDERLINE_NONE) {
                $writer->writeAttribute('style:text-underline-style', 'solid');
                $writer->writeAttribute('style:text-underline-width', 'auto');
                $writer->writeAttribute('style:text-underline-color', 'font-color');

                switch ($font->getUnderline()) {
                    case Font::UNDERLINE_DOUBLE:
                        $writer->writeAttribute('style:text-underline-type', 'double');

                        break;
                    case Font::UNDERLINE_SINGLE:
                        $writer->writeAttribute('style:text-underline-type', 'single');

                        break;
                }
            }

            $writer->endElement(); // Close style:text-properties

            // style:table-cell-properties

            $writer->startElement('style:table-cell-properties');
            $writer->writeAttribute('style:rotation-align', 'none');

            // Fill
            if ($fill = $style->getFill()) {
                switch ($fill->getFillType()) {
                    case Fill::FILL_SOLID:
                        $writer->writeAttribute('fo:background-color', sprintf(
                            '#%s',
                            strtolower($fill->getStartColor()->getRGB())
                        ));

                        break;
                    case Fill::FILL_GRADIENT_LINEAR:
                    case Fill::FILL_GRADIENT_PATH:
                        /// TODO :: To be implemented
                        break;
                    case Fill::FILL_NONE:
                    default:
                }
            }

            $writer->endElement(); // Close style:table-cell-properties

            // End

            $writer->endElement(); // Close style:style
        }
    }
private function writeXfStyles(XMLWriter $writer, Spreadsheet $spreadsheet)
    {
        foreach ($spreadsheet->getCellXfCollection() as $style) {
            $writer->startElement('style:style');
            $writer->writeAttribute('style:name', self::CELL_STYLE_PREFIX . $style->getIndex());
            $writer->writeAttribute('style:family', 'table-cell');
            $writer->writeAttribute('style:parent-style-name', 'Default');

            // style:text-properties

            // Font
            $writer->startElement('style:text-properties');

            $font = $style->getFont();

            if ($font->getBold()) {
                $writer->writeAttribute('fo:font-weight', 'bold');
                $writer->writeAttribute('style:font-weight-complex', 'bold');
                $writer->writeAttribute('style:font-weight-asian', 'bold');
            }

            if ($font->getItalic()) {
                $writer->writeAttribute('fo:font-style', 'italic');
            }

            if ($color = $font->getColor()) {
                $writer->writeAttribute('fo:color', sprintf('#%s', $color->getRGB()));
            }

            if ($family = $font->getName()) {
                $writer->writeAttribute('fo:font-family', $family);
            }

            if ($size = $font->getSize()) {
                $writer->writeAttribute('fo:font-size', sprintf('%.1fpt', $size));
            }

            if ($font->getUnderline() && $font->getUnderline() != Font::UNDERLINE_NONE) {
                $writer->writeAttribute('style:text-underline-style', 'solid');
                $writer->writeAttribute('style:text-underline-width', 'auto');
                $writer->writeAttribute('style:text-underline-color', 'font-color');

                switch ($font->getUnderline()) {
                    case Font::UNDERLINE_DOUBLE:
                        $writer->writeAttribute('style:text-underline-type', 'double');

                        break;
                    case Font::UNDERLINE_SINGLE:
                        $writer->writeAttribute('style:text-underline-type', 'single');

                        break;
                }
            }

            $writer->endElement(); // Close style:text-properties

            // style:table-cell-properties

            $writer->startElement('style:table-cell-properties');
            $writer->writeAttribute('style:rotation-align', 'none');

            // Fill
            if ($fill = $style->getFill()) {
                switch ($fill->getFillType()) {
                    case Fill::FILL_SOLID:
                        $writer->writeAttribute('fo:background-color', sprintf(
                            '#%s',
                            strtolower($fill->getStartColor()->getRGB())
                        ));

                        break;
                    case Fill::FILL_GRADIENT_LINEAR:
                    case Fill::FILL_GRADIENT_PATH:
                        /// TODO :: To be implemented
                        break;
                    case Fill::FILL_NONE:
                    default:
                }
            }

            $writer->endElement(); // Close style:table-cell-properties

            // End

            $writer->endElement(); // Close style:style
        }
    }
Write XF cell styles.

@param XMLWriter $writer
@param Spreadsheet $spreadsheet