Unfortunately, I think it has always been this way (from at least Word 97).
Nor can you do
{ SET X { SYMBOL 65 } }
{ IF 1 = 1 "{ SYMBOL 65 }" "" }
(even { REF X } does not do what you might hope, and the common workaround
of using { QUOTE }doesn't work either.
So...if it /has/ to be SYMBOL, I don't think there's a simple way forward.
You can put an IF inside the SYMBOL, so you can do, e.g. an individual
character or a space:
{ SYMBOL "{ IF 1 = 1 "65" "32" }" }
but that's about the closest you can get. What effect do you need to
achieve?
Peter Jamieson
Thanks Peter. Here is what I'm trying to do:
The field { PAGE } returns its results using the ten characters 0-9 (ASCII
hex 30-39). My font (LTC Caslon) has an alternate set of glyphs for the ten
digits (the old style where 3, 4 and 5 dip below the baseline), and I want to
render page numbers with these alternate characters. They are UNICODE
characters F730-F738.
The field { SYMBOL } with a little arithmetic on the result of { PAGE } does
the trick but I get a leading 0 when the page # is less than 10. So I want to
drop my little formula inside an IF { PAGE } > 10.
I have a work-around in which I put the IF inside the SYMBOL. The font
happens to have a zero-width character and I use that where the leading zero
would be. The work-around isn't ideal since that zero-width character isn't
well-behaved across fonts, but it works OK.
Do you know another way to get to transpose the characters that result from
{ PAGE } to another place in the character table?
I wondered if I could write a custom field in VBA, but I haven't seen a way
to do that.
Thanks again,
John
> Unfortunately, I think it has always been this way (from at least Word 97).
> Nor can you do
[quoted text clipped - 38 lines]
> > { IF 2 > 1 { SYMBOL 65 } "false"} returns nothing also, so the conditional
> > is evaluating TRUE. It's as if SYMBOL just fails when inside an IF field.
Tony Jollans - 02 Mar 2006 13:06 GMT
Not sure exactly how you're accomplishing what you have so far, but a couple
of options ...
(a) Instead of doing ...
{ IF 2 > 1 { SYMBOL 65 } }
What about
{SYMBOL { IF 2 > 1 65 } }
(b) Instead of using a symbol field can you not use the actual character in
your IF field?
( IF 2 > 1 ? )
where ? is U+F730, etc.
--
Enjoy,
Tony
> Thanks Peter. Here is what I'm trying to do:
>
[quoted text clipped - 64 lines]
> > > { IF 2 > 1 { SYMBOL 65 } "false"} returns nothing also, so the conditional
> > > is evaluating TRUE. It's as if SYMBOL just fails when inside an IF field.
Peter Jamieson - 03 Mar 2006 20:47 GMT
Tony's second approach should do the trick as long as you are prepared to
write all the necessary nested IF statements to do it (and I think that
requires that you know the maximum number of digits in your page number).
(Anyone else responding to this message needs to remember that if you can't
use SYMBOL, you need an IF, or alternative, that has a different result for
each digit).
> I wondered if I could write a custom field in VBA, but I haven't seen a
> way
> to do that.
If only. There is no such facility. There are some things that come close,
but they tend to be undermined in one way or another, e.g., they don't work
as you might hope in headers/footers (e.g. INCLUDETEXT fields), or they
don't update when you expect, or users end up having to answer increasingly
spooky security questions (e.g. DATABSE fields or anything else that Word
thinks needs to "execute" something, or they add unwanted paragraph markers
(e.g. recent DATABASE field implementations and external text converters)
An alternative approach which might work if
a. you have sufficient control over the documents concerned
b. the page number range is limited
c. you are using a sufficiently recent version of Word (i.e. one where
docvariable fields in headers and footers do not crash the product)
could be
d. to use VBA to create a Word.Variable in the document for each page
number you want to use
e.g. create docvariable p123 with value "xyz", where x, y, and z are the
unicode character codes for the digits 1,2,3 in your font
e. use a nested field code such as
{ DOCVARIABLE "p{ PAGE }" \*charformat }
where the "D" is formatted in the font you want to use.
Peter Jamieson
> Thanks Peter. Here is what I'm trying to do:
>
[quoted text clipped - 80 lines]
>> > is evaluating TRUE. It's as if SYMBOL just fails when inside an IF
>> > field.
John in Saratoga - 03 Mar 2006 21:56 GMT
Thanks for all the excellent ideas.
Here is what I've done. The number of pages is less than 1000. I handle each
of the three digits separately and concatenate the result.
{ SYMBOL { IF { PAGE } > 99 { = 63280 + mod(int({ PAGE }/100),10) } 160 } }
{ SYMBOL { IF { PAGE } > 9 { = 63280 + mod(int({ PAGE }/10 ),10) } 160 } }
{ SYMBOL { = 63280 + mod({ PAGE },10) } }
In the font, the characters I want are in the range 63280 to 63289 and
Unicode character 160 happens to be a zero-width character.
John
Peter Jamieson - 03 Mar 2006 22:18 GMT
Useful feedback, thanks!
Peter Jamieson
> Thanks for all the excellent ideas.
>
[quoted text clipped - 12 lines]
>
> John