You are here

public function PHPExcel_Writer_Excel2007_Rels::writeHeaderFooterDrawingRelationships in Loft Data Grids 6.2

Same name and namespace in other branches
  1. 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel2007/Rels.php \PHPExcel_Writer_Excel2007_Rels::writeHeaderFooterDrawingRelationships()

* Write header/footer drawing relationships to XML format * *

Parameters

PHPExcel_Worksheet $pWorksheet: * @return string XML Output * @throws PHPExcel_Writer_Exception

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel2007/Rels.php, line 375

Class

PHPExcel_Writer_Excel2007_Rels
PHPExcel_Writer_Excel2007_Rels

Code

public function writeHeaderFooterDrawingRelationships(PHPExcel_Worksheet $pWorksheet = null) {

  // Create XML writer
  $objWriter = null;
  if ($this
    ->getParentWriter()
    ->getUseDiskCaching()) {
    $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this
      ->getParentWriter()
      ->getDiskCachingDirectory());
  }
  else {
    $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
  }

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

  // Relationships
  $objWriter
    ->startElement('Relationships');
  $objWriter
    ->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');

  // Loop through images and write relationships
  foreach ($pWorksheet
    ->getHeaderFooter()
    ->getImages() as $key => $value) {

    // Write relationship for image drawing
    $this
      ->_writeRelationship($objWriter, $key, 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image', '../media/' . $value
      ->getIndexedFilename());
  }
  $objWriter
    ->endElement();

  // Return
  return $objWriter
    ->getData();
}