Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/Style.php
private function writeCellStyleXf(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style\Style $pStyle, Spreadsheet $spreadsheet)
    {
        // xf
        $objWriter->startElement('xf');
        $objWriter->writeAttribute('xfId', 0);
        $objWriter->writeAttribute('fontId', (int) $this->getParentWriter()->getFontHashTable()->getIndexForHashCode($pStyle->getFont()->getHashCode()));
        if ($pStyle->getQuotePrefix()) {
            $objWriter->writeAttribute('quotePrefix', 1);
        }

        if ($pStyle->getNumberFormat()->getBuiltInFormatCode() === false) {
            $objWriter->writeAttribute('numFmtId', (int) ($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164));
        } else {
            $objWriter->writeAttribute('numFmtId', (int) $pStyle->getNumberFormat()->getBuiltInFormatCode());
        }

        $objWriter->writeAttribute('fillId', (int) $this->getParentWriter()->getFillHashTable()->getIndexForHashCode($pStyle->getFill()->getHashCode()));
        $objWriter->writeAttribute('borderId', (int) $this->getParentWriter()->getBordersHashTable()->getIndexForHashCode($pStyle->getBorders()->getHashCode()));

        // Apply styles?
        $objWriter->writeAttribute('applyFont', ($spreadsheet->getDefaultStyle()->getFont()->getHashCode() != $pStyle->getFont()->getHashCode()) ? '1' : '0');
        $objWriter->writeAttribute('applyNumberFormat', ($spreadsheet->getDefaultStyle()->getNumberFormat()->getHashCode() != $pStyle->getNumberFormat()->getHashCode()) ? '1' : '0');
        $objWriter->writeAttribute('applyFill', ($spreadsheet->getDefaultStyle()->getFill()->getHashCode() != $pStyle->getFill()->getHashCode()) ? '1' : '0');
        $objWriter->writeAttribute('applyBorder', ($spreadsheet->getDefaultStyle()->getBorders()->getHashCode() != $pStyle->getBorders()->getHashCode()) ? '1' : '0');
        $objWriter->writeAttribute('applyAlignment', ($spreadsheet->getDefaultStyle()->getAlignment()->getHashCode() != $pStyle->getAlignment()->getHashCode()) ? '1' : '0');
        if ($pStyle->getProtection()->getLocked() != Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != Protection::PROTECTION_INHERIT) {
            $objWriter->writeAttribute('applyProtection', 'true');
        }

        // alignment
        $objWriter->startElement('alignment');
        $objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
        $objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());

        $textRotation = 0;
        if ($pStyle->getAlignment()->getTextRotation() >= 0) {
            $textRotation = $pStyle->getAlignment()->getTextRotation();
        } elseif ($pStyle->getAlignment()->getTextRotation() < 0) {
            $textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
        }
        $objWriter->writeAttribute('textRotation', $textRotation);

        $objWriter->writeAttribute('wrapText', ($pStyle->getAlignment()->getWrapText() ? 'true' : 'false'));
        $objWriter->writeAttribute('shrinkToFit', ($pStyle->getAlignment()->getShrinkToFit() ? 'true' : 'false'));

        if ($pStyle->getAlignment()->getIndent() > 0) {
            $objWriter->writeAttribute('indent', $pStyle->getAlignment()->getIndent());
        }
        if ($pStyle->getAlignment()->getReadOrder() > 0) {
            $objWriter->writeAttribute('readingOrder', $pStyle->getAlignment()->getReadOrder());
        }
        $objWriter->endElement();

        // protection
        if ($pStyle->getProtection()->getLocked() != Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != Protection::PROTECTION_INHERIT) {
            $objWriter->startElement('protection');
            if ($pStyle->getProtection()->getLocked() != Protection::PROTECTION_INHERIT) {
                $objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
            }
            if ($pStyle->getProtection()->getHidden() != Protection::PROTECTION_INHERIT) {
                $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
            }
            $objWriter->endElement();
        }

        $objWriter->endElement();
    }
