Date field with different date on each page

Writing a book, Automating Document Production - Discuss your special needs here

Date field with different date on each page

Postby evanb » Fri Jan 29, 2016 10:24 pm

What I want to be able to do is put a field or field-like entity in a header or footer and have it display a date, the value of which is controlled by the page number. For example, the first page would show today's date, the second page tomorrow's, and so forth.

I'm looking for suggestions on the best way to accomplish this, whether by macros, extensions, or just some obscure, existing field behavior. I'm prepared to write code; I just don't know enough about OO's features to pick the likely best approach.

OpenOffice 4.1.2 on Windows 7
Posts: 1
Joined: Fri Jan 29, 2016 10:04 pm

Re: date field with different date on each page

Postby RoryOF » Fri Jan 29, 2016 11:09 pm

The Writer manual has a chapter ion use of Fields at
This is for v3.3, but should be adequate.

Information on macro programming is in Andrew Pitonyak's books downloadable from and are the first source for all OO macro knowledge and problem resolution.

From memory (check - I may misremember) it is not possible to perform arithmetic on OO Field variables. If this were possible, it would be simple to insert into a Header
Code: Select all   Expand viewCollapse view

formatted as a date

I suspect you will have to write a macro to do that calculation, format the result and insert it into a page Header, but I haven't thought this through. Another possibility might be to make a spreadsheet of a series of dates (to use as a database) and insert the date from cell(A(Pagenumber)) into a header.

One of the difficulties is likely to be getting the later inserted values to show, as information inserted into the first header of a page style tends to be persistent.

There is some discussion on a similar problem at
I don't think this came to any helpful conclusion.
Apache OpenOffice 4.1.7 on Xubuntu 20.04.1 (mostly 64 bit version) and very infrequently on Win2K/XP
User avatar
Posts: 31401
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Return to Advanced Uses

Who is online

Users browsing this forum: No registered users and 3 guests