56 $objWriter->startDocument(
'1.0',
'UTF-8',
'yes');
59 $objWriter->startElement(
'xdr:wsDr');
60 $objWriter->writeAttribute(
'xmlns:xdr',
'http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing');
61 $objWriter->writeAttribute(
'xmlns:a',
'http://schemas.openxmlformats.org/drawingml/2006/main');
65 $iterator = $pWorksheet->getDrawingCollection()->getIterator();
66 while ($iterator->valid()) {
73 $objWriter->endElement();
76 return $objWriter->getData();
89 if ($pRelationId >= 0) {
91 $objWriter->startElement(
'xdr:oneCellAnchor');
97 $objWriter->startElement(
'xdr:from');
98 $objWriter->writeElement(
'xdr:col', $aCoordinates[0] - 1);
100 $objWriter->writeElement(
'xdr:row', $aCoordinates[1] - 1);
102 $objWriter->endElement();
105 $objWriter->startElement(
'xdr:ext');
108 $objWriter->endElement();
111 $objWriter->startElement(
'xdr:pic');
114 $objWriter->startElement(
'xdr:nvPicPr');
117 $objWriter->startElement(
'xdr:cNvPr');
118 $objWriter->writeAttribute(
'id', $pRelationId);
119 $objWriter->writeAttribute(
'name', $pDrawing->getName());
120 $objWriter->writeAttribute(
'descr', $pDrawing->getDescription());
121 $objWriter->endElement();
124 $objWriter->startElement(
'xdr:cNvPicPr');
127 $objWriter->startElement(
'a:picLocks');
128 $objWriter->writeAttribute(
'noChangeAspect',
'1');
129 $objWriter->endElement();
131 $objWriter->endElement();
133 $objWriter->endElement();
136 $objWriter->startElement(
'xdr:blipFill');
139 $objWriter->startElement(
'a:blip');
140 $objWriter->writeAttribute(
'xmlns:r',
'http://schemas.openxmlformats.org/officeDocument/2006/relationships');
141 $objWriter->writeAttribute(
'r:embed',
'rId' . $pRelationId);
142 $objWriter->endElement();
145 $objWriter->startElement(
'a:stretch');
146 $objWriter->writeElement(
'a:fillRect', null);
147 $objWriter->endElement();
149 $objWriter->endElement();
152 $objWriter->startElement(
'xdr:spPr');
155 $objWriter->startElement(
'a:xfrm');
157 $objWriter->endElement();
160 $objWriter->startElement(
'a:prstGeom');
161 $objWriter->writeAttribute(
'prst',
'rect');
164 $objWriter->writeElement(
'a:avLst', null);
166 $objWriter->endElement();
209 if ($pDrawing->getShadow()->getVisible()) {
211 $objWriter->startElement(
'a:effectLst');
214 $objWriter->startElement(
'a:outerShdw');
218 $objWriter->writeAttribute(
'algn', $pDrawing->getShadow()->getAlignment());
219 $objWriter->writeAttribute(
'rotWithShape',
'0');
222 $objWriter->startElement(
'a:srgbClr');
223 $objWriter->writeAttribute(
'val', $pDrawing->getShadow()->getColor()->getRGB());
226 $objWriter->startElement(
'a:alpha');
227 $objWriter->writeAttribute(
'val', $pDrawing->getShadow()->getAlpha() * 1000);
228 $objWriter->endElement();
230 $objWriter->endElement();
232 $objWriter->endElement();
234 $objWriter->endElement();
284 $objWriter->endElement();
286 $objWriter->endElement();
289 $objWriter->writeElement(
'xdr:clientData', null);
291 $objWriter->endElement();
293 throw new Exception(
"Invalid parameters passed.");
315 $objWriter->startDocument(
'1.0',
'UTF-8',
'yes');
318 $images = $pWorksheet->getHeaderFooter()->getImages();
321 $objWriter->startElement(
'xml');
322 $objWriter->writeAttribute(
'xmlns:v',
'urn:schemas-microsoft-com:vml');
323 $objWriter->writeAttribute(
'xmlns:o',
'urn:schemas-microsoft-com:office:office');
324 $objWriter->writeAttribute(
'xmlns:x',
'urn:schemas-microsoft-com:office:excel');
327 $objWriter->startElement(
'o:shapelayout');
328 $objWriter->writeAttribute(
'v:ext',
'edit');
331 $objWriter->startElement(
'o:idmap');
332 $objWriter->writeAttribute(
'v:ext',
'edit');
333 $objWriter->writeAttribute(
'data',
'1');
334 $objWriter->endElement();
336 $objWriter->endElement();
339 $objWriter->startElement(
'v:shapetype');
340 $objWriter->writeAttribute(
'id',
'_x0000_t75');
341 $objWriter->writeAttribute(
'coordsize',
'21600,21600');
342 $objWriter->writeAttribute(
'o:spt',
'75');
343 $objWriter->writeAttribute(
'o:preferrelative',
't');
344 $objWriter->writeAttribute(
'path',
'm@4@5l@4@11@9@11@9@5xe');
345 $objWriter->writeAttribute(
'filled',
'f');
346 $objWriter->writeAttribute(
'stroked',
'f');
349 $objWriter->startElement(
'v:stroke');
350 $objWriter->writeAttribute(
'joinstyle',
'miter');
351 $objWriter->endElement();
354 $objWriter->startElement(
'v:formulas');
357 $objWriter->startElement(
'v:f');
358 $objWriter->writeAttribute(
'eqn',
'if lineDrawn pixelLineWidth 0');
359 $objWriter->endElement();
362 $objWriter->startElement(
'v:f');
363 $objWriter->writeAttribute(
'eqn',
'sum @0 1 0');
364 $objWriter->endElement();
367 $objWriter->startElement(
'v:f');
368 $objWriter->writeAttribute(
'eqn',
'sum 0 0 @1');
369 $objWriter->endElement();
372 $objWriter->startElement(
'v:f');
373 $objWriter->writeAttribute(
'eqn',
'prod @2 1 2');
374 $objWriter->endElement();
377 $objWriter->startElement(
'v:f');
378 $objWriter->writeAttribute(
'eqn',
'prod @3 21600 pixelWidth');
379 $objWriter->endElement();
382 $objWriter->startElement(
'v:f');
383 $objWriter->writeAttribute(
'eqn',
'prod @3 21600 pixelHeight');
384 $objWriter->endElement();
387 $objWriter->startElement(
'v:f');
388 $objWriter->writeAttribute(
'eqn',
'sum @0 0 1');
389 $objWriter->endElement();
392 $objWriter->startElement(
'v:f');
393 $objWriter->writeAttribute(
'eqn',
'prod @6 1 2');
394 $objWriter->endElement();
397 $objWriter->startElement(
'v:f');
398 $objWriter->writeAttribute(
'eqn',
'prod @7 21600 pixelWidth');
399 $objWriter->endElement();
402 $objWriter->startElement(
'v:f');
403 $objWriter->writeAttribute(
'eqn',
'sum @8 21600 0');
404 $objWriter->endElement();
407 $objWriter->startElement(
'v:f');
408 $objWriter->writeAttribute(
'eqn',
'prod @7 21600 pixelHeight');
409 $objWriter->endElement();
412 $objWriter->startElement(
'v:f');
413 $objWriter->writeAttribute(
'eqn',
'sum @10 21600 0');
414 $objWriter->endElement();
416 $objWriter->endElement();
419 $objWriter->startElement(
'v:path');
420 $objWriter->writeAttribute(
'o:extrusionok',
'f');
421 $objWriter->writeAttribute(
'gradientshapeok',
't');
422 $objWriter->writeAttribute(
'o:connecttype',
'rect');
423 $objWriter->endElement();
426 $objWriter->startElement(
'o:lock');
427 $objWriter->writeAttribute(
'v:ext',
'edit');
428 $objWriter->writeAttribute(
'aspectratio',
't');
429 $objWriter->endElement();
431 $objWriter->endElement();
434 foreach ($images as $key => $value) {
438 $objWriter->endElement();
441 return $objWriter->getData();
455 preg_match(
'{(\d+)}', md5($pReference), $m);
456 $id = 1500 + (substr($m[1], 0, 2) * 1);
459 $width = $pImage->getWidth();
460 $height = $pImage->getHeight();
461 $marginLeft = $pImage->getOffsetX();
462 $marginTop = $pImage->getOffsetY();
465 $objWriter->startElement(
'v:shape');
466 $objWriter->writeAttribute(
'id', $pReference);
467 $objWriter->writeAttribute(
'o:spid',
'_x0000_s' . $id);
468 $objWriter->writeAttribute(
'type',
'#_x0000_t75');
469 $objWriter->writeAttribute(
'style',
"position:absolute;margin-left:{$marginLeft}px;margin-top:{$marginTop}px;width:{$width}px;height:{$height}px;z-index:1");
472 $objWriter->startElement(
'v:imagedata');
473 $objWriter->writeAttribute(
'o:relid',
'rId' . $pReference);
474 $objWriter->writeAttribute(
'o:title', $pImage->getName());
475 $objWriter->endElement();
478 $objWriter->startElement(
'o:lock');
479 $objWriter->writeAttribute(
'v:ext',
'edit');
480 $objWriter->writeAttribute(
'rotation',
't');
481 $objWriter->endElement();
483 $objWriter->endElement();
497 $aDrawings = array();
500 $sheetCount = $pPHPExcel->getSheetCount();
501 for ($i = 0; $i < $sheetCount; ++$i) {
503 $iterator = $pPHPExcel->getSheet($i)->getDrawingCollection()->getIterator();
504 while ($iterator->valid()) {
505 $aDrawings[] = $iterator->current();