Set default extension for plain text files?

I like this resource for its tolerance and willingness to help anyone who asks. StackOverflow blocked the question in 20 minutes - it seemed to some snob that the issues of convenient use of LibreOffice were not interesting to the community. Therefore, I duplicate this question here and give one of the solutions. Perhaps some of you colleagues will suggest another way.

Is it possible to change the behavior of LibreOffice so that when I save a non-plain (.odt or .docs) file as plain text via File->Save As..., it always sets the filename extension to .plain instead of .txt, without me having to change the extension manually afterwards?

Why not? Store simple macro to My Macros/Standard:

Sub SaveAsPlainText()
Const FILE_EXTENTION = ".plain"
Dim oStoreDialog As Object
Dim ListAny(0) As Long
Dim args(0) As New
Dim sFileName As String 
	ListAny(0) =
	oStoreDialog = CreateUnoService("")
	oStoreDialog.AppendFilter("Plain text (" & FILE_EXTENTION & ")", FILE_EXTENTION)
	sFileName = ThisComponent.getURL()
	If sFileName <> "" Then oStoreDialog.SetDefaultName(GetFileNameWithoutExtension(ThisComponent.getURL(),"/"))
	oStoreDialog.setValue(,0, true)
	If oStoreDialog.Execute() <> 1 Then Exit Sub 
	args(0).Name = "FilterName"
	args(0).Value = "Text"
End Sub

Now just go to menu Tools - Customize - Toolbars tab and set this macro as button on your Standard panel


Thank you very much! As a LibreOffice newbie who is completely new to macros, I would not call this solution ‚Äėsimple‚Äô! One nitpick: your macro saved the plaintext file in my home directory; to save it in the same directory as the original file, I replaced ‚ÄėThisComponent.getURL(),"/"‚Äô with ‚ÄėThisComponent.getLocation()‚Äô.

My code is missing the oStoreDialog.SetDisplayDirectory("<directory>") line - you can set this value to your liking. For example, using the FileNameOutOfPath() function

Uncheck ‚Äúautomatic file name extension‚ÄĚ and enter the full name with trailing .plain.
Glitch: Next time you should check this option again.