Vendor/phpspreadsheet/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Writer/Xlsx/DocProps.php
public function writeDocPropsApp(Spreadsheet $spreadsheet)
    {
        // Create XML writer
        $objWriter = null;
        if ($this->getParentWriter()->getUseDiskCaching()) {
            $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
        } else {
            $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
        }

        // XML header
        $objWriter->startDocument('1.0', 'UTF-8', 'yes');

        // Properties
        $objWriter->startElement('Properties');
        $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties');
        $objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');

        // Application
        $objWriter->writeElement('Application', 'Microsoft Excel');

        // DocSecurity
        $objWriter->writeElement('DocSecurity', '0');

        // ScaleCrop
        $objWriter->writeElement('ScaleCrop', 'false');

        // HeadingPairs
        $objWriter->startElement('HeadingPairs');

        // Vector
        $objWriter->startElement('vt:vector');
        $objWriter->writeAttribute('size', '2');
        $objWriter->writeAttribute('baseType', 'variant');

        // Variant
        $objWriter->startElement('vt:variant');
        $objWriter->writeElement('vt:lpstr', 'Worksheets');
        $objWriter->endElement();

        // Variant
        $objWriter->startElement('vt:variant');
        $objWriter->writeElement('vt:i4', $spreadsheet->getSheetCount());
        $objWriter->endElement();

        $objWriter->endElement();

        $objWriter->endElement();

        // TitlesOfParts
        $objWriter->startElement('TitlesOfParts');

        // Vector
        $objWriter->startElement('vt:vector');
        $objWriter->writeAttribute('size', $spreadsheet->getSheetCount());
        $objWriter->writeAttribute('baseType', 'lpstr');

        $sheetCount = $spreadsheet->getSheetCount();
        for ($i = 0; $i < $sheetCount; ++$i) {
            $objWriter->writeElement('vt:lpstr', $spreadsheet->getSheet($i)->getTitle());
        }

        $objWriter->endElement();

        $objWriter->endElement();

        // Company
        $objWriter->writeElement('Company', $spreadsheet->getProperties()->getCompany());

        // Company
        $objWriter->writeElement('Manager', $spreadsheet->getProperties()->getManager());

        // LinksUpToDate
        $objWriter->writeElement('LinksUpToDate', 'false');

        // SharedDoc
        $objWriter->writeElement('SharedDoc', 'false');

        // HyperlinksChanged
        $objWriter->writeElement('HyperlinksChanged', 'false');

        // AppVersion
        $objWriter->writeElement('AppVersion', '12.0000');

        $objWriter->endElement();

        // Return
        return $objWriter->getData();
    }
