Created attachment 146874 [details] Document with code and button to reproduce the problem If you create a user field in a macro where the name contains a space, the more fields dialog will not let you edit or delete the field. Code to reproduce the bug: vDoc = ThisComponent sName = "My Field" If vDoc.getTextFieldMasters().hasByName("com.sun.star.text.FieldMaster.User." & sName) Then vField = vDoc.getTextFieldMasters().getByName("com.sun.star.text.FieldMaster.User." & sName) vField.Content = "My Field Text" Else vField = vDoc.createInstance("com.sun.star.text.FieldMaster.User") vField.Name = sName vField.Content = "My Field Text Update" End If
reproducible, the "name" edit field shows only the first part of the fieldname, e.g. "My" instead "My Field"
Reproduced back to LibreOffice 3.3.0 OOO330m19 (Build:6) tag libreoffice-3.3.0.4 The Field dialog doesn't allow to insert spaces. I guess the solution should be to replace spaces with another char when using macros...
btw: there is a similar issue for named ranges in calc: inserting named ranges with special characters, e.g. operators ':', '+', ... in name are allowed via api https://bugs.documentfoundation.org/show_bug.cgi?id=119457
According to the documentation in http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1419030_253892949 the name can be any variableName, which is "a string specifying the name of a variable". The check in the dialog was inserted in the following commit https://github.com/LibreOffice/core/commit/4b920e0b45a42c55503dc03a7297733fb2cfb2a3, but unfortunately I cannot find the mentioned bug. There even exists a file in https://git.libreoffice.org/core/+/f2039cdbd827d60b8e0dbfa2e1d02dbb276514d6%5E%21 which contains user fields including whitespaces and does get validated using a odf validator. So we may allow whitespaces, and validate the field name when inserted via api.
The only problem I see is that if a user opens a document containing field names including forbidden characters, they will be silently replaced? The same happens, if they are added via api.
Tested now with a fix which tries to convert all the non allowed characters to underscores, but a couple of test documents contain user fields with special chars like whitespaces, backslashes etc. Since the ODF allows user fields with strings, mabye we should change just the dialog edit field? Any opinions?
Good job guys ... appreciate all your efforts!
Just checking for an update and read my last post. Apologies, comes across as patronising which wasn't my intent.
Unfortunately, I cannot decide whether we allow all kind of chars in a user field, and restricting it breaks some existing tests.
I believe the text field in the UI should allow the user to change whatever text the field contains. Manipulating the text to satisfy the text fields shortcommings, in my mind, will lead to all kinds of problems.
My problem is what kind of user fields should be allowed and which regressions (display errors arise)? Some examples (without quotes: " a user field" " " "@#$%user field" "Öäüßvşîťë" The odf-standard defines a user named range as a string which imho allows any combination of chars.
Dear libreoffice, To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug