66 $objWriter->startElement(
'office:document-content');
67 $objWriter->writeAttribute(
'xmlns:office',
'urn:oasis:names:tc:opendocument:xmlns:office:1.0');
68 $objWriter->writeAttribute(
'xmlns:style',
'urn:oasis:names:tc:opendocument:xmlns:style:1.0');
69 $objWriter->writeAttribute(
'xmlns:text',
'urn:oasis:names:tc:opendocument:xmlns:text:1.0');
70 $objWriter->writeAttribute(
'xmlns:table',
'urn:oasis:names:tc:opendocument:xmlns:table:1.0');
71 $objWriter->writeAttribute(
'xmlns:draw',
'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0');
72 $objWriter->writeAttribute(
'xmlns:fo',
'urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0');
73 $objWriter->writeAttribute(
'xmlns:xlink',
'http://www.w3.org/1999/xlink');
74 $objWriter->writeAttribute(
'xmlns:dc',
'http://purl.org/dc/elements/1.1/');
75 $objWriter->writeAttribute(
'xmlns:meta',
'urn:oasis:names:tc:opendocument:xmlns:meta:1.0');
76 $objWriter->writeAttribute(
'xmlns:number',
'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0');
77 $objWriter->writeAttribute(
'xmlns:presentation',
'urn:oasis:names:tc:opendocument:xmlns:presentation:1.0');
78 $objWriter->writeAttribute(
'xmlns:svg',
'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0');
79 $objWriter->writeAttribute(
'xmlns:chart',
'urn:oasis:names:tc:opendocument:xmlns:chart:1.0');
80 $objWriter->writeAttribute(
'xmlns:dr3d',
'urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0');
81 $objWriter->writeAttribute(
'xmlns:math',
'http://www.w3.org/1998/Math/MathML');
82 $objWriter->writeAttribute(
'xmlns:form',
'urn:oasis:names:tc:opendocument:xmlns:form:1.0');
83 $objWriter->writeAttribute(
'xmlns:script',
'urn:oasis:names:tc:opendocument:xmlns:script:1.0');
84 $objWriter->writeAttribute(
'xmlns:ooo',
'http://openoffice.org/2004/office');
85 $objWriter->writeAttribute(
'xmlns:ooow',
'http://openoffice.org/2004/writer');
86 $objWriter->writeAttribute(
'xmlns:oooc',
'http://openoffice.org/2004/calc');
87 $objWriter->writeAttribute(
'xmlns:dom',
'http://www.w3.org/2001/xml-events');
88 $objWriter->writeAttribute(
'xmlns:xforms',
'http://www.w3.org/2002/xforms');
89 $objWriter->writeAttribute(
'xmlns:xsd',
'http://www.w3.org/2001/XMLSchema');
90 $objWriter->writeAttribute(
'xmlns:xsi',
'http://www.w3.org/2001/XMLSchema-instance');
91 $objWriter->writeAttribute(
'xmlns:rpt',
'http://openoffice.org/2005/report');
92 $objWriter->writeAttribute(
'xmlns:of',
'urn:oasis:names:tc:opendocument:xmlns:of:1.2');
93 $objWriter->writeAttribute(
'xmlns:xhtml',
'http://www.w3.org/1999/xhtml');
94 $objWriter->writeAttribute(
'xmlns:grddl',
'http://www.w3.org/2003/g/data-view#');
95 $objWriter->writeAttribute(
'xmlns:tableooo',
'http://openoffice.org/2009/table');
96 $objWriter->writeAttribute(
'xmlns:field',
'urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0');
97 $objWriter->writeAttribute(
'xmlns:formx',
'urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0');
98 $objWriter->writeAttribute(
'xmlns:css3t',
'http://www.w3.org/TR/css3-text/');
99 $objWriter->writeAttribute(
'office:version',
'1.2');
102 $objWriter->writeElement(
'office:font-face-decls');
103 $objWriter->writeElement(
'office:automatic-styles');
106 $objWriter->startElement(
'office:spreadsheet');
107 $objWriter->writeElement(
'table:calculation-settings');
109 $objWriter->writeElement(
'table:named-expressions');
126 $sheet_count = $pPHPExcel->getSheetCount();
127 for (
$i = 0;
$i < $sheet_count;
$i++) {
129 $objWriter->startElement(
'table:table');
130 $objWriter->writeAttribute(
'table:name', $pPHPExcel->getSheet(
$i)->getTitle());
131 $objWriter->writeElement(
'office:forms');
132 $objWriter->startElement(
'table:table-column');
133 $objWriter->writeAttribute(
'table:number-columns-repeated', self::NUMBER_COLS_REPEATED_MAX);
134 $objWriter->endElement();
135 $this->
_writeRows($objWriter, $pPHPExcel->getSheet(
$i));
136 $objWriter->endElement();
148 $number_rows_repeated = self::NUMBER_ROWS_REPEATED_MAX;
151 while (
$rows->valid()) {
152 $number_rows_repeated--;
154 if (
$row->getCellIterator()->valid()) {
156 $objWriter->startElement(
'table:table-row');
158 $objWriter->writeAttribute(
'table:number-rows-repeated', $span_row);
160 $objWriter->startElement(
'table:table-cell');
161 $objWriter->writeAttribute(
'table:number-columns-repeated', self::NUMBER_COLS_REPEATED_MAX);
162 $objWriter->endElement();
163 $objWriter->endElement();
166 $objWriter->startElement(
'table:table-row');
168 $objWriter->endElement();
185 $number_cols_repeated = self::NUMBER_COLS_REPEATED_MAX;
188 while ($cells->valid()) {
189 $cell = $cells->current();
193 $objWriter->startElement(
'table:table-cell');
195 switch ($cell->getDataType()) {
197 $objWriter->writeAttribute(
'office:value-type',
'boolean');
198 $objWriter->writeAttribute(
'office:value', $cell->getValue());
199 $objWriter->writeElement(
'text:p', $cell->getValue());
208 $formula_value = $cell->getCalculatedValue();
210 $formula_value = $cell->getValue();
212 $objWriter->writeAttribute(
'table:formula',
'of:' . $cell->getValue());
213 if (is_numeric($formula_value)) {
214 $objWriter->writeAttribute(
'office:value-type',
'float');
216 $objWriter->writeAttribute(
'office:value-type',
'string');
218 $objWriter->writeAttribute(
'office:value', $formula_value);
219 $objWriter->writeElement(
'text:p', $formula_value);
227 $objWriter->writeAttribute(
'office:value-type',
'float');
228 $objWriter->writeAttribute(
'office:value', $cell->getValue());
229 $objWriter->writeElement(
'text:p', $cell->getValue());
233 $objWriter->writeAttribute(
'office:value-type',
'string');
234 $objWriter->writeElement(
'text:p', $cell->getValue());
238 $objWriter->endElement();
242 $number_cols_repeated = $number_cols_repeated - $prev_column - 1;
243 if ($number_cols_repeated > 0) {
244 if ($number_cols_repeated > 1) {
245 $objWriter->startElement(
'table:table-cell');
246 $objWriter->writeAttribute(
'table:number-columns-repeated', $number_cols_repeated);
247 $objWriter->endElement();
249 $objWriter->writeElement(
'table:table-cell');
263 $diff = $curColumn - $prevColumn - 1;
265 $objWriter->writeElement(
'table:table-cell');
266 } elseif ($diff > 1) {
267 $objWriter->startElement(
'table:table-cell');
268 $objWriter->writeAttribute(
'table:number-columns-repeated', $diff);
269 $objWriter->endElement();
_writeCells(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Worksheet_Row $row)
Write cells of the specified row.
getCellIterator($startColumn='A', $endColumn=null)
Get cell iterator.
_writeCellSpan(PHPExcel_Shared_XMLWriter $objWriter, $curColumn, $prevColumn)
Write span.
getParentWriter()
Get parent IWriter object.
const NUMBER_COLS_REPEATED_MAX
getRowIterator($startRow=1, $endRow=null)
Get row iterator.
_writeSheets(PHPExcel_Shared_XMLWriter $objWriter)
Write sheets.
const NUMBER_ROWS_REPEATED_MAX
_writeRows(PHPExcel_Shared_XMLWriter $objWriter, PHPExcel_Worksheet $sheet)
Write rows of the specified sheet.
static columnIndexFromString($pString='A')
Column index from string.
const STORAGE_MEMORY
Temporary storage method.
write(PHPExcel $pPHPExcel=null)
Write content.xml to XML format.