You are here

public function PHPExcel_Writer_Excel2007_Drawing::_writeVMLHeaderFooterImage in Loft Data Grids 6.2

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

* Write VML comment to XML format * *

Parameters

PHPExcel_Shared_XMLWriter $objWriter XML Writer: * @param string $pReference Reference * @param PHPExcel_Worksheet_HeaderFooterDrawing $pImage Image * @throws PHPExcel_Writer_Exception

1 call to PHPExcel_Writer_Excel2007_Drawing::_writeVMLHeaderFooterImage()
PHPExcel_Writer_Excel2007_Drawing::writeVMLHeaderFooterImages in vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel2007/Drawing.php
* Write VML header/footer images to XML format * *

File

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

Class

PHPExcel_Writer_Excel2007_Drawing
PHPExcel_Writer_Excel2007_Drawing

Code

public function _writeVMLHeaderFooterImage(PHPExcel_Shared_XMLWriter $objWriter = null, $pReference = '', PHPExcel_Worksheet_HeaderFooterDrawing $pImage = null) {

  // Calculate object id
  preg_match('{(\\d+)}', md5($pReference), $m);
  $id = 1500 + substr($m[1], 0, 2) * 1;

  // Calculate offset
  $width = $pImage
    ->getWidth();
  $height = $pImage
    ->getHeight();
  $marginLeft = $pImage
    ->getOffsetX();
  $marginTop = $pImage
    ->getOffsetY();

  // v:shape
  $objWriter
    ->startElement('v:shape');
  $objWriter
    ->writeAttribute('id', $pReference);
  $objWriter
    ->writeAttribute('o:spid', '_x0000_s' . $id);
  $objWriter
    ->writeAttribute('type', '#_x0000_t75');
  $objWriter
    ->writeAttribute('style', "position:absolute;margin-left:{$marginLeft}px;margin-top:{$marginTop}px;width:{$width}px;height:{$height}px;z-index:1");

  // v:imagedata
  $objWriter
    ->startElement('v:imagedata');
  $objWriter
    ->writeAttribute('o:relid', 'rId' . $pReference);
  $objWriter
    ->writeAttribute('o:title', $pImage
    ->getName());
  $objWriter
    ->endElement();

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