Ask Your Question

How can I insert a fixed date in a CALC footer [closed]

asked 2015-07-29 21:55:36 +0200

Edward gravatar image

I have various CALC files with footers incorporating a date field to show revision/update/release date. The date field available in the footer automatically updates when a document is opened. Is there a way (other than entering a date as text) to reference the most recent file SAVE date, instead of today's date? As a workaround I export the files to PDF and print the "fixed date" copies, but if I inadvertently open/print the calc file I get the current date rather than the release date (causing colleagues viewing my hard copies to believe data is current when in actuality the data may be weeks old).

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2020-08-23 09:52:30.637460

2 Answers

Sort by » oldest newest most voted

answered 2015-07-30 14:13:26 +0200

pierre-yves samyn gravatar image


You can use a macro like:

sub PysUpDateFooter

dim oDoc as object, oStyle as object, oFooter as object

oDoc = thisComponent

if oDoc.haslocation then    
    oStyle = oDoc.StyleFamilies.getByName("PageStyles").getByName("Default")

'   oFooter = oStyle.LeftPageFooterContent'
    oFooter = oStyle.RightPageFooterContent

    oFooter.LeftText.String = FileDateTime(thiscomponent.url)
'   oFooter.CenterText.String = FileDateTime(thiscomponent.url)'
'   oFooter.RightText.String = FileDateTime(thiscomponent.url)'

    oStyle.RightPageFooterContent = oFooter
end if    

end sub

(Un)comment as needed (left/right page, left/center/right area) Example: UpdateFooter.ods


edit flag offensive delete link more

answered 2015-07-30 00:39:11 +0200

Alex Kemp gravatar image

It must be possible using a macro, but not via the menu (I had a quick search for the location in the object tree but was unsuccessful).

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2015-07-29 21:55:36 +0200

Seen: 239 times

Last updated: Jul 30 '15