67 lines
1.7 KiB
PHP
Raw Normal View History

2012-05-06 18:25:40 +02:00
<?php
/**
* PHPWord
2012-05-06 18:25:40 +02:00
*
2014-03-27 23:55:06 +07:00
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2014 PHPWord
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
2012-05-06 18:25:40 +02:00
*/
namespace PhpOffice\PhpWord\Writer\Word2007;
use PhpOffice\PhpWord\PhpWord;
/**
* Word2007 rels part writer
*/
2014-03-30 18:51:25 +07:00
class Rels extends Base
{
/**
* Write _rels/.rels
*
2014-03-30 18:51:25 +07:00
* @param PhpWord $phpWord
*/
public function writeRelationships(PhpWord $phpWord = null)
{
// Create XML writer
$xmlWriter = $this->getXmlWriter();
2012-05-06 18:25:40 +02:00
// XML header
$xmlWriter->startDocument('1.0', 'UTF-8', 'yes');
2012-05-06 18:25:40 +02:00
// Relationships
$xmlWriter->startElement('Relationships');
$xmlWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
2012-05-06 18:25:40 +02:00
$relationId = 1;
2012-05-06 18:25:40 +02:00
// Relationship word/document.xml
$this->writeRel(
$xmlWriter,
$relationId,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument',
'word/document.xml'
);
2012-05-06 18:25:40 +02:00
// Relationship docProps/core.xml
$this->writeRel(
$xmlWriter,
++$relationId,
'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties',
'docProps/core.xml'
);
2012-05-06 18:25:40 +02:00
// Relationship docProps/app.xml
$this->writeRel(
$xmlWriter,
++$relationId,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties',
'docProps/app.xml'
);
$xmlWriter->endElement();
return $xmlWriter->getData();
}
2012-05-06 18:25:40 +02:00
}