public function writeDocPropsApp(Spreadsheet $spreadsheet)
    {
        // Create XML writer
        $objWriter = null;
        if ($this->getParentWriter()->getUseDiskCaching()) {
            $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
        } else {
            $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
        }

        // XML header
        $objWriter->startDocument('1.0', 'UTF-8', 'yes');

        // Properties
        $objWriter->startElement('Properties');
        $objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties');
        $objWriter->writeAttribute('xmlns:vt', 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes');

        // Application
        $objWriter->writeElement('Application', 'Microsoft Excel');

        // DocSecurity
        $objWriter->writeElement('DocSecurity', '0');

        // ScaleCrop
        $objWriter->writeElement('ScaleCrop', 'false');

        // HeadingPairs
        $objWriter->startElement('HeadingPairs');

        // Vector
        $objWriter->startElement('vt:vector');
        $objWriter->writeAttribute('size', '2');
        $objWriter->writeAttribute('baseType', 'variant');

        // Variant
        $objWriter->startElement('vt:variant');
        $objWriter->writeElement('vt:lpstr', 'Worksheets');
        $objWriter->endElement();

        // Variant
        $objWriter->startElement('vt:variant');
        $objWriter->writeElement('vt:i4', $spreadsheet->getSheetCount());
        $objWriter->endElement();

        $objWriter->endElement();

        $objWriter->endElement();

        // TitlesOfParts
        $objWriter->startElement('TitlesOfParts');

        // Vector
        $objWriter->startElement('vt:vector');
        $objWriter->writeAttribute('size', $spreadsheet->getSheetCount());
        $objWriter->writeAttribute('baseType', 'lpstr');

        $sheetCount = $spreadsheet->getSheetCount();
        for ($i = 0; $i < $sheetCount; ++$i) {
            $objWriter->writeElement('vt:lpstr', $spreadsheet->getSheet($i)->getTitle());
        }

        $objWriter->endElement();

        $objWriter->endElement();

        // Company
        $objWriter->writeElement('Company', $spreadsheet->getProperties()->getCompany());

        // Company
        $objWriter->writeElement('Manager', $spreadsheet->getProperties()->getManager());

        // LinksUpToDate
        $objWriter->writeElement('LinksUpToDate', 'false');

        // SharedDoc
        $objWriter->writeElement('SharedDoc', 'false');

        // HyperlinksChanged
        $objWriter->writeElement('HyperlinksChanged', 'false');

        // AppVersion
        $objWriter->writeElement('AppVersion', '12.0000');

        $objWriter->endElement();

        // Return
        return $objWriter->getData();
    }
public function writeDocPropsApp ( Spreadsheet $ spreadsheet ) { // Create XML writer $ objWriter = null ; if ( $ this -> getParentWriter ( ) -> getUseDiskCaching ( ) ) { $ objWriter = new XMLWriter ( XMLWriter :: STORAGE_DISK , $ this -> getParentWriter ( ) -> getDiskCachingDirectory ( ) ) ; } else { $ objWriter = new XMLWriter ( XMLWriter :: STORAGE_MEMORY ) ; } // XML header $ objWriter -> startDocument ( '1.0' , 'UTF-8' , 'yes' ) ; // Properties $ objWriter -> startElement ( 'Properties' ) ; $ objWriter -> writeAttribute ( 'xmlns' , 'http://schemas.openxmlformats.org/officeDocument/2006/extended-properties' ) ; $ objWriter -> writeAttribute ( 'xmlns:vt' , 'http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes' ) ; // Application $ objWriter -> writeElement ( 'Application' , 'Microsoft Excel' ) ; // DocSecurity $ objWriter -> writeElement ( 'DocSecurity' , '0' ) ; // ScaleCrop $ objWriter -> writeElement ( 'ScaleCrop' , 'false' ) ; // HeadingPairs $ objWriter -> startElement ( 'HeadingPairs' ) ; // Vector $ objWriter -> startElement ( 'vt:vector' ) ; $ objWriter -> writeAttribute ( 'size' , '2' ) ; $ objWriter -> writeAttribute ( 'baseType' , 'variant' ) ; // Variant $ objWriter -> startElement ( 'vt:variant' ) ; $ objWriter -> writeElement ( 'vt:lpstr' , 'Worksheets' ) ; $ objWriter -> endElement ( ) ; // Variant $ objWriter -> startElement ( 'vt:variant' ) ; $ objWriter -> writeElement ( 'vt:i4' , $ spreadsheet -> getSheetCount ( ) ) ; $ objWriter -> endElement ( ) ; $ objWriter -> endElement ( ) ; $ objWriter -> endElement ( ) ; // TitlesOfParts $ objWriter -> startElement ( 'TitlesOfParts' ) ; // Vector $ objWriter -> startElement ( 'vt:vector' ) ; $ objWriter -> writeAttribute ( 'size' , $ spreadsheet -> getSheetCount ( ) ) ; $ objWriter -> writeAttribute ( 'baseType' , 'lpstr' ) ; $ sheetCount = $ spreadsheet -> getSheetCount ( ) ; for ( $ i = 0 ; $ i < $ sheetCount ; ++ $ i ) { $ objWriter -> writeElement ( 'vt:lpstr' , $ spreadsheet -> getSheet ( $ i ) -> getTitle ( ) ) ; } $ objWriter -> endElement ( ) ; $ objWriter -> endElement ( ) ; // Company $ objWriter -> writeElement ( 'Company' , $ spreadsheet -> getProperties ( ) -> getCompany ( ) ) ; // Company $ objWriter -> writeElement ( 'Manager' , $ spreadsheet -> getProperties ( ) -> getManager ( ) ) ; // LinksUpToDate $ objWriter -> writeElement ( 'LinksUpToDate' , 'false' ) ; // SharedDoc $ objWriter -> writeElement ( 'SharedDoc' , 'false' ) ; // HyperlinksChanged $ objWriter -> writeElement ( 'HyperlinksChanged' , 'false' ) ; // AppVersion $ objWriter -> writeElement ( 'AppVersion' , '12.0000' ) ; $ objWriter -> endElement ( ) ; // Return return $ objWriter -> getData ( ) ; }
Write docProps/app.xml to XML format.

@param Spreadsheet $spreadsheet

@throws \PhpOffice\PhpSpreadsheet\Writer\Exception

@return string XML Output
Write docProps / app . xml to XML format .