ILIAS  Release_4_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
PHPExcel_Writer_Excel2007_Rels Class Reference
+ Inheritance diagram for PHPExcel_Writer_Excel2007_Rels:
+ Collaboration diagram for PHPExcel_Writer_Excel2007_Rels:

Public Member Functions

 writeRelationships (PHPExcel $pPHPExcel=null)
 Write relationships to XML format.
 writeWorkbookRelationships (PHPExcel $pPHPExcel=null)
 Write workbook relationships to XML format.
 writeWorksheetRelationships (PHPExcel_Worksheet $pWorksheet=null, $pWorksheetId=1)
 Write worksheet relationships to XML format.
 writeDrawingRelationships (PHPExcel_Worksheet $pWorksheet=null)
 Write drawing relationships to XML format.
 writeHeaderFooterDrawingRelationships (PHPExcel_Worksheet $pWorksheet=null)
 Write header/footer drawing relationships to XML format.
- Public Member Functions inherited from PHPExcel_Writer_Excel2007_WriterPart
 setParentWriter (PHPExcel_Writer_IWriter $pWriter=null)
 Set parent IWriter object.
 getParentWriter ()
 Get parent IWriter object.

Private Member Functions

 _writeRelationship (PHPExcel_Shared_XMLWriter $objWriter=null, $pId=1, $pType= '', $pTarget= '', $pTargetMode= '')
 Write Override content type.

Detailed Description

Definition at line 60 of file Rels.php.

Member Function Documentation

PHPExcel_Writer_Excel2007_Rels::_writeRelationship ( PHPExcel_Shared_XMLWriter  $objWriter = null,
  $pId = 1,
  $pType = '',
  $pTarget = '',
  $pTargetMode = '' 
)
private

Write Override content type.

Parameters
PHPExcel_Shared_XMLWriter$objWriterXML Writer
int$pIdRelationship ID. rId will be prepended!
string$pTypeRelationship type
string$pTargetRelationship target
string$pTargetModeRelationship target mode
Exceptions
Exception

Definition at line 371 of file Rels.php.

Referenced by writeDrawingRelationships(), writeHeaderFooterDrawingRelationships(), writeRelationships(), writeWorkbookRelationships(), and writeWorksheetRelationships().

{
if ($pType != '' && $pTarget != '') {
// Write relationship
$objWriter->startElement('Relationship');
$objWriter->writeAttribute('Id', 'rId' . $pId);
$objWriter->writeAttribute('Type', $pType);
$objWriter->writeAttribute('Target', $pTarget);
if ($pTargetMode != '') {
$objWriter->writeAttribute('TargetMode', $pTargetMode);
}
$objWriter->endElement();
} else {
throw new Exception("Invalid parameters passed.");
}
}

+ Here is the caller graph for this function:

PHPExcel_Writer_Excel2007_Rels::writeDrawingRelationships ( PHPExcel_Worksheet  $pWorksheet = null)

Write drawing relationships to XML format.

Parameters
PHPExcel_Worksheet$pWorksheet
Returns
string XML Output
Exceptions
Exception

Definition at line 278 of file Rels.php.

References _writeRelationship(), PHPExcel_Writer_Excel2007_WriterPart\getParentWriter(), PHPExcel_Shared_XMLWriter\STORAGE_DISK, and PHPExcel_Shared_XMLWriter\STORAGE_MEMORY.

{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
} else {
}
// XML header
$objWriter->startDocument('1.0','UTF-8','yes');
// Relationships
$objWriter->startElement('Relationships');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
// Loop trough images and write relationships
$i = 1;
$iterator = $pWorksheet->getDrawingCollection()->getIterator();
while ($iterator->valid()) {
if ($iterator->current() instanceof PHPExcel_Worksheet_Drawing
|| $iterator->current() instanceof PHPExcel_Worksheet_MemoryDrawing) {
// Write relationship for image drawing
$objWriter,
$i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
'../media/' . str_replace(' ', '', $iterator->current()->getIndexedFilename())
);
}
$iterator->next();
++$i;
}
$objWriter->endElement();
// Return
return $objWriter->getData();
}

+ Here is the call graph for this function:

PHPExcel_Writer_Excel2007_Rels::writeHeaderFooterDrawingRelationships ( PHPExcel_Worksheet  $pWorksheet = null)

Write header/footer drawing relationships to XML format.

Parameters
PHPExcel_Worksheet$pWorksheet
Returns
string XML Output
Exceptions
Exception

Definition at line 327 of file Rels.php.

References $key, _writeRelationship(), PHPExcel_Writer_Excel2007_WriterPart\getParentWriter(), PHPExcel_Shared_XMLWriter\STORAGE_DISK, and PHPExcel_Shared_XMLWriter\STORAGE_MEMORY.

{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
} else {
}
// XML header
$objWriter->startDocument('1.0','UTF-8','yes');
// Relationships
$objWriter->startElement('Relationships');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
// Loop trough images and write relationships
foreach ($pWorksheet->getHeaderFooter()->getImages() as $key => $value) {
// Write relationship for image drawing
$objWriter,
$key,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/image',
'../media/' . $value->getIndexedFilename()
);
}
$objWriter->endElement();
// Return
return $objWriter->getData();
}

