Bug 144651 - Field using ROUND formula works in MS Office but broken in LibreOffice
Summary: Field using ROUND formula works in MS Office but broken in LibreOffice
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Word-Count
  Show dependency treegraph
 
Reported: 2021-09-21 21:41 UTC by Stéphane Guillou (stragu)
Modified: 2022-12-27 18:24 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
example DOTX to test bug (19.54 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.template)
2021-09-21 21:45 UTC, Stéphane Guillou (stragu)
Details
same example document, with 588 words (25.63 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.template)
2022-12-27 18:22 UTC, Stéphane Guillou (stragu)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stéphane Guillou (stragu) 2021-09-21 21:41:16 UTC
Description:
A field that shows the document's number of words rounded to the closest 100 in MS Office shows instead the number of words with an extra 0 in LibreOffice.

The formula used for the field is "ROUND(|-2)".

Steps to Reproduce:
1. Open attached DOTX file
2. Add some text in the body

Actual Results:
The word count field displays the number of words with an extra 0 (for example, if the document has 99 words, it says "990 words").

Expected Results:
The word count displays the number of words rounded to the closest 100 (for example, if the document has 99 words, it says "100 words").


Reproducible: Always


User Profile Reset: No



Additional Info:
One might have to update the fields with Ctrl + A and F9 to make sure the word count field is current.

Template works as expected in MS Office .

Reproduced in:

Version: 7.2.1.2 (x64) / LibreOffice Community
Build ID: 87b77fad49947c1441b67c559c339af8f3517e22
CPU threads: 8; OS: Windows 10.0 Build 19043; UI render: default; VCL: win
Locale: en-AU (en_AU); UI: en-US
Calc: threaded

and

Version: 7.0.6.2
Build ID: 00(Build:2)
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Ubuntu package version: 1:7.0.6-0ubuntu0.18.04.1_lo1
Calc: threaded

and

Version: 7.3.0.0.alpha0+ / LibreOffice Community
Build ID: 3749d9af3745c0eaff7239e379578e4e2af89e9d
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2021-09-09_07:27:56
Calc: threaded
Comment 1 Stéphane Guillou (stragu) 2021-09-21 21:45:20 UTC
Created attachment 175184 [details]
example DOTX to test bug

This DOTX file contains the field with the custom formula.
It comes from a collection of templates by Robert Kingett:

https://github.com/rkingett/writertools/releases
Comment 2 Dieter 2021-10-07 19:15:59 UTC
I confirm the behaviour with

Version: 7.2.1.2 (x64) / LibreOffice Community
Build ID: 87b77fad49947c1441b67c559c339af8f3517e22
CPU threads: 4; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: de-DE (de_DE); UI: en-GB
Calc: CL

Word count field should disply "7" but displays "70"

But if you display field names (Strg+F9) you can see that there are two fields: "Statistics" and "ROUND(|-2)"

I can't compare with Word 2016, because I get a Syntax Error

So not sure for 100%, if it is a bug or not.
Comment 3 Xisco Faulí 2021-10-22 09:30:42 UTC
@NISZ Team, I thought you might be interested in this issue
Comment 4 raal 2022-02-16 19:22:41 UTC
With word 2010 I get "!Syntax error" in the field.

@Xisco, do you have actual version of Word?
Comment 5 Dieter 2022-02-16 19:26:23 UTC
Stragu, which version of MS Word do you use?
Comment 6 Maison 2022-03-22 20:45:50 UTC Comment hidden (spam)
Comment 7 Stéphane Guillou (stragu) 2022-03-23 15:03:17 UTC
Version of MS Word is:

Microsoft 365 Apps for enterprise
Version 2202 (Build 14931.20132 Click-to-Run)
Comment 8 Buovjaga 2022-12-21 11:16:17 UTC
Both with the latest and 7.0 I just see 00 and it does not update when adding words. Office.com opens the file as read only and I don't know how to change that.

Arch Linux 64-bit, X11
Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 8389048cb41291917449e87b2901d6133bce3373
CPU threads: 8; OS: Linux 6.0; UI render: default; VCL: kf5 (cairo+xcb)
Locale: fi-FI (fi_FI.UTF-8); UI: en-US
Calc: threaded Jumbo
Built on 21 December 2022
Comment 9 Xisco Faulí 2022-12-21 11:21:19 UTC
Word 2016 always shows 0 when text is added
Comment 10 Stéphane Guillou (stragu) 2022-12-27 18:22:10 UTC
Created attachment 184370 [details]
same example document, with 588 words

Using MS Word and showing the syntax with "right click > toggle field codes":

{ =ROUND({ NUMWORDS },-2) }

One needs to add dozens of words and then Ctrl + A, F9 to update the field and see a change. (Or right-click on the field and "update field".)

In a new version of the document with many words added (588 words in this new attachment), saved with MS Word, one can see that LO splits the formula into the "Statistics - Words" field (a simple word count, which does update with Tools > Update > Update all) directly followed by the static "ROUND(|-2)" field, showing the value "600" last calculated by Word.

Word version:

Microsoft® Word for Microsoft 365 MSO (Version 2211 Build 16.0.15831.20098) 64-bit

LO version:

Version: 7.6.0.0.alpha0+ (X86_64) / LibreOffice Community
Build ID: 29c2bba1f3ef216d226c97197185066880fc1ab5
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-AU (en_AU.UTF-8); UI: en-US
Calc: threaded
Comment 11 Stéphane Guillou (stragu) 2022-12-27 18:24:06 UTC
Same in:

OpenOffice.org 3.3.0
OOO330m20(Build:9567)