0
votes

I wrote a nested field for Microsoft Word (Windows, Office 2010) Table of Contents which allows me to change the error text when no Figures entries (Caption style with the word "Figure" in the string) exist.

I don't know how to represent the Field marks, so I'm using "FS" and "FE" to indicate the field brackets.

FS IF FS TOC \c"Figure" FE  = "<carriagereturn>No table of figures entries found." "No figures at this time" FS TOC \c"Figure" FE  FE

This works so far as displaying either my error message or the table of figures, but the usual hyperlinking for the page numbers (Control-Click to jump) is not available. I'm guessing it has something to do with the nested fields, but can't figure out if there's a workaround. If there's a better way, using fields, to do this, I"m happy to change over.

EDIT: I don't suppose it's possible to edit the error string itself inside the wordcnvr.dll file?

1

1 Answers

0
votes

How about this instead:

{ IF "{ TOC \c "Figure" }" = "
No table*" "{ SET ToCFormat Charformat }Then the error message you want to display." "{ SET TocFormat Mergeformat }" }
{ TOC \c "Figure" \*{ ToCFormat } }

and format the font of the "T" of the second TOC to be coloured white and be 1pt size (or smaller, if possible). NB, formatting the "T" as Hidden won't work, as Word will treat the field code as if it starts with "OC".

I wasn't able to find any significant improvements to this from the layout point of view, but if anyone is likely to open/update your document on a non-English langugae version of Word you should probably use

{ IF "{ TOC \c "Figure" }" = "{ TOC \c "Nolist" }" (etc...) }

where Nolist is known to have no associated SEQ fields. You'll get an extra prompt, though.

Also, if anyone is likely to open/update your document on Mac Word (2011, anyway), that version actually generates a multiline error message with advice (whereas Windows Word puts the advice in a message box). The result still only occupies a few points of vertical space but you could generate a TOC for something that only has one entry instead. Overall, I think you would end up with something like

{ IF "{ TOC \c "Figure" }" = "{ TOC \c "Nolist" }" "{ SET ToCFormat Charformat }{ SET theList OneEntry }Your error message" "{ SET ToCFormat Mergeformat }{ SET theList Figure }" }{ SEQ OneEntry \#"' '" }{ TOC \c { theList } \* { ToCFormat } }

formatting the "T" as before and fixing whatever you had to fix with the * switch.

Finally, from an international perspective, using "‘ ‘", with two left single quotation marks (U+2018), is a better choice than "' '", but only to deal with Switzerland's regional settings, and it may not work with older versions of Word.