code: private function writeDefinedNames(XMLWriter $objWriter, Spreadsheet $spreadsheet)
      {
          // Write defined names
          $objWriter->startElement('definedNames');
  
          // Named ranges
          if (count($spreadsheet->getNamedRanges()) > 0) {
              // Named ranges
              $this->writeNamedRanges($objWriter, $spreadsheet);
          }
  
          // Other defined names
          $sheetCount = $spreadsheet->getSheetCount();
          for ($i = 0; $i < $sheetCount; ++$i) {
              // definedName for autoFilter
              $this->writeDefinedNameForAutofilter($objWriter, $spreadsheet->getSheet($i), $i);
  
              // definedName for Print_Titles
              $this->writeDefinedNameForPrintTitles($objWriter, $spreadsheet->getSheet($i), $i);
  
              // definedName for Print_Area
              $this->writeDefinedNameForPrintArea($objWriter, $spreadsheet->getSheet($i), $i);
          }
  
          $objWriter->endElement();
      }
docs: Write Defined Names.
  
  @param XMLWriter $objWriter XML Writer
  @param Spreadsheet $spreadsheet
  
  @throws WriterException