<html>
<head>
<base href="https://bugs.documentfoundation.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_UNCONFIRMED "
title="UNCONFIRMED - Numeric format inconsistency: Macros vs Writer fields, formula calculation fails"
href="https://bugs.documentfoundation.org/show_bug.cgi?id=123878">123878</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>Numeric format inconsistency: Macros vs Writer fields, formula calculation fails
</td>
</tr>
<tr>
<th>Product</th>
<td>LibreOffice
</td>
</tr>
<tr>
<th>Version</th>
<td>6.2.0.3 release
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>All
</td>
</tr>
<tr>
<th>Status</th>
<td>UNCONFIRMED
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>medium
</td>
</tr>
<tr>
<th>Component</th>
<td>Extensions
</td>
</tr>
<tr>
<th>Assignee</th>
<td>libreoffice-bugs@lists.freedesktop.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>jsd.libreoffice@bvac.co.za
</td>
</tr></table>
<p>
<div>
<pre>[Sorry if Extensions component is wrong, wasn't sure what to pick]
Running LO 6.2.0.3 on MacOS 10.13.6 in South Africa, where system regional
setting uses comma rather than period for decimal separator.
Writer treats strings with period, eg "1.5" as non-numeric and evaluates that
as 0. With a comma instead, eg "1,5" the value is one-and-a half. OK, fair
enough.
Now I have a macro that extracts a value from a spreadsheet cell, and sets that
value into a Writer variable field which is then used elsewhere in a Writer
formula.
The latter formula does not compute correctly - result is 0 - because the
extracted spreadsheet value (a floating point number, type Variant/Double
returned by RangeTLCellValue) gets turned into a string with a period for
decimal point in the Writer variable field (DependentTextField.Content =
myNumericValue)
Either the implicit double-to-string conversion should be using the same
punctuation that's expected elsewhere (so comma not period) or else everything
should accept a period as decimal separator in number strings, and then do the
local-dependent presentation only at the formatting stage (which is what
OpenOffice used to do: this macro began life there).
FWIW I tried changing Language settings in the document, made no difference.
Presumably the system locale trumps that for number parsing. This also
affected static "set variable" fields in the template: I had to change decimal
periods to commas in those too, to make the formulas work.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>