Description: This bug affects 5.2.X (probably previous versions too) and can is reproducible on Master. When you open a docx embedding formula which set the value of a bookmark (like "Set mybookmark 12"), LibreOffice displays 12 whereas it shouldn't display anything at all since it's a value affectation. Steps to Reproduce: 1. Open MSOffice and type the sentence "This is my test" 2. Select "is" and go to "Insert > Bookmark" 3. Name the bookmark "BM" and click "Add" 4. Select "my" and go to "Insert > QuickPart > Field" and click on "Formula" 5. Remove the "=" and type "SET BM 12", selected "my" disappears. 6. Put your cursor at line end (just after "test") and go to "Insert > QuickPart > Field" and click on "Formula" 7. Enter the formula "=INT(BM)" 8. "12" in now displayed after "test" 9. Save the file as ".docx" and open it with LibreOffice Actual Results: This is 12test12 Expected Results: This is test12 The formula "SET BM 12" displays "12", it shouldn't. Reproducible: Always User Profile Reset: No Additional Info: User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:51.0) Gecko/20100101 Firefox/51.0
Created attachment 131171 [details] Result file of the defined procedure
This bug affects 4.3.5.2 too. Probably all LibreOffice versions are concerned by this bug.
Jean-Sebastien: you assigned yourself the bugtracker, do you want to fix it yourself? If yes, please put Status to ASSIGNED instead of UNCONFIRMED, otherwise unassign yourself.
Yes I'm working on it. LibreOffice doesn't set the field as "field", it may be the problem.
After a lot of digging, it's not a bug, it's an unimplemented feature. 2 features are missing: parsing of SET property and parsing of FORMULA property (starting with =). So I will write 2 patches, one for each features. Jean-Sébastien Bevilacqua
I have implemented the first feature (SET): https://gerrit.libreoffice.org/#/c/34333
I have implemented the 2nd feature (FORMULA) but it's not fully working and I need help to make it work. Take a look at the attachment lo_formula.docx. With this patch, it should display the result of the formula but instead, it displays the formula. If you update the format of the field to Name and update it again to Standard, it makes it work. Patch gerrit: https://gerrit.libreoffice.org/#/c/34334/
Created attachment 131267 [details] Formula patch error example
(In reply to Jean-Sebastien Bevilacqua from comment #7) > I have implemented the 2nd feature (FORMULA) but it's not fully working and > I need help to make it work. Take a look at the attachment lo_formula.docx. >... Don't hesitate to ask for some help on IRC #libreoffice-dev (see https://wiki.documentfoundation.org/Website/IRC) or on dev mailing list http://nabble.documentfoundation.org/Dev-f1639786.html
Jean-Sebastien Bevilacqua committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=4d5ce76d894d2335b551f8c2b29437e2049894f0 tdf#105975 Add Set field parsing (docx) in LibreOffice Writer It will be available in 5.4.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Jean-Sebastien Bevilacqua committed a patch related to this issue. It has been pushed to "master": http://cgit.freedesktop.org/libreoffice/core/commit/?id=c568eb7d3bb4584867f0a1f0a7965f73097f009b tdf#105975 Add Formula field parsing (docx) in SWriter It will be available in 5.4.0. The patch should be included in the daily builds available at http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More information about daily builds can be found at: http://wiki.documentfoundation.org/Testing_Daily_Builds Affected users are encouraged to test the fix and report feedback.
Ok