In LO Writer, I want to use a <field> that enters the file name without the file extension.

I am trying to display only the saved file name on an inserted field in a document without the file extension. However every time I select the option in the Insert>Fields>More Fields>file name>file name without extension it displays the file extension in the field with the file name when I reopen the document. I am saving in .docx (Word 2007-365) format, so I don’t know if that is the problem or not. It might be a bug, I don’t seem to have this problem with other file formats.

Example:

Saved file name = HSR-23 Hand Washing.docx

Desired outcome on document in the field following above insert formatting: HSR-23 Hand Washing

LibreOffice display: HSR-23 Hand Washing.docx

Version 7.0.4.2
Thank you in advance for your assistance!

Do you have a Word? Have you tried inserting such a field - the file name without the extension - into the DOC file? Did you succeed? Please tell us how you achieved this.

Not sure what your comment is asking…I tried saving the file in every MSWord format, and every time I use the field “file name without extension” the extension is shown on the document. I have saved several documents in the past years with the same method, and I think it scrubbed off the extension. Maybe I am mistaken on that. Regardless in this version of L.O. Writer, the auto populated field (insert>field>more field>file name>file name without extension) does NOT scrub off the extension for me, as the field describes. Hope this helps clarify.

@IT4ccfd Okay, I’ll explain without hints, in plain text. I created in Word and saved a test document, selected Insert, insert Field. Among all the possible fields (there are a lot of them in the MC), I found two related to the file name. None of them have the additional “no extension” option. When inserting the field, the file name with the extension is displayed. In other words, the Word itself (and, accordingly, its native files) do not do what the Writer can do.

@Astur Yes, you are right, this can be called a “bug”. But LibreOffice has nothing to do with this bug.

Inconclusive test, but interesting:
I saved a document using the dropdown menu selection ‘Word 2007-365’, but DID NOT check ‘Automatic File Name Extension’. This saved the file, without any file extension (i.e. docx, doc, odt). When I tried to open the saved file, I had to manually choose what application I wanted to use to open it. I selected L.O. Writer. When the document was opened/displayed, the file name field did not display any extension. So, while this might be a work around until any potential bug is corrected, it adds another step to open the file, having to manually select the application you want to open it.

I then added a duplicate field to the document (file name w/o extension). However, this time when I saved it, I checked the box for 'Automatic File…". This immediately changed the original field and displayed the file ext; now file ext are on both fields on the document. Also, it obviously saved it in an easily openable format.
Looks like a bug

Thanks for the comments…looks like a MS Word situation.

There is a tacky workaround, cover the extension with a white rectangle. I’m not proud of it but I had to do this a couple of times when I was using Word. If you don’t know what the filename will be, then it works best if the filename is right-aligned.