MS Office Forum / Word / Programming / October 2007
How to link to a field in a tabel from a header? Programming or?
|
|
Thread rating:  |
Henry - 04 Sep 2007 14:02 GMT Hi
We have some QA documents where there is a change log in the end of the document which consist of multiple columns and rows. e.g.
Initials, version and a change description column (3 in total)
I need to show the most resent version and the initials in the header (automatically) since users often forget to type the initials and version in the header - meaning inconsistent data and serious troubles with the QA department ;)
So I imagine that I can grab the data directlly from the change log table somehow and put it in the header - but how do I do that?
regards
 Signature Henry
macropod - 04 Sep 2007 23:51 GMT Hi Henry,
If you define paragraph Styles for the columns in the log table that hold the versions # and author initials, you could use two STYLEREF fields, in the header to replicate the last entries.
For example, suppose you name the paragraph Style for the column that holds the version # 'Version', and you name the paragraph Styles for the column that holds the author initials 'Inits', you could insert the following STYLEREF fields in the header: {STYLEREF Version \l} and {STYLEREF Inits \l} Because of the way Word tables work, if you insert a new row in the log table, these style definitions will be carried to the new rows. The only 'gotcha' with this is that, if someone adds a blank row to the end of the log table, the STYLEREF fields will return blanks.
Cheers
 Signature macropod [MVP - Microsoft Word] -------------------------
> Hi > [quoted text clipped - 12 lines] > > regards Henry - 05 Sep 2007 07:58 GMT Hi Marcopod
THAT sound brilliant ;o)
But where do I set that "paragraph Style" for the column? Triviel question I guess but I cannot find it (I my danish version of word).
regards Henry
 Signature Henry
> Hi Henry, > [quoted text clipped - 25 lines] > > > > regards Stefan Blom - 05 Sep 2007 10:05 GMT I'm not sure about the Danish version of Word, but the Swedish equivalence of paragraph style is "styckeformatmall," if that helps. A paragraph style stores settings for entire paragraphs, for example, font, font size, line spacing, spacing before/after; and applying a style means to apply all of those settings in one step.
How to create, modify, and apply styles depends on which version of Word you are using. General information about styles for versions up to and including Word 2003 can be found here: http://www.shaunakelly.com/word/styles/TipsOnStyles.html.
 Signature Stefan Blom Microsoft Word MVP
> Hi Marcopod > [quoted text clipped - 43 lines] >> > >> > regards Henry - 05 Sep 2007 13:28 GMT Hmm, it doen't seem work accross page breakes??
Any suggestions?
regards Henry
 Signature Henry
> I'm not sure about the Danish version of Word, but the Swedish equivalence > of paragraph style is "styckeformatmall," if that helps. A paragraph style [quoted text clipped - 54 lines] > >> > > >> > regards macropod - 05 Sep 2007 13:58 GMT Hi Henry,
Can you keep the log table on one page?
Cheers
 Signature macropod [MVP - Microsoft Word] -------------------------
> Hmm, it doen't seem work accross page breakes?? > [quoted text clipped - 61 lines] >> >> > >> >> > regards Henry - 05 Sep 2007 16:02 GMT Yes, I believe that possible, but it won't be the same pagenumber everytime though.
 Signature Henry
> Hi Henry, > [quoted text clipped - 66 lines] > >> >> > > >> >> > regards Henry - 10 Sep 2007 15:14 GMT Hello Macropod
What was the purpose of you question? Did you have some ideas or suggestions to my problem?
regards Henry
 Signature Henry
> Hi Henry, > [quoted text clipped - 66 lines] > >> >> > > >> >> > regards macropod - 10 Sep 2007 23:03 GMT Hi Henry,
I thought from your previous reply that you understood that keeping the table on one page should fix the problem. Sorry for any confusion.
Cheers
 Signature macropod [MVP - Microsoft Word] -------------------------
> Hello Macropod > [quoted text clipped - 74 lines] >> >> >> > >> >> >> > regards Henry - 14 Sep 2007 08:32 GMT Oh, that's what you meant?
Well, it doesn't fix the problem, the version, initials and date fields from the change log must be present in the header of all pages.
So that's not an option.
Any other suggestions to solve that?
regards Henry
 Signature Henry
> Hi Henry, > [quoted text clipped - 80 lines] > >> >> >> > > >> >> >> > regards macropod - 14 Sep 2007 09:06 GMT But that's exactly what the STYLEREF field will do - provided the table is all on one page.
Cheers
 Signature macropod [MVP - Microsoft Word] -------------------------
> Oh, that's what you meant? > [quoted text clipped - 92 lines] >> >> >> >> > >> >> >> >> > regards Henry - 01 Oct 2007 12:43 GMT Hi again
I've been away for a few weeks so I'm sorry for this late response.
I have tested it and it seems that it only works for the pages following the table not the previous pages.
I other words if I have the change log table on the last page (which is so in our case) there won't be any data in the header on the pages before that page.
I can mail a document showing the problem.
regards Henry
 Signature Henry
> But that's exactly what the STYLEREF field will do - provided the table is all on one page. > [quoted text clipped - 95 lines] > >> >> >> >> > > >> >> >> >> > regards macropod - 02 Oct 2007 06:11 GMT Hi Henry,
This is a bit more complicated than I thought. Here's a field construction that seems to be a sure-fire way to make it work: {QUOTE{IF{PAGE}={NUMPAGES} {SET MyRef {STYLEREF "My Style" \l}}}{REF MyRef}} where 'My Style' is the name of your log's style and 'MrRef' is a variable that's used to hold the log's contents.
Note: In the above example, the field barces (ie '{}') are all created in pairs via Ctrl-F9.
How it works: The QUOTE field simply holds the others together The IF test checks to see whether the current page is the last page of your document. If it is, then it uses the SET field to create a bookmark, named 'MyRef' to store the results of the STYLEREF field on that page. The REF field simply displays the contents of the 'MyRef' bookmark.
Cheers
 Signature macropod [MVP - Microsoft Word] -------------------------
> Hi again > [quoted text clipped - 112 lines] >> >> >> >> >> > >> >> >> >> >> > regards Henry - 02 Oct 2007 08:44 GMT Hi
Briliant, that actually works.
Only thing though, it's quite difficult to open the "field code" to edit it, especially if the field is empty (e.g. if I have forgotten to enter the date or initials in the table).
Also, when I click on the field an select show fieldcode, then it somtimes only showsome of the code.
But all in all it works - thanks!
regards Henry
 Signature Henry
> Hi Henry, > [quoted text clipped - 127 lines] > >> >> >> >> >> > > >> >> >> >> >> > regards macropod - 02 Oct 2007 22:55 GMT Hi Henry,
Alt-F9 quickly toggles the field code display, without the need to select the field beforehand. That way you'll get to see all the field code without difficulty.
Cheers
 Signature macropod [MVP - Microsoft Word] -------------------------
> Hi > [quoted text clipped - 144 lines] >> >> >> >> >> >> > >> >> >> >> >> >> > regards
|
|
|