I am trying to insert the date into a letter as part of a larger macro. I would like to format by date “mmmm d, yyyy” (e.g. March 6, 2013). I have the following code which works perfectly except I don’t know the NumberFormat for the desired date format.
Sub Main
Dim Doc As Object
Dim DateTimeField As Object
Dim Cursor As Object
Doc = ThisComponent
Cursor = Doc.Text.createTextCursor()
DateTimeField = Doc.createInstance("com.sun.star.text.textfield.DateTime")
DateTimeField.IsFixed = False
DateTimeField.IsDate = True
DateTimeField.NumberFormat = 84
Doc.Text.insertTextContent(Cursor, DateTimeField, False)
End Sub
The code “84” above will give the date in the ISO8601 format (learned from a random forum post) but not the format I want. The LibreOffice API website lists this optional property but gives no clue as to what the codes are, from what I can tell they are specific only to LibreOffice.
http://api.libreoffice.org/docs/common/ref/com/sun/star/text/textfield/DateTime.html
At this point I have scoured Google with absolutely no success, thanks for any help you can provide.