Custom Date & Time Fields for OpenOffice.org Writer

Forum rules
No question in this section please
For any question related to a topic, create a new thread in the relevant section.
Post Reply
lusguz
Posts: 1
Joined: Fri Sep 24, 2010 8:37 pm

Custom Date & Time Fields for OpenOffice.org Writer

Post by lusguz »

For those of us accustomed to WordPerfect, creating a custom time-date field in three clicks and entering it thereafter in two makes it easy to generate a date/time stamp such as "Monday, January 1, 2011 1:23pm". This can also be accomplished in Writer, albeit via a 40-step process, after which the custom format can be entered with a single keystroke. The procedure:

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
1) To Create & insert a custom date/time format:

The format I want to use is: Friday, September 24, 2010 11:09AM
The “Format Code” for this format is: NNNNMMMM D, YYYY h:mmam/pm

To assign this format, open any document & click on:

Insert, Fields, Other, Date (Fixed), Additional Formats, then Copy & Paste the following format in the “Format Code” box:
NNNNMMMM D, YYYY h:mmam/pm

Click on the green checkmark, click “OK”, click “Insert”, click “Close”

This gets inserted in the open document:

Friday, September 24, 2010 11:09AM

2)Now create a Macro to reproduce the above:

Click on Tools, Macros, Record Macro, Record,

Insert, Fields, Other, Date (fixed), Additional Format,
scroll down & select custom format, OK, Insert, Close, Stop Recording

In "Macro Name" box enter "DateTime", click Save.

(3) Now assign the Macro a Shortcut Key:

Click on Tools, Customize, Keyboard Tab, under “Category” scroll down to “OpenOffice.org” and click on “+” sign (so that it turns to “-”); click “+” for “User”, “+” for “Standard”; click on “Module 1”. “DateTime” (or whatever you named the Macro) will be highlighted. Above this entry, in the white box to the upper left labeled “Shortcut Keys”, “F4” will be the first unassigned entry. Click on it to highlight, then click “Modify”. In the dialog box which appears type in “DateTime” as “Name”, then click on “Save” (noting that you are saving a keyboard configuration file to your “Documents” folder). Click on “OK” to return to the document, then press “F4” to test your work.

SAVE THE DOCUMENT WITH A NAME LIKE “TEMPLATE”. Now close it.

Now open a new document. Press “F4”. You'll find something on the order of “40445.49” inserted instead of your custom Date/Time. If you re-open the “template” document, however, you can save a copy, edit it, re-save, and continue to produce an unlimited number of “child documents” which will retain the custom date/time format. And I'm sure there's a way to apply the format universally...but I don't have time to figure it out.

PS: If anybody knows a simpler way to do this, email me: xxxxxxx

E-mail removed, nobody will reply by mail and it will avoid spam bots to register your address (Hagar, Moderator).
OpenOffice 3.2 on Ubuntu 10.04.1
User avatar
Hagar Delest
Moderator
Posts: 32627
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Custom Date & Time Fields for OpenOffice Writer

Post by Hagar Delest »

Hi and welcome to the forum!

See: [Issue] Default date format (Issue 30216). Several hints and workarounds, including a macro.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Custom Date & Time Fields for OpenOffice.org Writer

Post by acknak »

You can also assign the formatted date/time fields to an autotext with a two-letter shortcut. The autotexts are available at the application level, so you don't need a template document.
AOO4/LO5 • Linux • Fedora 23
User avatar
himagain
Posts: 20
Joined: Wed Oct 29, 2008 5:43 am
Location: OZ (Australia)

Re: Custom Date & Time Fields for OpenOffice.org Writer

Post by himagain »

Hi acknak,
this formatting info was from a long time ago - I just came across it now. Could you point me to more on your solution? I can't see how it could be done.

Cheers!
CENSORSHIP??? They can't stop m
OOo 3.3 on Ms Windows 7 + kubuntu, Dragon Naturallyspeaking Premium v11.5
User avatar
Hagar Delest
Moderator
Posts: 32627
Joined: Sun Oct 07, 2007 9:07 pm
Location: France

Re: Custom Date & Time Fields for OpenOffice.org Writer

Post by Hagar Delest »

For date field insertion as AutoText, see also here: Auto-Complete.
LibreOffice 7.6.2.1 on Xubuntu 23.10 and 7.6.4.1 portable on Windows 10
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Custom Date & Time Fields for OpenOffice.org Writer

Post by acknak »

himagain wrote:... Could you point me to more on your solution? ...
Try this:

1) File > New > Text Document
2) Insert > Fields > Date; Insert > Fields > Time
3) Edit > Select All
4) Edit > Autotext > Name: TimeStamp; Shortcut: TS; Autotext > New; Close

Now, in the document again, type the two letters "ts" then press F3. You should get the content saved in the autotext, including the time and date fields, inserted in the document. The inserted fields will have whatever formats were in effect when the autotext was defined.

You can edit an existing autotext, or you can just replace it by assigning new content to the existing name.
AOO4/LO5 • Linux • Fedora 23
Post Reply