ODS: extract error value from cell
ODS doesn't support errors as a type, and stores errors as text, which depends on locale and application. And, I think, it should have higher priority, that extracting value from office:value (<table:table-cell office:value-type="float" office:value="0" table:formula="of:=#N/A" table:style-name="ce1"><text:p>#N/A</text:p></table:table-cell>).
LibreOffice:
Microsoft Office Online:
Hi, I'm not sure what you're suggesting? Where did you find information about the actual behavior (about locale etc)?
I saved example file using LibreOffice with deutsche interface - errors_de.ods. There is part of content.xml of this file below:
<table:table table:name="Sheet1" table:style-name="ta1"><table:table-column table:style-name="co1"
table:default-cell-style-name="Default" /><table:table-row table:style-name="ro1"><table:table-cell
table:formula="of:=1/0" office:value-type="string" office:string-value="" calcext:value-type="error">
<text:p>#DIV/0!</text:p>
</table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell
table:formula="of:=NA()" office:value-type="string" office:string-value="" calcext:value-type="error">
<text:p>#NV</text:p>
</table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell
table:formula="of:=xyz/3" office:value-type="string" office:string-value="" calcext:value-type="error">
<text:p>#NAME?</text:p>
</table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell
table:formula="of:=SUM([.B1] [.C1])" office:value-type="string" office:string-value=""
calcext:value-type="error">
<text:p>Fehler:509</text:p>
</table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell
table:formula="of:=ASIN(123)" office:value-type="string" office:string-value="" calcext:value-type="error">
<text:p>#ZAHL!</text:p>
</table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell
table:formula="of:=OFFSET([.A1];0;20000)" office:value-type="string" office:string-value=""
calcext:value-type="error">
<text:p>Fehler:502</text:p>
</table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell
table:formula="of:=1+"ABC"" office:value-type="string" office:string-value=""
calcext:value-type="error">
<text:p>#WERT!</text:p>
</table:table-cell></table:table-row></table:table>
and with english interface - errors_en.ods:
<table:table table:name="Sheet1" table:style-name="ta1"><table:table-column table:style-name="co1"
table:default-cell-style-name="Default" /><table:table-row table:style-name="ro1"><table:table-cell
table:formula="of:=1/0" office:value-type="string" office:string-value="" calcext:value-type="error">
<text:p>#DIV/0!</text:p>
</table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell
table:formula="of:=NA()" office:value-type="string" office:string-value="" calcext:value-type="error">
<text:p>#N/A</text:p>
</table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell
table:formula="of:=xyz/3" office:value-type="string" office:string-value="" calcext:value-type="error">
<text:p>#NAME?</text:p>
</table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell
table:formula="of:=SUM([.B1] [.C1])" office:value-type="string" office:string-value=""
calcext:value-type="error">
<text:p>Err:509</text:p>
</table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell
table:formula="of:=ASIN(123)" office:value-type="string" office:string-value="" calcext:value-type="error">
<text:p>#NUM!</text:p>
</table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell
table:formula="of:=OFFSET([.A1];0;20000)" office:value-type="string" office:string-value=""
calcext:value-type="error">
<text:p>Err:502</text:p>
</table:table-cell></table:table-row><table:table-row table:style-name="ro1"><table:table-cell
table:formula="of:=1+"ABC"" office:value-type="string" office:string-value=""
calcext:value-type="error">
<text:p>#VALUE!</text:p>
</table:table-cell></table:table-row></table:table>
(#ZAHL! and #NUM!, #WERT! and #VALUE!). Also, as I see, LibreOffice and Excel use different codes in some cases (Err:502 and #REF!, for example).
Hi, I'm not sure what you're suggesting?
I don't know. I see only one decision: store all localized values of errors and check text value of cell if table:formula is presented, but I think it will be bad for performance.
I see only one decision: store all localized values of errors and check text value of cell if table:formula is presented, but I think it will be bad for performance.
I think we can always have feature flag to mitigate performance:
const N_ERR: usize = 7; // can't remember how many of them we have
const ODS_LOCALE_ERR: &[[&'str; N_ERR]] = &[
#[cfg(feature = "ods-err-us")]
[....],
#[cfg(feature = "ods-err-de")]
[....],
]
And default to only have ods-err-us?