Calculations with DocProperties

Using them, Making them, Finding them
Post Reply
jerremy-tamlin
Posts: 7
Joined: Thu Mar 13, 2008 4:50 am

Calculations with DocProperties

Post by jerremy-tamlin »

I want to do calculations and conditional text using Document Properties like Page Number (Not Number of Pages) and Date Printed etc.
Does anyone know how I reference this properties/variables?

Thanks

P.S. I don't want to use macro's if at all possible because I don't want to have to enable them every time I open the documents or enable them for all documents. All I want is a simple calculation such as page-number -2 or display current date if document hasn't been printed or the date it was first printed.
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Calculations with DocProperties

Post by acknak »

I'd love to be proved wrong, but I think you'll find that OOo's abilities here are extremely limited. Very few of the document property fields are accessible in a calculation or condition; e.g. there is a page number field but it doesn't participate in any calculation, it can only be displayed. There is a "PAGE" variable that works in calculations but it holds the total number of pages, not the current page number.

You can get a good start with the online help: Help > OOo Help > OOo Writer > Index: "conditions;user data fields" and also the "Related Topics" links on that page.
AOO4/LO5 • Linux • Fedora 23
jerremy-tamlin
Posts: 7
Joined: Thu Mar 13, 2008 4:50 am

Re: Calculations with DocProperties

Post by jerremy-tamlin »

That Sucks! :-(

What about a work around using calculations in writer tables? I can put page-number in a cell and then perform calculations with the contents of that cell, but if I put it in the header it gets confused. Any Ideas?

On another note do you know if there is a way to make one cell equal the text contained in another? If I put "Hello" in Cell A3 then put =<A3> in another cell I get "0" obviously the numerical value of "Hello"
User avatar
acknak
Moderator
Posts: 22756
Joined: Mon Oct 08, 2007 1:25 am
Location: USA:NJ:E3

Re: Calculations with DocProperties

Post by acknak »

Umm, no, no, no, and, uh... no. ;-)

This has got to be the most strangely designed aspect of Writer. It's like six different people added "fields" but they all had different ideas of what "fields" are supposed to do, and none of them talked together. It really is a big mess and the limitations are numerous and arbitrary.
I can put page-number in a cell and then perform calculations with the contents of that cell, but if I put it in the header it gets confused. Any Ideas?
You can only refer to a table cell from within a table--possibly a different table, but not from outside a table. Why? I have no idea.

I suppose you could create a one-cell table in the header, just to hold a reference to the other table.

Field references and formulas in header/footer also get a little weird, because they are not re-calculated for every page. Fields in the header may pick up new values off the page, but only when they appear in the first paragraph on the page.
[is] there is a way to make one cell equal the text contained in another? If I put "Hello" in Cell A3 then put =<A3> in another cell I get "0" obviously the numerical value of "Hello"
Like I said: No ;-)

You can register and vote for Issue 74155: Give formulas in table the capability to reference onto cells containing text.

If you need to show a single value a number of times, you have to use a field (or a section).
AOO4/LO5 • Linux • Fedora 23
jerremy-tamlin
Posts: 7
Joined: Thu Mar 13, 2008 4:50 am

Re: Calculations with DocProperties

Post by jerremy-tamlin »

Cheers for your help.

I guess all I can say is... Bugger.

I'll post that vote.
Post Reply