private function writeCellStyleXf(XMLWriter $objWriter, \PhpOffice\PhpSpreadsheet\Style\Style $pStyle, Spreadsheet $spreadsheet)
    {
        // xf
        $objWriter->startElement('xf');
        $objWriter->writeAttribute('xfId', 0);
        $objWriter->writeAttribute('fontId', (int) $this->getParentWriter()->getFontHashTable()->getIndexForHashCode($pStyle->getFont()->getHashCode()));
        if ($pStyle->getQuotePrefix()) {
            $objWriter->writeAttribute('quotePrefix', 1);
        }

        if ($pStyle->getNumberFormat()->getBuiltInFormatCode() === false) {
            $objWriter->writeAttribute('numFmtId', (int) ($this->getParentWriter()->getNumFmtHashTable()->getIndexForHashCode($pStyle->getNumberFormat()->getHashCode()) + 164));
        } else {
            $objWriter->writeAttribute('numFmtId', (int) $pStyle->getNumberFormat()->getBuiltInFormatCode());
        }

        $objWriter->writeAttribute('fillId', (int) $this->getParentWriter()->getFillHashTable()->getIndexForHashCode($pStyle->getFill()->getHashCode()));
        $objWriter->writeAttribute('borderId', (int) $this->getParentWriter()->getBordersHashTable()->getIndexForHashCode($pStyle->getBorders()->getHashCode()));

        // Apply styles?
        $objWriter->writeAttribute('applyFont', ($spreadsheet->getDefaultStyle()->getFont()->getHashCode() != $pStyle->getFont()->getHashCode()) ? '1' : '0');
        $objWriter->writeAttribute('applyNumberFormat', ($spreadsheet->getDefaultStyle()->getNumberFormat()->getHashCode() != $pStyle->getNumberFormat()->getHashCode()) ? '1' : '0');
        $objWriter->writeAttribute('applyFill', ($spreadsheet->getDefaultStyle()->getFill()->getHashCode() != $pStyle->getFill()->getHashCode()) ? '1' : '0');
        $objWriter->writeAttribute('applyBorder', ($spreadsheet->getDefaultStyle()->getBorders()->getHashCode() != $pStyle->getBorders()->getHashCode()) ? '1' : '0');
        $objWriter->writeAttribute('applyAlignment', ($spreadsheet->getDefaultStyle()->getAlignment()->getHashCode() != $pStyle->getAlignment()->getHashCode()) ? '1' : '0');
        if ($pStyle->getProtection()->getLocked() != Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != Protection::PROTECTION_INHERIT) {
            $objWriter->writeAttribute('applyProtection', 'true');
        }

        // alignment
        $objWriter->startElement('alignment');
        $objWriter->writeAttribute('horizontal', $pStyle->getAlignment()->getHorizontal());
        $objWriter->writeAttribute('vertical', $pStyle->getAlignment()->getVertical());

        $textRotation = 0;
        if ($pStyle->getAlignment()->getTextRotation() >= 0) {
            $textRotation = $pStyle->getAlignment()->getTextRotation();
        } elseif ($pStyle->getAlignment()->getTextRotation() < 0) {
            $textRotation = 90 - $pStyle->getAlignment()->getTextRotation();
        }
        $objWriter->writeAttribute('textRotation', $textRotation);

        $objWriter->writeAttribute('wrapText', ($pStyle->getAlignment()->getWrapText() ? 'true' : 'false'));
        $objWriter->writeAttribute('shrinkToFit', ($pStyle->getAlignment()->getShrinkToFit() ? 'true' : 'false'));

        if ($pStyle->getAlignment()->getIndent() > 0) {
            $objWriter->writeAttribute('indent', $pStyle->getAlignment()->getIndent());
        }
        if ($pStyle->getAlignment()->getReadOrder() > 0) {
            $objWriter->writeAttribute('readingOrder', $pStyle->getAlignment()->getReadOrder());
        }
        $objWriter->endElement();

        // protection
        if ($pStyle->getProtection()->getLocked() != Protection::PROTECTION_INHERIT || $pStyle->getProtection()->getHidden() != Protection::PROTECTION_INHERIT) {
            $objWriter->startElement('protection');
            if ($pStyle->getProtection()->getLocked() != Protection::PROTECTION_INHERIT) {
                $objWriter->writeAttribute('locked', ($pStyle->getProtection()->getLocked() == Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
            }
            if ($pStyle->getProtection()->getHidden() != Protection::PROTECTION_INHERIT) {
                $objWriter->writeAttribute('hidden', ($pStyle->getProtection()->getHidden() == Protection::PROTECTION_PROTECTED ? 'true' : 'false'));
            }
            $objWriter->endElement();
        }

        $objWriter->endElement();
    }
private function writeCellStyleXf ( XMLWriter $ objWriter , \ PhpOffice \ PhpSpreadsheet \ Style \ Style $ pStyle , Spreadsheet $ spreadsheet ) { // xf $ objWriter -> startElement ( 'xf' ) ; $ objWriter -> writeAttribute ( 'xfId' , 0 ) ; $ objWriter -> writeAttribute ( 'fontId' , ( int ) $ this -> getParentWriter ( ) -> getFontHashTable ( ) -> getIndexForHashCode ( $ pStyle -> getFont ( ) -> getHashCode ( ) ) ) ; if ( $ pStyle -> getQuotePrefix ( ) ) { $ objWriter -> writeAttribute ( 'quotePrefix' , 1 ) ; } if ( $ pStyle -> getNumberFormat ( ) -> getBuiltInFormatCode ( ) === false ) { $ objWriter -> writeAttribute ( 'numFmtId' , ( int ) ( $ this -> getParentWriter ( ) -> getNumFmtHashTable ( ) -> getIndexForHashCode ( $ pStyle -> getNumberFormat ( ) -> getHashCode ( ) ) + 164 ) ) ; } else { $ objWriter -> writeAttribute ( 'numFmtId' , ( int ) $ pStyle -> getNumberFormat ( ) -> getBuiltInFormatCode ( ) ) ; } $ objWriter -> writeAttribute ( 'fillId' , ( int ) $ this -> getParentWriter ( ) -> getFillHashTable ( ) -> getIndexForHashCode ( $ pStyle -> getFill ( ) -> getHashCode ( ) ) ) ; $ objWriter -> writeAttribute ( 'borderId' , ( int ) $ this -> getParentWriter ( ) -> getBordersHashTable ( ) -> getIndexForHashCode ( $ pStyle -> getBorders ( ) -> getHashCode ( ) ) ) ; // Apply styles? $ objWriter -> writeAttribute ( 'applyFont' , ( $ spreadsheet -> getDefaultStyle ( ) -> getFont ( ) -> getHashCode ( ) != $ pStyle -> getFont ( ) -> getHashCode ( ) ) ? '1' : '0' ) ; $ objWriter -> writeAttribute ( 'applyNumberFormat' , ( $ spreadsheet -> getDefaultStyle ( ) -> getNumberFormat ( ) -> getHashCode ( ) != $ pStyle -> getNumberFormat ( ) -> getHashCode ( ) ) ? '1' : '0' ) ; $ objWriter -> writeAttribute ( 'applyFill' , ( $ spreadsheet -> getDefaultStyle ( ) -> getFill ( ) -> getHashCode ( ) != $ pStyle -> getFill ( ) -> getHashCode ( ) ) ? '1' : '0' ) ; $ objWriter -> writeAttribute ( 'applyBorder' , ( $ spreadsheet -> getDefaultStyle ( ) -> getBorders ( ) -> getHashCode ( ) != $ pStyle -> getBorders ( ) -> getHashCode ( ) ) ? '1' : '0' ) ; $ objWriter -> writeAttribute ( 'applyAlignment' , ( $ spreadsheet -> getDefaultStyle ( ) -> getAlignment ( ) -> getHashCode ( ) != $ pStyle -> getAlignment ( ) -> getHashCode ( ) ) ? '1' : '0' ) ; if ( $ pStyle -> getProtection ( ) -> getLocked ( ) != Protection :: PROTECTION_INHERIT || $ pStyle -> getProtection ( ) -> getHidden ( ) != Protection :: PROTECTION_INHERIT ) { $ objWriter -> writeAttribute ( 'applyProtection' , 'true' ) ; } // alignment $ objWriter -> startElement ( 'alignment' ) ; $ objWriter -> writeAttribute ( 'horizontal' , $ pStyle -> getAlignment ( ) -> getHorizontal ( ) ) ; $ objWriter -> writeAttribute ( 'vertical' , $ pStyle -> getAlignment ( ) -> getVertical ( ) ) ; $ textRotation = 0 ; if ( $ pStyle -> getAlignment ( ) -> getTextRotation ( ) >= 0 ) { $ textRotation = $ pStyle -> getAlignment ( ) -> getTextRotation ( ) ; } elseif ( $ pStyle -> getAlignment ( ) -> getTextRotation ( ) < 0 ) { $ textRotation = 90 - $ pStyle -> getAlignment ( ) -> getTextRotation ( ) ; } $ objWriter -> writeAttribute ( 'textRotation' , $ textRotation ) ; $ objWriter -> writeAttribute ( 'wrapText' , ( $ pStyle -> getAlignment ( ) -> getWrapText ( ) ? 'true' : 'false' ) ) ; $ objWriter -> writeAttribute ( 'shrinkToFit' , ( $ pStyle -> getAlignment ( ) -> getShrinkToFit ( ) ? 'true' : 'false' ) ) ; if ( $ pStyle -> getAlignment ( ) -> getIndent ( ) > 0 ) { $ objWriter -> writeAttribute ( 'indent' , $ pStyle -> getAlignment ( ) -> getIndent ( ) ) ; } if ( $ pStyle -> getAlignment ( ) -> getReadOrder ( ) > 0 ) { $ objWriter -> writeAttribute ( 'readingOrder' , $ pStyle -> getAlignment ( ) -> getReadOrder ( ) ) ; } $ objWriter -> endElement ( ) ; // protection if ( $ pStyle -> getProtection ( ) -> getLocked ( ) != Protection :: PROTECTION_INHERIT || $ pStyle -> getProtection ( ) -> getHidden ( ) != Protection :: PROTECTION_INHERIT ) { $ objWriter -> startElement ( 'protection' ) ; if ( $ pStyle -> getProtection ( ) -> getLocked ( ) != Protection :: PROTECTION_INHERIT ) { $ objWriter -> writeAttribute ( 'locked' , ( $ pStyle -> getProtection ( ) -> getLocked ( ) == Protection :: PROTECTION_PROTECTED ? 'true' : 'false' ) ) ; } if ( $ pStyle -> getProtection ( ) -> getHidden ( ) != Protection :: PROTECTION_INHERIT ) { $ objWriter -> writeAttribute ( 'hidden' , ( $ pStyle -> getProtection ( ) -> getHidden ( ) == Protection :: PROTECTION_PROTECTED ? 'true' : 'false' ) ) ; } $ objWriter -> endElement ( ) ; } $ objWriter -> endElement ( ) ; }
Write Cell Style Xf.

@param XMLWriter $objWriter XML Writer
@param \PhpOffice\PhpSpreadsheet\Style\Style $pStyle Style
@param Spreadsheet $spreadsheet Workbook

@throws \PhpOffice\PhpSpreadsheet\Writer\Exception
Write Cell Style Xf .