Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402] [Versions 401 and 402]
1 <?php 2 3 namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; 4 5 use PhpOffice\PhpSpreadsheet\Reader\Xlsx\Namespaces; 6 use PhpOffice\PhpSpreadsheet\Shared\XMLWriter; 7 use PhpOffice\PhpSpreadsheet\Spreadsheet; 8 9 class RelsRibbon extends WriterPart 10 { 11 /** 12 * Write relationships for additional objects of custom UI (ribbon). 13 * 14 * @return string XML Output 15 */ 16 public function writeRibbonRelationships(Spreadsheet $spreadsheet) 17 { 18 // Create XML writer 19 $objWriter = null; 20 if ($this->getParentWriter()->getUseDiskCaching()) { 21 $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); 22 } else { 23 $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); 24 } 25 26 // XML header 27 $objWriter->startDocument('1.0', 'UTF-8', 'yes'); 28 29 // Relationships 30 $objWriter->startElement('Relationships'); 31 $objWriter->writeAttribute('xmlns', Namespaces::RELATIONSHIPS); 32 $localRels = $spreadsheet->getRibbonBinObjects('names'); 33 if (is_array($localRels)) { 34 foreach ($localRels as $aId => $aTarget) { 35 $objWriter->startElement('Relationship'); 36 $objWriter->writeAttribute('Id', $aId); 37 $objWriter->writeAttribute('Type', Namespaces::IMAGE); 38 $objWriter->writeAttribute('Target', $aTarget); 39 $objWriter->endElement(); 40 } 41 } 42 $objWriter->endElement(); 43 44 return $objWriter->getData(); 45 } 46 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body