Macros/Writer/001

Description
This tutorial covers how to write a macro for Writer that inserts a custom comment at the cursor position (in order to for example preset the Author and/or Date fields).

We use ''' com.sun.star. text.XTextViewCursor and  com.sun.star. text.textfield.Annotation services as well as the  com.sun.star. util.DateTime''' structure to obtain a time-stamp from the time of execution.

Code
The following macro, which could for instance be linked with a keyboard shortcut, inserts a custom comment at the current cursor position:

Using Python:

Time-stamp calculation is not performed in these examples.