1 |
efrain |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
namespace PhpOffice\PhpSpreadsheet\Writer\Ods;
|
|
|
4 |
|
|
|
5 |
use PhpOffice\PhpSpreadsheet\Shared\XMLWriter;
|
|
|
6 |
|
|
|
7 |
class Styles extends WriterPart
|
|
|
8 |
{
|
|
|
9 |
/**
|
|
|
10 |
* Write styles.xml to XML format.
|
|
|
11 |
*
|
|
|
12 |
* @return string XML Output
|
|
|
13 |
*/
|
|
|
14 |
public function write(): string
|
|
|
15 |
{
|
|
|
16 |
$objWriter = null;
|
|
|
17 |
if ($this->getParentWriter()->getUseDiskCaching()) {
|
|
|
18 |
$objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
|
|
|
19 |
} else {
|
|
|
20 |
$objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY);
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
// XML header
|
|
|
24 |
$objWriter->startDocument('1.0', 'UTF-8');
|
|
|
25 |
|
|
|
26 |
// Content
|
|
|
27 |
$objWriter->startElement('office:document-styles');
|
|
|
28 |
$objWriter->writeAttribute('xmlns:office', 'urn:oasis:names:tc:opendocument:xmlns:office:1.0');
|
|
|
29 |
$objWriter->writeAttribute('xmlns:style', 'urn:oasis:names:tc:opendocument:xmlns:style:1.0');
|
|
|
30 |
$objWriter->writeAttribute('xmlns:text', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0');
|
|
|
31 |
$objWriter->writeAttribute('xmlns:table', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0');
|
|
|
32 |
$objWriter->writeAttribute('xmlns:draw', 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0');
|
|
|
33 |
$objWriter->writeAttribute('xmlns:fo', 'urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0');
|
|
|
34 |
$objWriter->writeAttribute('xmlns:xlink', 'http://www.w3.org/1999/xlink');
|
|
|
35 |
$objWriter->writeAttribute('xmlns:dc', 'http://purl.org/dc/elements/1.1/');
|
|
|
36 |
$objWriter->writeAttribute('xmlns:meta', 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0');
|
|
|
37 |
$objWriter->writeAttribute('xmlns:number', 'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0');
|
|
|
38 |
$objWriter->writeAttribute('xmlns:presentation', 'urn:oasis:names:tc:opendocument:xmlns:presentation:1.0');
|
|
|
39 |
$objWriter->writeAttribute('xmlns:svg', 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0');
|
|
|
40 |
$objWriter->writeAttribute('xmlns:chart', 'urn:oasis:names:tc:opendocument:xmlns:chart:1.0');
|
|
|
41 |
$objWriter->writeAttribute('xmlns:dr3d', 'urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0');
|
|
|
42 |
$objWriter->writeAttribute('xmlns:math', 'http://www.w3.org/1998/Math/MathML');
|
|
|
43 |
$objWriter->writeAttribute('xmlns:form', 'urn:oasis:names:tc:opendocument:xmlns:form:1.0');
|
|
|
44 |
$objWriter->writeAttribute('xmlns:script', 'urn:oasis:names:tc:opendocument:xmlns:script:1.0');
|
|
|
45 |
$objWriter->writeAttribute('xmlns:ooo', 'http://openoffice.org/2004/office');
|
|
|
46 |
$objWriter->writeAttribute('xmlns:ooow', 'http://openoffice.org/2004/writer');
|
|
|
47 |
$objWriter->writeAttribute('xmlns:oooc', 'http://openoffice.org/2004/calc');
|
|
|
48 |
$objWriter->writeAttribute('xmlns:dom', 'http://www.w3.org/2001/xml-events');
|
|
|
49 |
$objWriter->writeAttribute('xmlns:rpt', 'http://openoffice.org/2005/report');
|
|
|
50 |
$objWriter->writeAttribute('xmlns:of', 'urn:oasis:names:tc:opendocument:xmlns:of:1.2');
|
|
|
51 |
$objWriter->writeAttribute('xmlns:xhtml', 'http://www.w3.org/1999/xhtml');
|
|
|
52 |
$objWriter->writeAttribute('xmlns:grddl', 'http://www.w3.org/2003/g/data-view#');
|
|
|
53 |
$objWriter->writeAttribute('xmlns:tableooo', 'http://openoffice.org/2009/table');
|
|
|
54 |
$objWriter->writeAttribute('xmlns:css3t', 'http://www.w3.org/TR/css3-text/');
|
|
|
55 |
$objWriter->writeAttribute('office:version', '1.2');
|
|
|
56 |
|
|
|
57 |
$objWriter->writeElement('office:font-face-decls');
|
|
|
58 |
$objWriter->writeElement('office:styles');
|
|
|
59 |
$objWriter->writeElement('office:automatic-styles');
|
|
|
60 |
$objWriter->writeElement('office:master-styles');
|
|
|
61 |
$objWriter->endElement();
|
|
|
62 |
|
|
|
63 |
return $objWriter->getData();
|
|
|
64 |
}
|
|
|
65 |
}
|