You are here

public function PHPExcel_Writer_Excel2007_Drawing::writeVMLHeaderFooterImages in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel2007/Drawing.php \PHPExcel_Writer_Excel2007_Drawing::writeVMLHeaderFooterImages()

* Write VML header/footer images to XML format * *

Parameters

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

File

vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel2007/Drawing.php, line 389

Class

PHPExcel_Writer_Excel2007_Drawing
PHPExcel_Writer_Excel2007_Drawing

Code

public function writeVMLHeaderFooterImages(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');

  // Header/footer images
  $images = $pWorksheet
    ->getHeaderFooter()
    ->getImages();

  // xml
  $objWriter
    ->startElement('xml');
  $objWriter
    ->writeAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml');
  $objWriter
    ->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office');
  $objWriter
    ->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel');

  // o:shapelayout
  $objWriter
    ->startElement('o:shapelayout');
  $objWriter
    ->writeAttribute('v:ext', 'edit');

  // o:idmap
  $objWriter
    ->startElement('o:idmap');
  $objWriter
    ->writeAttribute('v:ext', 'edit');
  $objWriter
    ->writeAttribute('data', '1');
  $objWriter
    ->endElement();
  $objWriter
    ->endElement();

  // v:shapetype
  $objWriter
    ->startElement('v:shapetype');
  $objWriter
    ->writeAttribute('id', '_x0000_t75');
  $objWriter
    ->writeAttribute('coordsize', '21600,21600');
  $objWriter
    ->writeAttribute('o:spt', '75');
  $objWriter
    ->writeAttribute('o:preferrelative', 't');
  $objWriter
    ->writeAttribute('path', 'm@4@5l@4@11@9@11@9@5xe');
  $objWriter
    ->writeAttribute('filled', 'f');
  $objWriter
    ->writeAttribute('stroked', 'f');

  // v:stroke
  $objWriter
    ->startElement('v:stroke');
  $objWriter
    ->writeAttribute('joinstyle', 'miter');
  $objWriter
    ->endElement();

  // v:formulas
  $objWriter
    ->startElement('v:formulas');

  // v:f
  $objWriter
    ->startElement('v:f');
  $objWriter
    ->writeAttribute('eqn', 'if lineDrawn pixelLineWidth 0');
  $objWriter
    ->endElement();

  // v:f
  $objWriter
    ->startElement('v:f');
  $objWriter
    ->writeAttribute('eqn', 'sum @0 1 0');
  $objWriter
    ->endElement();

  // v:f
  $objWriter
    ->startElement('v:f');
  $objWriter
    ->writeAttribute('eqn', 'sum 0 0 @1');
  $objWriter
    ->endElement();

  // v:f
  $objWriter
    ->startElement('v:f');
  $objWriter
    ->writeAttribute('eqn', 'prod @2 1 2');
  $objWriter
    ->endElement();

  // v:f
  $objWriter
    ->startElement('v:f');
  $objWriter
    ->writeAttribute('eqn', 'prod @3 21600 pixelWidth');
  $objWriter
    ->endElement();

  // v:f
  $objWriter
    ->startElement('v:f');
  $objWriter
    ->writeAttribute('eqn', 'prod @3 21600 pixelHeight');
  $objWriter
    ->endElement();

  // v:f
  $objWriter
    ->startElement('v:f');
  $objWriter
    ->writeAttribute('eqn', 'sum @0 0 1');
  $objWriter
    ->endElement();

  // v:f
  $objWriter
    ->startElement('v:f');
  $objWriter
    ->writeAttribute('eqn', 'prod @6 1 2');
  $objWriter
    ->endElement();

  // v:f
  $objWriter
    ->startElement('v:f');
  $objWriter
    ->writeAttribute('eqn', 'prod @7 21600 pixelWidth');
  $objWriter
    ->endElement();

  // v:f
  $objWriter
    ->startElement('v:f');
  $objWriter
    ->writeAttribute('eqn', 'sum @8 21600 0');
  $objWriter
    ->endElement();

  // v:f
  $objWriter
    ->startElement('v:f');
  $objWriter
    ->writeAttribute('eqn', 'prod @7 21600 pixelHeight');
  $objWriter
    ->endElement();

  // v:f
  $objWriter
    ->startElement('v:f');
  $objWriter
    ->writeAttribute('eqn', 'sum @10 21600 0');
  $objWriter
    ->endElement();
  $objWriter
    ->endElement();

  // v:path
  $objWriter
    ->startElement('v:path');
  $objWriter
    ->writeAttribute('o:extrusionok', 'f');
  $objWriter
    ->writeAttribute('gradientshapeok', 't');
  $objWriter
    ->writeAttribute('o:connecttype', 'rect');
  $objWriter
    ->endElement();

  // o:lock
  $objWriter
    ->startElement('o:lock');
  $objWriter
    ->writeAttribute('v:ext', 'edit');
  $objWriter
    ->writeAttribute('aspectratio', 't');
  $objWriter
    ->endElement();
  $objWriter
    ->endElement();

  // Loop through images
  foreach ($images as $key => $value) {
    $this
      ->_writeVMLHeaderFooterImage($objWriter, $key, $value);
  }
  $objWriter
    ->endElement();

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