private function PHPExcel_Writer_Excel5::_writeDocumentSummaryInformation in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Writer/Excel5.php \PHPExcel_Writer_Excel5::_writeDocumentSummaryInformation()
* Build the OLE Part for DocumentSummary Information *
Return value
string
1 call to PHPExcel_Writer_Excel5::_writeDocumentSummaryInformation()
- PHPExcel_Writer_Excel5::save in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ Excel5.php - * Save PHPExcel to file * *
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Writer/ Excel5.php, line 563
Class
- PHPExcel_Writer_Excel5
- PHPExcel_Writer_Excel5
Code
private function _writeDocumentSummaryInformation() {
// offset: 0; size: 2; must be 0xFE 0xFF (UTF-16 LE byte order mark)
$data = pack('v', 0xfffe);
// offset: 2; size: 2;
$data .= pack('v', 0x0);
// offset: 4; size: 2; OS version
$data .= pack('v', 0x106);
// offset: 6; size: 2; OS indicator
$data .= pack('v', 0x2);
// offset: 8; size: 16
$data .= pack('VVVV', 0x0, 0x0, 0x0, 0x0);
// offset: 24; size: 4; section count
$data .= pack('V', 0x1);
// offset: 28; size: 16; first section's class id: 02 d5 cd d5 9c 2e 1b 10 93 97 08 00 2b 2c f9 ae
$data .= pack('vvvvvvvv', 0xd502, 0xd5cd, 0x2e9c, 0x101b, 0x9793, 0x8, 0x2c2b, 0xaef9);
// offset: 44; size: 4; offset of the start
$data .= pack('V', 0x30);
// SECTION
$dataSection = array();
$dataSection_NumProps = 0;
$dataSection_Summary = '';
$dataSection_Content = '';
// GKPIDDSI_CODEPAGE: CodePage
$dataSection[] = array(
'summary' => array(
'pack' => 'V',
'data' => 0x1,
),
'offset' => array(
'pack' => 'V',
),
'type' => array(
'pack' => 'V',
'data' => 0x2,
),
// 2 byte signed integer
'data' => array(
'data' => 1252,
),
);
$dataSection_NumProps++;
// GKPIDDSI_CATEGORY : Category
if ($this->_phpExcel
->getProperties()
->getCategory()) {
$dataProp = $this->_phpExcel
->getProperties()
->getCategory();
$dataSection[] = array(
'summary' => array(
'pack' => 'V',
'data' => 0x2,
),
'offset' => array(
'pack' => 'V',
),
'type' => array(
'pack' => 'V',
'data' => 0x1e,
),
'data' => array(
'data' => $dataProp,
'length' => strlen($dataProp),
),
);
$dataSection_NumProps++;
}
// GKPIDDSI_VERSION :Version of the application that wrote the property storage
$dataSection[] = array(
'summary' => array(
'pack' => 'V',
'data' => 0x17,
),
'offset' => array(
'pack' => 'V',
),
'type' => array(
'pack' => 'V',
'data' => 0x3,
),
'data' => array(
'pack' => 'V',
'data' => 0xc0000,
),
);
$dataSection_NumProps++;
// GKPIDDSI_SCALE : FALSE
$dataSection[] = array(
'summary' => array(
'pack' => 'V',
'data' => 0xb,
),
'offset' => array(
'pack' => 'V',
),
'type' => array(
'pack' => 'V',
'data' => 0xb,
),
'data' => array(
'data' => false,
),
);
$dataSection_NumProps++;
// GKPIDDSI_LINKSDIRTY : True if any of the values for the linked properties have changed outside of the application
$dataSection[] = array(
'summary' => array(
'pack' => 'V',
'data' => 0x10,
),
'offset' => array(
'pack' => 'V',
),
'type' => array(
'pack' => 'V',
'data' => 0xb,
),
'data' => array(
'data' => false,
),
);
$dataSection_NumProps++;
// GKPIDDSI_SHAREDOC : FALSE
$dataSection[] = array(
'summary' => array(
'pack' => 'V',
'data' => 0x13,
),
'offset' => array(
'pack' => 'V',
),
'type' => array(
'pack' => 'V',
'data' => 0xb,
),
'data' => array(
'data' => false,
),
);
$dataSection_NumProps++;
// GKPIDDSI_HYPERLINKSCHANGED : True if any of the values for the _PID_LINKS (hyperlink text) have changed outside of the application
$dataSection[] = array(
'summary' => array(
'pack' => 'V',
'data' => 0x16,
),
'offset' => array(
'pack' => 'V',
),
'type' => array(
'pack' => 'V',
'data' => 0xb,
),
'data' => array(
'data' => false,
),
);
$dataSection_NumProps++;
// GKPIDDSI_DOCSPARTS
// MS-OSHARED p75 (2.3.3.2.2.1)
// Structure is VtVecUnalignedLpstrValue (2.3.3.1.9)
// cElements
$dataProp = pack('v', 0x1);
$dataProp .= pack('v', 0x0);
// array of UnalignedLpstr
// cch
$dataProp .= pack('v', 0xa);
$dataProp .= pack('v', 0x0);
// value
$dataProp .= 'Worksheet' . chr(0);
$dataSection[] = array(
'summary' => array(
'pack' => 'V',
'data' => 0xd,
),
'offset' => array(
'pack' => 'V',
),
'type' => array(
'pack' => 'V',
'data' => 0x101e,
),
'data' => array(
'data' => $dataProp,
'length' => strlen($dataProp),
),
);
$dataSection_NumProps++;
// GKPIDDSI_HEADINGPAIR
// VtVecHeadingPairValue
// cElements
$dataProp = pack('v', 0x2);
$dataProp .= pack('v', 0x0);
// Array of vtHeadingPair
// vtUnalignedString - headingString
// stringType
$dataProp .= pack('v', 0x1e);
// padding
$dataProp .= pack('v', 0x0);
// UnalignedLpstr
// cch
$dataProp .= pack('v', 0x13);
$dataProp .= pack('v', 0x0);
// value
$dataProp .= 'Feuilles de calcul';
// vtUnalignedString - headingParts
// wType : 0x0003 = 32 bit signed integer
$dataProp .= pack('v', 0x300);
// padding
$dataProp .= pack('v', 0x0);
// value
$dataProp .= pack('v', 0x100);
$dataProp .= pack('v', 0x0);
$dataProp .= pack('v', 0x0);
$dataProp .= pack('v', 0x0);
$dataSection[] = array(
'summary' => array(
'pack' => 'V',
'data' => 0xc,
),
'offset' => array(
'pack' => 'V',
),
'type' => array(
'pack' => 'V',
'data' => 0x100c,
),
'data' => array(
'data' => $dataProp,
'length' => strlen($dataProp),
),
);
$dataSection_NumProps++;
// 4 Section Length
// 4 Property count
// 8 * $dataSection_NumProps (8 = ID (4) + OffSet(4))
$dataSection_Content_Offset = 8 + $dataSection_NumProps * 8;
foreach ($dataSection as $dataProp) {
// Summary
$dataSection_Summary .= pack($dataProp['summary']['pack'], $dataProp['summary']['data']);
// Offset
$dataSection_Summary .= pack($dataProp['offset']['pack'], $dataSection_Content_Offset);
// DataType
$dataSection_Content .= pack($dataProp['type']['pack'], $dataProp['type']['data']);
// Data
if ($dataProp['type']['data'] == 0x2) {
// 2 byte signed integer
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
elseif ($dataProp['type']['data'] == 0x3) {
// 4 byte signed integer
$dataSection_Content .= pack('V', $dataProp['data']['data']);
$dataSection_Content_Offset += 4 + 4;
}
elseif ($dataProp['type']['data'] == 0xb) {
// Boolean
if ($dataProp['data']['data'] == false) {
$dataSection_Content .= pack('V', 0x0);
}
else {
$dataSection_Content .= pack('V', 0x1);
}
$dataSection_Content_Offset += 4 + 4;
}
elseif ($dataProp['type']['data'] == 0x1e) {
// null-terminated string prepended by dword string length
// Null-terminated string
$dataProp['data']['data'] .= chr(0);
$dataProp['data']['length'] += 1;
// Complete the string with null string for being a %4
$dataProp['data']['length'] = $dataProp['data']['length'] + (4 - $dataProp['data']['length'] % 4 == 4 ? 0 : 4 - $dataProp['data']['length'] % 4);
$dataProp['data']['data'] = str_pad($dataProp['data']['data'], $dataProp['data']['length'], chr(0), STR_PAD_RIGHT);
$dataSection_Content .= pack('V', $dataProp['data']['length']);
$dataSection_Content .= $dataProp['data']['data'];
$dataSection_Content_Offset += 4 + 4 + strlen($dataProp['data']['data']);
}
elseif ($dataProp['type']['data'] == 0x40) {
// Filetime (64-bit value representing the number of 100-nanosecond intervals since January 1, 1601)
$dataSection_Content .= $dataProp['data']['data'];
$dataSection_Content_Offset += 4 + 8;
}
else {
// Data Type Not Used at the moment
$dataSection_Content .= $dataProp['data']['data'];
$dataSection_Content_Offset += 4 + $dataProp['data']['length'];
}
}
// Now $dataSection_Content_Offset contains the size of the content
// section header
// offset: $secOffset; size: 4; section length
// + x Size of the content (summary + content)
$data .= pack('V', $dataSection_Content_Offset);
// offset: $secOffset+4; size: 4; property count
$data .= pack('V', $dataSection_NumProps);
// Section Summary
$data .= $dataSection_Summary;
// Section Content
$data .= $dataSection_Content;
return $data;
}