30 if (!defined(
'PHPEXCEL_ROOT')) {
34 define(
'PHPEXCEL_ROOT', dirname(__FILE__) .
'/../../../');
38 require_once PHPEXCEL_ROOT .
'PHPExcel.php';
41 require_once PHPEXCEL_ROOT .
'PHPExcel/Worksheet.php';
44 require_once PHPEXCEL_ROOT .
'PHPExcel/Writer/Excel2007.php';
47 require_once PHPEXCEL_ROOT .
'PHPExcel/Writer/Excel2007/WriterPart.php';
50 require_once PHPEXCEL_ROOT .
'PHPExcel/Shared/XMLWriter.php';
80 $objWriter->startDocument(
'1.0',
'UTF-8',
'yes');
83 $objWriter->startElement(
'Relationships');
84 $objWriter->writeAttribute(
'xmlns',
'http://schemas.openxmlformats.org/package/2006/relationships');
90 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties',
98 'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties',
106 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument',
110 $objWriter->endElement();
113 return $objWriter->getData();
134 $objWriter->startDocument(
'1.0',
'UTF-8',
'yes');
137 $objWriter->startElement(
'Relationships');
138 $objWriter->writeAttribute(
'xmlns',
'http://schemas.openxmlformats.org/package/2006/relationships');
144 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles',
152 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme',
160 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings',
165 $sheetCount = $pPHPExcel->getSheetCount();
166 for ($i = 0; $i < $sheetCount; ++$i) {
170 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet',
171 'worksheets/sheet' . ($i + 1) .
'.xml'
175 $objWriter->endElement();
178 return $objWriter->getData();
204 $objWriter->startDocument(
'1.0',
'UTF-8',
'yes');
207 $objWriter->startElement(
'Relationships');
208 $objWriter->writeAttribute(
'xmlns',
'http://schemas.openxmlformats.org/package/2006/relationships');
211 if ($pWorksheet->getDrawingCollection()->count() > 0) {
215 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing',
216 '../drawings/drawing' . $pWorksheetId .
'.xml'
222 foreach ($pWorksheet->getCellCollection() as $cell) {
223 if ($cell->hasHyperlink() && !$cell->getHyperlink()->isInternal()) {
227 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink',
228 $cell->getHyperlink()->getUrl(),
238 if (count($pWorksheet->getComments()) > 0) {
241 '_comments_vml' . $i,
242 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
243 '../drawings/vmlDrawing' . $pWorksheetId .
'.vml'
249 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments',
250 '../comments' . $pWorksheetId .
'.xml'
256 if (count($pWorksheet->getHeaderFooter()->getImages()) > 0) {
259 '_headerfooter_vml' . $i,
260 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
261 '../drawings/vmlDrawingHF' . $pWorksheetId .
'.vml'
265 $objWriter->endElement();
268 return $objWriter->getData();
289 $objWriter->startDocument(
'1.0',
'UTF-8',
'yes');
292 $objWriter->startElement(
'Relationships');
293 $objWriter->writeAttribute(
'xmlns',
'http://schemas.openxmlformats.org/package/2006/relationships');
297 $iterator = $pWorksheet->getDrawingCollection()->getIterator();
298 while ($iterator->valid()) {
305 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
306 '../media/' . str_replace(
' ',
'', $iterator->current()->getIndexedFilename())
314 $objWriter->endElement();
317 return $objWriter->getData();
338 $objWriter->startDocument(
'1.0',
'UTF-8',
'yes');
341 $objWriter->startElement(
'Relationships');
342 $objWriter->writeAttribute(
'xmlns',
'http://schemas.openxmlformats.org/package/2006/relationships');
345 foreach ($pWorksheet->getHeaderFooter()->getImages() as
$key => $value) {
350 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
351 '../media/' . $value->getIndexedFilename()
355 $objWriter->endElement();
358 return $objWriter->getData();
373 if ($pType !=
'' && $pTarget !=
'') {
375 $objWriter->startElement(
'Relationship');
376 $objWriter->writeAttribute(
'Id',
'rId' . $pId);
377 $objWriter->writeAttribute(
'Type', $pType);
378 $objWriter->writeAttribute(
'Target', $pTarget);
380 if ($pTargetMode !=
'') {
381 $objWriter->writeAttribute(
'TargetMode', $pTargetMode);
384 $objWriter->endElement();
386 throw new Exception(
"Invalid parameters passed.");