Field code for total number of <caption>

User avatar
StuartR
Administrator
Posts: 12601
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Field code for total number of <caption>

Post by StuartR »

I have a custom caption in a Word document, but I guess the same question could be asked about tables, or figures.

Is there a field code I can use to find the total number of captions of this type, or the largest caption number (which is the same thing), so that I can have a sentence that says "This document contains 21 tables" or similar...
StuartR


User avatar
HansV
Administrator
Posts: 78402
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Field code for total number of <caption>

Post by HansV »

See Dynamic word, table, and figure counts in MS Word (unfortunately, it's not https, but the site is OK).
Best wishes,
Hans

User avatar
StuartR
Administrator
Posts: 12601
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Field code for total number of <caption>

Post by StuartR »

That makes sense, I'll give it a try. Thank you.

(my browser add-ons automatically redirected me to the https site)
StuartR


User avatar
StuartR
Administrator
Posts: 12601
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Field code for total number of <caption>

Post by StuartR »

I tried following this guidance, and it required hidden fields in every single caption, which seems very risky to me - it would be easy to miss one, or to add an extra one.

My caption is called "Recommendation" and I ended up simply adding

{ SET fr { SEQ Recommendation \* ARABIC \c } }
to the end of my document and then using
{ REF fr }
in each place where I needed to put the total number of recommendations. It seems to be working correctly.
StuartR


User avatar
Charles Kenyon
5StarLounger
Posts: 609
Joined: 10 Jan 2016, 15:56
Location: Madison, Wisconsin

Re: Field code for total number of <caption>

Post by Charles Kenyon »

Remember that you can save a complex field construction like this as AutoText or some other Building Block.

User avatar
StuartR
Administrator
Posts: 12601
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Field code for total number of <caption>

Post by StuartR »

Thank you Charles
StuartR