Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / October 2006

Tip: Looking for answers? Try searching our database.

How to get the preview of a Figure Caption number

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
karitaat@hotmail.com - 29 Sep 2006 10:17 GMT
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
Jean-Guy Marcil - 29 Sep 2006 12:23 GMT
karitaat@hotmail.com was telling us:
karitaat@hotmail.com nous racontait que :

> Hi all,
>
[quoted text clipped - 12 lines]
> 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?

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

karitaat@hotmail.com - 29 Sep 2006 13:56 GMT
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

> karitaat@hotmail.com was telling us:
> karitaat@hotmail.com nous racontait que :
[quoted text clipped - 24 lines]
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
Jean-Guy Marcil - 29 Sep 2006 17:50 GMT
karitaat@hotmail.com was telling us:
karitaat@hotmail.com nous racontait que :

> Jean-Guy,
>
[quoted text clipped - 20 lines]
> 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.

Signature

Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
jmarcilREMOVE@CAPSsympatico.caTHISTOO
Word MVP site: http://www.word.mvps.org

karitaat@hotmail.com - 06 Oct 2006 12:38 GMT
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:

> karitaat@hotmail.com was telling us:
> karitaat@hotmail.com nous racontait que :
[quoted text clipped - 39 lines]
> jmarcilREMOVE@CAPSsympatico.caTHISTOO
> Word MVP site: http://www.word.mvps.org
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.