public function PHPExcel_Writer_Excel2007_Comments::writeVMLComments in Loft Data Grids 7.2
Same name and namespace in other branches
- 6.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel2007/Comments.php \PHPExcel_Writer_Excel2007_Comments::writeVMLComments()
* Write VML comments to XML format * *
Parameters
PHPExcel_Worksheet $pWorksheet: * @return string XML Output * @throws PHPExcel_Writer_Exception
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ Excel2007/ Comments.php, line 125
Class
- PHPExcel_Writer_Excel2007_Comments
- PHPExcel_Writer_Excel2007_Comments
Code
public function writeVMLComments(PHPExcel_Worksheet $pWorksheet = null) {
// Create XML writer
$objWriter = null;
if ($this
->getParentWriter()
->getUseDiskCaching()) {
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this
->getParentWriter()
->getDiskCachingDirectory());
}
else {
$objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
}
// XML header
$objWriter
->startDocument('1.0', 'UTF-8', 'yes');
// Comments cache
$comments = $pWorksheet
->getComments();
// xml
$objWriter
->startElement('xml');
$objWriter
->writeAttribute('xmlns:v', 'urn:schemas-microsoft-com:vml');
$objWriter
->writeAttribute('xmlns:o', 'urn:schemas-microsoft-com:office:office');
$objWriter
->writeAttribute('xmlns:x', 'urn:schemas-microsoft-com:office:excel');
// o:shapelayout
$objWriter
->startElement('o:shapelayout');
$objWriter
->writeAttribute('v:ext', 'edit');
// o:idmap
$objWriter
->startElement('o:idmap');
$objWriter
->writeAttribute('v:ext', 'edit');
$objWriter
->writeAttribute('data', '1');
$objWriter
->endElement();
$objWriter
->endElement();
// v:shapetype
$objWriter
->startElement('v:shapetype');
$objWriter
->writeAttribute('id', '_x0000_t202');
$objWriter
->writeAttribute('coordsize', '21600,21600');
$objWriter
->writeAttribute('o:spt', '202');
$objWriter
->writeAttribute('path', 'm,l,21600r21600,l21600,xe');
// v:stroke
$objWriter
->startElement('v:stroke');
$objWriter
->writeAttribute('joinstyle', 'miter');
$objWriter
->endElement();
// v:path
$objWriter
->startElement('v:path');
$objWriter
->writeAttribute('gradientshapeok', 't');
$objWriter
->writeAttribute('o:connecttype', 'rect');
$objWriter
->endElement();
$objWriter
->endElement();
// Loop through comments
foreach ($comments as $key => $value) {
$this
->_writeVMLComment($objWriter, $key, $value);
}
$objWriter
->endElement();
// Return
return $objWriter
->getData();
}