How to on open Writer document form Date Field display current (OS) date? (The document is opened from template.) I can set “Default date” but it’s static date. I’d like to provide current date to document user so she/he can leave it or change it.
Thanks to Villeroy → [Solved] Date Field can’t set date I managed to set it via macro:
Sub SetDefaultDate(ByVal DateFieldName As String)
oForm = ThisComponent.drawpage.forms(0)
oElm = oForm.getByName(DateFieldName)
strDigits = CDateToIso( Date() )
oDate = createUnoStruct("com.sun.star.util.Date")
oDate.Year = cInt(left(strDigits,4))
oDate.Month = cInt(mid(strDigits,5,2))
oDate.Day = cInt(right(strDigits,2))
oElm.Date = oDate
End Sub
Sub TestSetDefaultDate
SetDefaultDate("Date Field 1")
End Sub