I wish to write a macro that will change the default filename in the SaveAs dialogue in Writer. It will be part of a template, so the “Untitled 1” gets changed to something more meaningful.
I have found several relevant properties on `ThisComponent` but they all read-only.
Sample code
sub Main ()
dim oDoc as object
oDoc=ThisComponent
print (oDoc.Location)
‘ Works correctly to here but next line crashes
oDoc.Location = "New title"
end sub
The error dialogue says:
Read Error.
This property is read-only.
It’s the same for these properties:
-
StringValue
-
Namespace
-
LocalName
-
Location
-
URL
It’s the same regardless of a simple name, or a URL (like “file:///full/path/New%20Filename.odt/”);
I am using Linux Mint and LibreOffice 26.2.4.2 .
How can I change the default filename?
I have seen LibreOffice Writer: How to set the author document property to an author other than myself? which suggests running an external command – that seems more trouble than it is worth.