Fix/1674 (#1688)
* Treat inline strings like strings in Open Document because it has no specific inline-string format * implement data-type error Co-authored-by: Mark Baker <mark@lange.demon.co.uk>
This commit is contained in:
parent
308bc64d91
commit
fdc8e8d17a
|
|
@ -34,6 +34,7 @@ and this project adheres to [Semantic Versioning](https://semver.org).
|
|||
|
||||
- Fix For Null Exception on ODS Read of Page Settings. [#1772](https://github.com/PHPOffice/PhpSpreadsheet/issues/1772)
|
||||
- Fix Xlsx reader overriding manually set number format with builtin number format. [PR #1805](https://github.com/PHPOffice/PhpSpreadsheet/pull/1805)
|
||||
- Fix for not yet implemented data-types in Open Documend writer [Issue #1674](https://github.com/PHPOffice/PhpSpreadsheet/issues/1674)
|
||||
|
||||
## 1.16.0 - 2020-12-31
|
||||
|
||||
|
|
|
|||
|
|
@ -196,7 +196,10 @@ class Content extends WriterPart
|
|||
|
||||
break;
|
||||
case DataType::TYPE_ERROR:
|
||||
throw new Exception('Writing of error not implemented yet.');
|
||||
$objWriter->writeAttribute('table:formula', 'of:=#NULL!');
|
||||
$objWriter->writeAttribute('office:value-type', 'string');
|
||||
$objWriter->writeAttribute('office:string-value', '');
|
||||
$objWriter->writeElement('text:p', '#NULL!');
|
||||
|
||||
break;
|
||||
case DataType::TYPE_FORMULA:
|
||||
|
|
@ -217,10 +220,6 @@ class Content extends WriterPart
|
|||
$objWriter->writeAttribute('office:value', $formulaValue);
|
||||
$objWriter->writeElement('text:p', $formulaValue);
|
||||
|
||||
break;
|
||||
case DataType::TYPE_INLINE:
|
||||
throw new Exception('Writing of inline not implemented yet.');
|
||||
|
||||
break;
|
||||
case DataType::TYPE_NUMERIC:
|
||||
$objWriter->writeAttribute('office:value-type', 'float');
|
||||
|
|
@ -228,6 +227,8 @@ class Content extends WriterPart
|
|||
$objWriter->writeElement('text:p', $cell->getValue());
|
||||
|
||||
break;
|
||||
case DataType::TYPE_INLINE:
|
||||
// break intentionally omitted
|
||||
case DataType::TYPE_STRING:
|
||||
$objWriter->writeAttribute('office:value-type', 'string');
|
||||
$objWriter->writeElement('text:p', $cell->getValue());
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ class ContentTest extends TestCase
|
|||
|
||||
$worksheet1->setCellValue('A2', true); // Boolean
|
||||
$worksheet1->setCellValue('B2', false); // Boolean
|
||||
|
||||
$worksheet1->setCellValueExplicit(
|
||||
'C2',
|
||||
'=IF(A3, CONCATENATE(A1, " ", A2), CONCATENATE(A2, " ", A1))',
|
||||
|
|
@ -70,6 +71,9 @@ class ContentTest extends TestCase
|
|||
->getNumberFormat()
|
||||
->setFormatCode(NumberFormat::FORMAT_DATE_DATETIME);
|
||||
|
||||
$worksheet1->setCellValueExplicit('F1', null, DataType::TYPE_ERROR);
|
||||
$worksheet1->setCellValueExplicit('G1', 'Lorem ipsum', DataType::TYPE_INLINE);
|
||||
|
||||
// Styles
|
||||
$worksheet1->getStyle('A1')->getFont()->setBold(true);
|
||||
$worksheet1->getStyle('B1')->getFont()->setItalic(true);
|
||||
|
|
|
|||
|
|
@ -1,105 +1,113 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<office:document-content xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2">
|
||||
<office:scripts />
|
||||
<office:font-face-decls />
|
||||
<?xml version="1.0"?>
|
||||
<office:document-content xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:presentation="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" office:version="1.2">
|
||||
<office:scripts/>
|
||||
<office:font-face-decls/>
|
||||
<office:automatic-styles>
|
||||
<style:style style:name="ce0" style:family="table-cell" style:parent-style-name="Default">
|
||||
<style:text-properties fo:color="#000000" fo:font-family="Calibri" fo:font-size="11.0pt" />
|
||||
<style:table-cell-properties style:rotation-align="none" />
|
||||
<style:style style:family="table-cell" style:name="ce0" style:parent-style-name="Default">
|
||||
<style:text-properties fo:color="#000000" fo:font-family="Calibri" fo:font-size="11.0pt"/>
|
||||
<style:table-cell-properties style:rotation-align="none"/>
|
||||
</style:style>
|
||||
<style:style style:name="ce1" style:family="table-cell" style:parent-style-name="Default">
|
||||
<style:text-properties fo:color="#000000" fo:font-family="Calibri" fo:font-size="11.0pt" />
|
||||
<style:table-cell-properties style:rotation-align="none" />
|
||||
<style:style style:family="table-cell" style:name="ce1" style:parent-style-name="Default">
|
||||
<style:text-properties fo:color="#000000" fo:font-family="Calibri" fo:font-size="11.0pt"/>
|
||||
<style:table-cell-properties style:rotation-align="none"/>
|
||||
</style:style>
|
||||
<style:style style:name="ce2" style:family="table-cell" style:parent-style-name="Default">
|
||||
<style:text-properties fo:font-weight="bold" style:font-weight-complex="bold" style:font-weight-asian="bold" fo:color="#000000" fo:font-family="Calibri" fo:font-size="11.0pt" />
|
||||
<style:table-cell-properties style:rotation-align="none" />
|
||||
<style:style style:family="table-cell" style:name="ce2" style:parent-style-name="Default">
|
||||
<style:text-properties style:font-weight-asian="bold" style:font-weight-complex="bold" fo:color="#000000" fo:font-family="Calibri" fo:font-size="11.0pt" fo:font-weight="bold"/>
|
||||
<style:table-cell-properties style:rotation-align="none"/>
|
||||
</style:style>
|
||||
<style:style style:name="ce3" style:family="table-cell" style:parent-style-name="Default">
|
||||
<style:text-properties fo:font-style="italic" fo:color="#000000" fo:font-family="Calibri" fo:font-size="11.0pt" />
|
||||
<style:table-cell-properties style:rotation-align="none" />
|
||||
<style:style style:family="table-cell" style:name="ce3" style:parent-style-name="Default">
|
||||
<style:text-properties fo:color="#000000" fo:font-family="Calibri" fo:font-size="11.0pt" fo:font-style="italic"/>
|
||||
<style:table-cell-properties style:rotation-align="none"/>
|
||||
</style:style>
|
||||
<style:style style:name="ce4" style:family="table-cell" style:parent-style-name="Default">
|
||||
<style:text-properties fo:color="#000000" fo:font-family="Courier" fo:font-size="11.0pt" />
|
||||
<style:table-cell-properties style:rotation-align="none" />
|
||||
<style:style style:family="table-cell" style:name="ce4" style:parent-style-name="Default">
|
||||
<style:text-properties fo:color="#000000" fo:font-family="Courier" fo:font-size="11.0pt"/>
|
||||
<style:table-cell-properties style:rotation-align="none"/>
|
||||
</style:style>
|
||||
<style:style style:name="ce5" style:family="table-cell" style:parent-style-name="Default">
|
||||
<style:text-properties fo:color="#000000" fo:font-family="Courier" fo:font-size="14.0pt" />
|
||||
<style:table-cell-properties style:rotation-align="none" />
|
||||
<style:style style:family="table-cell" style:name="ce5" style:parent-style-name="Default">
|
||||
<style:text-properties fo:color="#000000" fo:font-family="Courier" fo:font-size="14.0pt"/>
|
||||
<style:table-cell-properties style:rotation-align="none"/>
|
||||
</style:style>
|
||||
<style:style style:name="ce6" style:family="table-cell" style:parent-style-name="Default">
|
||||
<style:text-properties fo:color="#0000FF" fo:font-family="Courier" fo:font-size="14.0pt" />
|
||||
<style:table-cell-properties style:rotation-align="none" />
|
||||
<style:style style:family="table-cell" style:name="ce6" style:parent-style-name="Default">
|
||||
<style:text-properties fo:color="#0000FF" fo:font-family="Courier" fo:font-size="14.0pt"/>
|
||||
<style:table-cell-properties style:rotation-align="none"/>
|
||||
</style:style>
|
||||
<style:style style:name="ce7" style:family="table-cell" style:parent-style-name="Default">
|
||||
<style:text-properties fo:color="#0000FF" fo:font-family="Courier" fo:font-size="14.0pt" />
|
||||
<style:table-cell-properties style:rotation-align="none" fo:background-color="#ffffff" />
|
||||
<style:style style:family="table-cell" style:name="ce7" style:parent-style-name="Default">
|
||||
<style:text-properties fo:color="#0000FF" fo:font-family="Courier" fo:font-size="14.0pt"/>
|
||||
<style:table-cell-properties style:rotation-align="none" fo:background-color="#ffffff"/>
|
||||
</style:style>
|
||||
<style:style style:name="ce8" style:family="table-cell" style:parent-style-name="Default">
|
||||
<style:text-properties fo:color="#0000FF" fo:font-family="Courier" fo:font-size="14.0pt" />
|
||||
<style:table-cell-properties style:rotation-align="none" fo:background-color="#ff0000" />
|
||||
<style:style style:family="table-cell" style:name="ce8" style:parent-style-name="Default">
|
||||
<style:text-properties fo:color="#0000FF" fo:font-family="Courier" fo:font-size="14.0pt"/>
|
||||
<style:table-cell-properties style:rotation-align="none" fo:background-color="#ff0000"/>
|
||||
</style:style>
|
||||
<style:style style:name="ce9" style:family="table-cell" style:parent-style-name="Default">
|
||||
<style:text-properties fo:color="#0000FF" fo:font-family="Courier" fo:font-size="14.0pt" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" style:text-underline-type="single" />
|
||||
<style:table-cell-properties style:rotation-align="none" fo:background-color="#ff0000" />
|
||||
<style:style style:family="table-cell" style:name="ce9" style:parent-style-name="Default">
|
||||
<style:text-properties style:text-underline-color="font-color" style:text-underline-style="solid" style:text-underline-type="single" style:text-underline-width="auto" fo:color="#0000FF" fo:font-family="Courier" fo:font-size="14.0pt"/>
|
||||
<style:table-cell-properties style:rotation-align="none" fo:background-color="#ff0000"/>
|
||||
</style:style>
|
||||
<style:style style:name="ce10" style:family="table-cell" style:parent-style-name="Default">
|
||||
<style:text-properties fo:color="#000000" fo:font-family="Calibri" fo:font-size="11.0pt" style:text-underline-style="solid" style:text-underline-width="auto" style:text-underline-color="font-color" style:text-underline-type="double" />
|
||||
<style:table-cell-properties style:rotation-align="none" />
|
||||
<style:style style:family="table-cell" style:name="ce10" style:parent-style-name="Default">
|
||||
<style:text-properties style:text-underline-color="font-color" style:text-underline-style="solid" style:text-underline-type="double" style:text-underline-width="auto" fo:color="#000000" fo:font-family="Calibri" fo:font-size="11.0pt"/>
|
||||
<style:table-cell-properties style:rotation-align="none"/>
|
||||
</style:style>
|
||||
</office:automatic-styles>
|
||||
<office:body>
|
||||
<office:spreadsheet>
|
||||
<table:calculation-settings />
|
||||
<table:calculation-settings/>
|
||||
<table:table table:name="Worksheet">
|
||||
<office:forms />
|
||||
<table:table-column table:number-columns-repeated="1024" />
|
||||
<office:forms/>
|
||||
<table:table-column table:number-columns-repeated="1024"/>
|
||||
<table:table-row>
|
||||
<table:table-cell table:style-name="ce2" office:value-type="float" office:value="1">
|
||||
<table:table-cell office:value="1" office:value-type="float" table:style-name="ce2">
|
||||
<text:p>1</text:p>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:style-name="ce3" office:value-type="float" office:value="12345.6789">
|
||||
<table:table-cell office:value="12345.6789" office:value-type="float" table:style-name="ce3">
|
||||
<text:p>12345.6789</text:p>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:style-name="ce9" office:value-type="float" office:value="1">
|
||||
<table:table-cell office:value="1" office:value-type="float" table:style-name="ce9">
|
||||
<text:p>1</text:p>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:style-name="ce0" office:value-type="string">
|
||||
<table:table-cell office:value-type="string" table:style-name="ce0">
|
||||
<text:p>01234</text:p>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:style-name="ce0" office:value-type="string">
|
||||
<table:table-cell office:value-type="string" table:style-name="ce0">
|
||||
<text:p>Lorem ipsum</text:p>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:number-columns-repeated="1019" />
|
||||
<table:table-cell office:string-value="" office:value-type="string" table:formula="of:=#NULL!" table:style-name="ce0">
|
||||
<text:p>#NULL!</text:p>
|
||||
</table:table-cell>
|
||||
<table:table-cell office:value-type="string" table:style-name="ce0">
|
||||
<text:p>Lorem ipsum</text:p>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:number-columns-repeated="1017"/>
|
||||
</table:table-row>
|
||||
<table:table-row>
|
||||
<table:table-cell table:style-name="ce0" office:value-type="boolean" office:value="1">
|
||||
<table:table-cell office:value="1" office:value-type="boolean" table:style-name="ce0">
|
||||
<text:p>1</text:p>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:style-name="ce0" office:value-type="boolean" office:value="">
|
||||
<text:p></text:p>
|
||||
<table:table-cell office:value="" office:value-type="boolean" table:style-name="ce0">
|
||||
<text:p/>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:style-name="ce10" table:formula="of:=IF([.A3]; CONCATENATE([.A1]; " "; [.A2]); CONCATENATE([.A2]; " "; [.A1]))" office:value-type="string" office:value="1 1">
|
||||
<table:table-cell office:value="1 1" office:value-type="string" table:formula="of:=IF([.A3]; CONCATENATE([.A1]; " "; [.A2]); CONCATENATE([.A2]; " "; [.A1]))" table:style-name="ce10">
|
||||
<text:p>1 1</text:p>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:style-name="ce1" office:value-type="float" office:value="42798.572060185">
|
||||
<table:table-cell office:value="42798.572060185" office:value-type="float" table:style-name="ce1">
|
||||
<text:p>42798.572060185</text:p>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:style-name="ce0" />
|
||||
<table:table-cell table:number-columns-repeated="1019" />
|
||||
<table:table-cell table:style-name="ce0"/>
|
||||
<table:table-cell table:style-name="ce0"/>
|
||||
<table:table-cell table:style-name="ce0"/>
|
||||
<table:table-cell table:number-columns-repeated="1017"/>
|
||||
</table:table-row>
|
||||
</table:table>
|
||||
<table:table table:name="New Worksheet">
|
||||
<office:forms />
|
||||
<table:table-column table:number-columns-repeated="1024" />
|
||||
<office:forms/>
|
||||
<table:table-column table:number-columns-repeated="1024"/>
|
||||
<table:table-row>
|
||||
<table:table-cell table:style-name="ce0" office:value-type="float" office:value="2">
|
||||
<table:table-cell office:value="2" office:value-type="float" table:style-name="ce0">
|
||||
<text:p>2</text:p>
|
||||
</table:table-cell>
|
||||
<table:table-cell table:number-columns-repeated="1023" />
|
||||
<table:table-cell table:number-columns-repeated="1023"/>
|
||||
</table:table-row>
|
||||
</table:table>
|
||||
<table:named-expressions />
|
||||
<table:named-expressions/>
|
||||
</office:spreadsheet>
|
||||
</office:body>
|
||||
</office:document-content>
|
||||
Loading…
Reference in New Issue