First get the current cursor position by the documents "getCurrentController" function. Next use the documents "XMultiServiceFactory" interface to create a new "DateTime" object. Configurate this object by setting its properties. To set the date, first a structure of type "Locale" must be created. This structure defines the language for the number format. Next create a string defining the format of the date and use it and the locale structure to search for an existing entry in the documents NumberFormats list. If no such number format exists, create a new one. In both cases an index number is returned, which is set as "NumberFormat" property of the date time object. As last step add the date object as text content to the Writer document. For further details see http://wi.wu-wien.ac.at/rgf/diplomarbeiten/BakkStuff/2008/200809_Frysak/200809_Frysak_Automating_OOo_ooRexx_Nutshells.pdf. |