code: private function writeDefinedNameForNamedRange(XMLWriter $objWriter, NamedRange $pNamedRange)
      {
          // definedName for named range
          $objWriter->startElement('definedName');
          $objWriter->writeAttribute('name', $pNamedRange->getName());
          if ($pNamedRange->getLocalOnly()) {
              $objWriter->writeAttribute('localSheetId', $pNamedRange->getScope()->getParent()->getIndex($pNamedRange->getScope()));
          }
  
          // Create absolute coordinate and write as raw text
          $range = Coordinate::splitRange($pNamedRange->getRange());
          $iMax = count($range);
          for ($i = 0; $i < $iMax; ++$i) {
              $range[$i][0] = '\'' . str_replace("'", "''", $pNamedRange->getWorksheet()->getTitle()) . '\'!' . Coordinate::absoluteReference($range[$i][0]);
              if (isset($range[$i][1])) {
                  $range[$i][1] = Coordinate::absoluteReference($range[$i][1]);
              }
          }
          $range = Coordinate::buildRange($range);
  
          $objWriter->writeRawData($range);
  
          $objWriter->endElement();
      }
docs: Write Defined Name for named range.
  
  @param XMLWriter $objWriter XML Writer
  @param NamedRange $pNamedRange