Inserting "last updated" in a footer

Discuss the spreadsheet application

Inserting "last updated" in a footer

Postby opensourcesupporter » Tue Sep 14, 2010 10:14 pm

In a footer I want to include the date the Calc document was last updated. How do I do that?

This would also apply to headers, right? And possibly also to Writer?
OOO320m12 (Build:9483)
Win 7 Home Premium
opensourcesupporter
 
Posts: 2
Joined: Tue Sep 14, 2010 10:09 pm

Re: Inserting "last updated" in a footer

Postby acknak » Wed Sep 15, 2010 12:04 am

Sorry, I don't see how this would be possible--well, apart from manually modifying the footer each time you change the document. The only provided date field is the "current" date, which I presume will reflect the date the document is opened/printed. You might want to experiment to verify exactly what happens; maybe it does use the last modified date.

Writer is completely different and provides several different date fields, including a "last modified" date.
AOO4/LO5 • Linux • Fedora 23
User avatar
acknak
Moderator
 
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Inserting "last updated" in a footer

Postby ghe » Wed Sep 15, 2010 12:08 am

There's no easy way to do this, you'll have to use macros. See for instance http://excel.tips.net/Pages/T002190_Las ... ooter.html , which has to be adapted, probably heavily...
OpenOffice 3.2 on Debian Testing
ghe
 
Posts: 23
Joined: Wed May 19, 2010 5:32 pm

Re: Inserting "last updated" in a footer

Postby opensourcesupporter » Wed Sep 15, 2010 12:16 am

Thanks, acknak. The current date/time changes with each viewing/printing.

It would be a good thing if Calc had the same header/footer capabilities as Writer.
OOO320m12 (Build:9483)
Win 7 Home Premium
opensourcesupporter
 
Posts: 2
Joined: Tue Sep 14, 2010 10:09 pm

Re: Inserting "last updated" in a footer

Postby acknak » Wed Sep 15, 2010 12:24 am

Agreed. It baffles me that the OOo applications handle so many common tasks in completely different ways.

Surprisingly, I did not find any existing request for this; I would expect that a lot of people would use such a feature. That could mean that there is, in fact, some way to do it.

See [Tutorial] Reporting bugs or suggestions
AOO4/LO5 • Linux • Fedora 23
User avatar
acknak
Moderator
 
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Inserting "last updated" in a footer

Postby ghe » Wed Sep 15, 2010 1:07 am

You have the exact same difference between Word and Excel; in that respect OOo mimics Microsoft Office perfectly (and perhaps purposely).

acknak: No, there is no easy way to do this, at least not in Calc, Excel or Numbers. You have to use macros (see the link I posted above for the general principle, and http://www.oooforum.org/forum/viewtopic.phtml?t=60681 for a starter on how to implement that general principle in OO Basic).
OpenOffice 3.2 on Debian Testing
ghe
 
Posts: 23
Joined: Wed May 19, 2010 5:32 pm

Re: Inserting "last updated" in a footer

Postby Zizi64 » Wed Sep 15, 2010 5:17 pm

In a footer I want to include the date the Calc document was last updated. How do I do that?


The contents of header/footer of a WorkSheet are stored in PageStyle of the WorkSheet. When you use only one PageStyle for all Worksheets, you need to change/modify the footer content only one time. If you use (for example) three WorkSheets with thee different PageStyles, then you must to modify all of three PageStyles (if you want to display the "Modified DateTime" on all WorkSheets).

There are some macro functions and subs in my example file, for modify Header/Footer Left/Center/Right text of the (PageStyle of the) ACTIVE SHEET.
And there is a SUB, wich calls the function.
If you assign the SUB to "DocumentSave" event, the macro will modify the actual PageStyle: It put the result of NOW() function into right text area of the footer.
_Save_Event.png


You can try it by clicking the button on Sheet1, too.

LastModified2.ods
(15.13 KiB) Downloaded 473 times
Tibor Kovacs, Hungary; LO4.4.7, LO6.1.5 on Win7-10 x64Prof.
PortableApps, winPenPack: LO3.3.0-6.2.1 and AOO4.1.5
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 7767
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Inserting "last updated" in a footer

Postby the_knobs » Tue Apr 29, 2014 1:02 pm

Hi, first post here - I wanted to do something like this, found it easier to use a macro assigned to the SAVE event to update a cell or cells in a suitable location then format the cells as required. The cell reference is numeric, e.g. 0,0 = A1, and in example below 6,1 = G2

VBA code like this:-
Code: Select all   Expand viewCollapse view
Sub Main
rem - to see if it works
Dim Doc As Object
Dim Sheet As Object
Dim Cell As Object

Doc = ThisComponent
Sheet = Doc.Sheets(0)

cell=sheet.getCellByPosition(6, 1)
cell.value=date()

End Sub
OpenOffice 3.4.1 on Windows XP
the_knobs
 
Posts: 1
Joined: Tue Apr 29, 2014 12:56 pm


Return to Calc

Who is online

Users browsing this forum: RPG and 30 guests