Hi,
I'm having trouble getting the numbering text of a ListNum field when
it is not the first numbering field in a paragraph.
I usually use the ListFormat.ListString property, but it doesn't work
in this case, as this property (and ListFormat in general) always gets
the first list entity in a paragraph.
So if I had this in the document:
"It happens fbecause: a) reason1, b) reason 2, c) reason 3"
the ListFormat.ListString for any range in this line (including the
listnum "Result" and "Code" ranges for any listnum field) would be
"a)".
The same happens if I have a listnum field after a bullet (don't ask me
why anyone would this, it's not my document :)), the code character for
the bullet is returned (whatever it is).
So, how can I get the resulting text of a listnum field, or the listnum
field immediately before the current selection (I have no trouble
finding the field, just getting the text)?
Hope you can help
Thanks
John McGhie [MVP - Word and Word Macintosh] - 12 Feb 2006 08:52 GMT
Return paragraph.range.Fields(2).Result.Text
Sorry: You may have to parse what comes back: it's a string :-)
Cheers
On 11/2/06 1:37 AM, in article
1139582224.085192.171550@g14g2000cwa.googlegroups.com, "Tiago"
<tiago.marques@edisoft.pt> wrote:
> Hi,
>
[quoted text clipped - 18 lines]
> Hope you can help
> Thanks

Signature
Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.
John McGhie <john@mcghie.name>
Microsoft MVP, Word and Word for Macintosh. Consultant Technical Writer
Sydney, Australia +61 (0) 4 1209 1410
Tiago - 12 Feb 2006 12:24 GMT
I had already tried that.
What comes back is the empty string (or maybe a space, I haven't paid
that much attention)...
Tony Jollans - 12 Feb 2006 12:37 GMT
This looks like a bug to me.
Although Word allows multiple list numbers within a paragraph and the UI
seems to work correctly with them, the way they are exposed in the object
model doesn't allow for their easy retrieval.
The one place they probably ought to be available (the Field Result) gives
the first number on the line for each of the three fields.
I don't know what it might do if you added a paragraph break just before the
second field, checked the list number of the new second paragraph, and then
undid the change - but it seems rather an extreme way to go about it.
--
Enjoy,
Tony
> Hi,
>
[quoted text clipped - 18 lines]
> Hope you can help
> Thanks
Tiago - 12 Feb 2006 21:23 GMT
Thanks a lot for your help.
The subject is being discussed in the general group, so I'll stop
posting here...
Sorry about that, I really though the groups were unrelated, never
really though about it...