+ Here is the call graph for this function:

PHPExcel_Writer_Excel2007_Rels::writeRelationships ( PHPExcel  $pPHPExcel = null)

Write relationships to XML format.

Parameters
PHPExcel$pPHPExcel
Returns
string XML Output
Exceptions
Exception

Definition at line 69 of file Rels.php.

References _writeRelationship(), PHPExcel_Writer_Excel2007_WriterPart\getParentWriter(), PHPExcel_Shared_XMLWriter\STORAGE_DISK, and PHPExcel_Shared_XMLWriter\STORAGE_MEMORY.

{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
} else {
}
// XML header
$objWriter->startDocument('1.0','UTF-8','yes');
// Relationships
$objWriter->startElement('Relationships');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
// Relationship docProps/app.xml
$objWriter,
3,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties',
'docProps/app.xml'
);
// Relationship docProps/core.xml
$objWriter,
2,
'http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties',
'docProps/core.xml'
);
// Relationship xl/workbook.xml
$objWriter,
1,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument',
'xl/workbook.xml'
);
$objWriter->endElement();
// Return
return $objWriter->getData();
}

+ Here is the call graph for this function:

PHPExcel_Writer_Excel2007_Rels::writeWorkbookRelationships ( PHPExcel  $pPHPExcel = null)

Write workbook relationships to XML format.

Parameters
PHPExcel$pPHPExcel
Returns
string XML Output
Exceptions
Exception

Definition at line 123 of file Rels.php.

References _writeRelationship(), PHPExcel_Writer_Excel2007_WriterPart\getParentWriter(), PHPExcel_Shared_XMLWriter\STORAGE_DISK, and PHPExcel_Shared_XMLWriter\STORAGE_MEMORY.

{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
} else {
}
// XML header
$objWriter->startDocument('1.0','UTF-8','yes');
// Relationships
$objWriter->startElement('Relationships');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
// Relationship styles.xml
$objWriter,
1,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles',
'styles.xml'
);
// Relationship theme/theme1.xml
$objWriter,
2,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme',
'theme/theme1.xml'
);
// Relationship sharedStrings.xml
$objWriter,
3,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings',
'sharedStrings.xml'
);
// Relationships with sheets
$sheetCount = $pPHPExcel->getSheetCount();
for ($i = 0; $i < $sheetCount; ++$i) {
$objWriter,
($i + 1 + 3),
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet',
'worksheets/sheet' . ($i + 1) . '.xml'
);
}
$objWriter->endElement();
// Return
return $objWriter->getData();
}

+ Here is the call graph for this function:

PHPExcel_Writer_Excel2007_Rels::writeWorksheetRelationships ( PHPExcel_Worksheet  $pWorksheet = null,
  $pWorksheetId = 1 
)

Write worksheet relationships to XML format.

Numbering is as follows: rId1 - Drawings rId_hyperlink_x - Hyperlinks

Parameters
PHPExcel_Worksheet$pWorksheet
int$pWorksheetId
Returns
string XML Output
Exceptions
Exception

Definition at line 193 of file Rels.php.

References _writeRelationship(), PHPExcel_Writer_Excel2007_WriterPart\getParentWriter(), PHPExcel_Shared_XMLWriter\STORAGE_DISK, and PHPExcel_Shared_XMLWriter\STORAGE_MEMORY.

{
// Create XML writer
$objWriter = null;
if ($this->getParentWriter()->getUseDiskCaching()) {
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
} else {
}
// XML header
$objWriter->startDocument('1.0','UTF-8','yes');
// Relationships
$objWriter->startElement('Relationships');
$objWriter->writeAttribute('xmlns', 'http://schemas.openxmlformats.org/package/2006/relationships');
// Write drawing relationships?
if ($pWorksheet->getDrawingCollection()->count() > 0) {
$objWriter,
1,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing',
'../drawings/drawing' . $pWorksheetId . '.xml'
);
}
// Write hyperlink relationships?
$i = 1;
foreach ($pWorksheet->getCellCollection() as $cell) {
if ($cell->hasHyperlink() && !$cell->getHyperlink()->isInternal()) {
$objWriter,
'_hyperlink_' . $i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink',
$cell->getHyperlink()->getUrl(),
'External'
);
++$i;
}
}
// Write comments relationship?
$i = 1;
if (count($pWorksheet->getComments()) > 0) {
$objWriter,
'_comments_vml' . $i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
'../drawings/vmlDrawing' . $pWorksheetId . '.vml'
);
$objWriter,
'_comments' . $i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments',
'../comments' . $pWorksheetId . '.xml'
);
}
// Write header/footer relationship?
$i = 1;
if (count($pWorksheet->getHeaderFooter()->getImages()) > 0) {
$objWriter,
'_headerfooter_vml' . $i,
'http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing',
'../drawings/vmlDrawingHF' . $pWorksheetId . '.vml'
);
}
$objWriter->endElement();
// Return
return $objWriter->getData();
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: