/
doc_custom_properties.php
30 lines (24 loc) · 1.08 KB
/
doc_custom_properties.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/**
* @see http://libxlsxwriter.github.io/doc_custom_properties_8c-example.html
* @noinspection PhpUnhandledExceptionInspection
*/
use FFILibXlsxWriter\FFILibXlsxWriter;
use FFILibXlsxWriter\Structs\DateTime as XlsxDateTime;
use FFILibXlsxWriter\Workbook;
require_once __DIR__ . '/../vendor/autoload.php';
FFILibXlsxWriter::init();
$workbook = new Workbook(__DIR__ . '/output/doc_custom_properties.xlsx');
$worksheet = $workbook->addWorksheet();
$datetime = new XlsxDateTime(2016, 12, 12, 0, 0, 0.0);
/* Set some custom document properties in the workbook. */
$workbook->setCustomPropertyString("Checked by", "Eve");
$workbook->setCustomPropertyDateTime("Date completed", $datetime);
$workbook->setCustomPropertyNumber("Document number", 12345);
$workbook->setCustomPropertyNumber("Reference number", 1.2345);
$workbook->setCustomPropertyBoolean("Has Review", true);
$workbook->setCustomPropertyBoolean("Signed off", false);
/* Add some text to the file. */
$worksheet->setColumn('A:A', 50);
$worksheet->writeString('A1', 'Select \'Workbook Properties\' to see properties.');
$workbook->close();