Created attachment 149221 [details] Simplier Average formula Description: AVERAGE table formula has Expression is faulty when opened in LO. Steps to Reproduce: 1. Create a new docx in Word. 2. Insert a Table. 3. Insert AVERAGE() formula to some of the cells. 4. Save and open it in LO. Actual Results: The cells which had and AVERAGE formula now have ** Expression is faulty ** instead of what was in them in Word. Expected Results: All the cells should have the same data in them. Reproducible: Always User Profile Reset: No Additional Info: LibreOffice details: Version: 6.3.0.0.alpha0+ Build ID: 17dd2662ccfa9d04efbea74e5d7548db5b2126d4 CPU threads: 4; OS: Windows 6.1; UI render: default; VCL: win; Locale: hu-HU (hu_HU); UI-Language: en-US Calc: threaded
I can think of two possible solutions to this, one is to add an AVERAGE function that is a synonym for MEAN; the other is to just replace calls to AVERAGE with calls to MEAN on import. Are there any strong opinions on which way to go?
I would prefer to convert the function during import/export. Writer has its own proprietary formula syntax. In the long run I wish we could switch to the Open Formula syntax used in Calc. Introducing new functions in Writer would not be a step in that direction.
(In reply to Regina Henschel from comment #2) > I would prefer to convert the function during import/export. Writer has its > own proprietary formula syntax. In the long run I wish we could switch to > the Open Formula syntax used in Calc. I agree with you on the long-term goal of making Writer syntax match that of Calc. To take it a step further I think that long-term, Writer table formulas should probably be calculated with the same code as used in Calc. It seems redundant to me for each application to have its own code (and incompatible syntax) for this. > Introducing new functions in Writer would not be a step in that direction. Can you explain more of this perspective? AVERAGE, SIGN[1], and ABS[2] are all functions in Calc, so adding them as functions in Writer would seem like it is a step in that direction, to me. [1] https://bugs.documentfoundation.org/show_bug.cgi?id=123390 [2] https://bugs.documentfoundation.org/show_bug.cgi?id=123354
I have added AVERAGE to Writer formula parser as an alternative name of MEAN: https://gerrit.libreoffice.org/c/core/+/101336 In DOCX export, also added MEAN->AVERAGE conversion. I don't want to replace MEAN with AVERAGE on the UI, because that could break back-compatibility more often, than needed. The plan is only an interoperability extension of Writer's original formula language. I'm going to add ABS, SIGN, COUNT, too. It's possible to implement OpenFormula (text:formula), as an alternative future table formula language of Writer using Calc by UNO XFormulaParser, XFunctionAccess or with a hidden spreadsheet document, but OpenFormula is not the only formula language used by Calc, according to back-compatibility and interoperability issues, see https://api.libreoffice.org/docs/idl/ref/namespacecom_1_1sun_1_1star_1_1sheet_1_1FormulaLanguage.html
László Németh committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/core/commit/c31b436c86c0d4d287725708732c14357ed5583a tdf#123401 DOCX: fix table formula AVERAGE It will be available in 7.1.0. The patch should be included in the daily builds available at https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: https://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Verified in Version: 7.1.0.0.alpha0+ Build ID: e2f4e65a7b8024c00b049eebf0d87637efda7f24 CPU threads: 4; OS: Linux 4.19; UI render: default; VCL: gtk3 Locale: en-US (en_US.UTF-8); UI: en-US Calc: threaded @László Németh, thanks for fixing this issue!!