Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.formatting.longdocs
StefanM StefanM is offline
external usenet poster
 
Posts: 3
Default Calculate running total and print in footer/header

Hi again,

now that my first problem is solved, maybe someone can help me with
another problem. I need to print a running total at the bottom of each
page (except last page) and at the top of all but the first page. The
document gets filled via ActiveX interface to Word by my program. It
sends a variable numer of invoice items to Word (using one autotext
field as "marker" to insert an item line before the field, so that the
autotext field always stays at the bottom of the invoice items already
inserted into the document).

I created a sample document with a table and played a bit with Word's
functionality on how to calculate a running total.

One way seems to be using a table and "SUM(ABOVE)" to calculate the
"PageTotal" and a series of SET statements to store the page and
document totals in "variables" (don't know if "{ SET PageTotal { = SUM
(ABOVE) } }" is what you would call a variable in Word).

However you cannot use the values of these "variables" in the page
footer/header as on following pages only the values from the first
page footer appears. Thus the page footer seems to be "static" and not
dynamic using the current values of the variables.

So bottom line is: I can't really use these features because they
don't work the way I expected them to work. Up to now my solution
would be to "inject" a line with the running total, a page break and
repeat the running total on top of the next page before sending the
next invoice item line.

Even when using a table and SUM(ABOVE) I would have to injevt these
"sum" lines and page breaks in my table.

Is there any other solution I'm currently not aware off?

Thanks,
Stefan
  #2   Report Post  
Posted to microsoft.public.word.formatting.longdocs
macropod[_2_] macropod[_2_] is offline
external usenet poster
 
Posts: 2,059
Default Calculate running total and print in footer/header

Hi Stefan,

What you can do is to add a column to your table with a formula that progressively increments the tally.

Suppose your values are in column D, and you add a new column (E) to the table, which has a heading row. A formula field you could
insert into each cell in column E, except for the last row, to calculate the progressive totals from column D is:
{QUOTE{Set CellD "D{={SEQ RowNr}/2}"}{=SUM(D1:{CellD}) \# $,0.00;-$,0.00;}}
If you want to tally a different column, simply replace all the Ds in the formula with the relevant column letter.

Now, suppose you create a Style named 'Tally' and apply it to all cells in the tally column. You could then place a STYLEREF field
in the page footer, coded as:
{STYLEREF Tally \l}
That field will pull in the last 'Tally' entry for the page.

The 'Tally' Style can effectively be used to hide the field calculations, by formatting it with a white 1pt font. The column width
can also be minimised, especially if you set the left & right cell margins to 0, and any borders & shading for the column can be
removed (except the left border), so as to make the column all but invisible on-screen and invisible in any printout.

Note: The field brace pairs (ie '{ }') for the above examples are created via Ctrl-F9 - you can't simply type them or copy & paste
them from this message.

--
Cheers
macropod
[Microsoft MVP - Word]


"StefanM" wrote in message ...
Hi again,

now that my first problem is solved, maybe someone can help me with
another problem. I need to print a running total at the bottom of each
page (except last page) and at the top of all but the first page. The
document gets filled via ActiveX interface to Word by my program. It
sends a variable numer of invoice items to Word (using one autotext
field as "marker" to insert an item line before the field, so that the
autotext field always stays at the bottom of the invoice items already
inserted into the document).

I created a sample document with a table and played a bit with Word's
functionality on how to calculate a running total.

One way seems to be using a table and "SUM(ABOVE)" to calculate the
"PageTotal" and a series of SET statements to store the page and
document totals in "variables" (don't know if "{ SET PageTotal { = SUM
(ABOVE) } }" is what you would call a variable in Word).

However you cannot use the values of these "variables" in the page
footer/header as on following pages only the values from the first
page footer appears. Thus the page footer seems to be "static" and not
dynamic using the current values of the variables.

So bottom line is: I can't really use these features because they
don't work the way I expected them to work. Up to now my solution
would be to "inject" a line with the running total, a page break and
repeat the running total on top of the next page before sending the
next invoice item line.

Even when using a table and SUM(ABOVE) I would have to injevt these
"sum" lines and page breaks in my table.

Is there any other solution I'm currently not aware off?

Thanks,
Stefan


Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Print word document without header and footer Lee Microsoft Word Help 9 April 27th 23 08:55 PM
How do I get a running header with running page numbers? rsw5060 Page Layout 2 December 9th 08 04:55 AM
Calculate Total Coleman[_2_] Tables 0 March 27th 08 05:34 PM
Calculate Total of two different tables, display result in a different table Ben Tables 2 December 22nd 05 03:13 PM
How: header and footer print on first page only (Wordb2000) Ken K Page Layout 10 June 20th 05 09:18 PM


All times are GMT +1. The time now is 12:50 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"