How to get the preview of a Figure Caption number

K

karitaat

Hi all,

In WordXP, if you want to have a caption under a Figure, Table etc
(through Insert > Reference >Caption) Word presents a Dialog-box, with
a preview of the proposed number of the Caption (eg. Figure 1-1)
If you accept, Word will place a textstring with some Fields in it (in
this case: Figure { STYLEREF 1 \s}-{ SEQ Figure \* ARABIC \s 1
}<space><user supplied caption text>)

I have built a usrForm that replaces the wdDialogInsertCaptionNumbering
Dialog.

Question:
Let's say I am in Chapter 3, and about to place the 2nd caption under a
Figure.
How do I get that '3-2' number, to show it in my usrForm?


regards,
peter
 
J

Jean-Guy Marcil

(e-mail address removed) was telling us:
(e-mail address removed) nous racontait que :
Hi all,

In WordXP, if you want to have a caption under a Figure, Table etc
(through Insert > Reference >Caption) Word presents a Dialog-box, with
a preview of the proposed number of the Caption (eg. Figure 1-1)
If you accept, Word will place a textstring with some Fields in it (in
this case: Figure { STYLEREF 1 \s}-{ SEQ Figure \* ARABIC \s 1
}<space><user supplied caption text>)

I have built a usrForm that replaces the
wdDialogInsertCaptionNumbering Dialog.

Question:
Let's say I am in Chapter 3, and about to place the 2nd caption under
a Figure.
How do I get that '3-2' number, to show it in my usrForm?

May I ask why you decided to re-invent the wheel?

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
K

karitaat

Jean-Guy,

Yes... invent a better wheel!

I think Word has a design-flaw in the CaptionLabels: the name of the
Leadin text ('Figure') is the same as the name of the
SEQ-field { SEQ Figure }

We have Word-UK, but the application I am working on (a report) needs
to be in other European languages as well.
In Dutch a 'Table' is a 'Tabel', in German a 'Figure' is a 'Figur'.
Now: I cannot rename the names of wdCaptionTable or wdCaptionFigure.
I can only Add the local name of a Caption.
But if I add 'Tabel' to 'Table' this is asking for trouble, because
both will be presented.

What I actually want to have is (e.g.in Dutch):
Tabel { SEQ Table \* ARABIC }<tab><user supplied text>

So I made a userform that mimics the behaviour of
wdDialogsInsertCaption.

Now: please help me to (re?)invent how I can get to the the next
CaptionNumber.

Salut a vous aussi

peter
 
J

Jean-Guy Marcil

(e-mail address removed) was telling us:
(e-mail address removed) nous racontait que :
Jean-Guy,

Yes... invent a better wheel!

I think Word has a design-flaw in the CaptionLabels: the name of the
Leadin text ('Figure') is the same as the name of the
SEQ-field { SEQ Figure }

We have Word-UK, but the application I am working on (a report) needs
to be in other European languages as well.
In Dutch a 'Table' is a 'Tabel', in German a 'Figure' is a 'Figur'.
Now: I cannot rename the names of wdCaptionTable or wdCaptionFigure.
I can only Add the local name of a Caption.
But if I add 'Tabel' to 'Table' this is asking for trouble, because
both will be presented.

What I actually want to have is (e.g.in Dutch):
Tabel { SEQ Table \* ARABIC }<tab><user supplied text>

So I made a userform that mimics the behaviour of
wdDialogsInsertCaption.

Now: please help me to (re?)invent how I can get to the the next
CaptionNumber.

If you must... It does sound like a lot of work... But as long as someone is
paying for it! ;-)

I guess the easiest would be to do two searches:
1) Look backward for the first instance of a paragraph with a Heading 1
style, get its number (using the ListTemplate property)
2) See in the document how many fields with the field code "SEQ Table \*
ARABIC " are present, add one to get the next one.

--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 
K

karitaat

Hi all,

just for the record: I owe myself (and posterity: eg. anybody
interested in tweaking CaptionLabels) an answer.

By far the easiest way to get a preview of what the CaptionNumber will
be is: have Word finding it out ;-)

At _Initialize of my usrForm I
* freeze the Window;
* insert an English CaptionString in the document;
* Turn it into a differentLanguage CaptionString
CaptionString is: LocalCaption<Space>{NumberField}<Tab>
* Read out that string, and show it in the usrForm.
In this way Word does the accounting for me!

If user selects a different Caption: I replace the CaptionString with a
new one
If user Cancels: I delete the CaptionString
If user accepts: I am done

Oh, and I found out something interesting.
I was under the false impression that the layout of a CaptionNumber
would be remembered in the Document.
Nope: it is remembered in Normal.dot

Cheers,
peter







Jean-Guy Marcil schreef:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top