Heading numbers in the left margin

F

Fredrik

Hi,

I'm trying to create outline numbered headings, where the number is located
in the left margin. I try to accomplish this using a negative value for
"NumberPosition" on the ListTemplate. Initially, this works fine, but as soon
as I click on the Heading's number, the whole paragraph, including the
number, "jumps in" to the right so that the number is located exactly at the
margin instead of to the left of it.

I define my styles and ListTemplate in VBA, the relevant portion of which
reads:

With .ListTemplate.ListLevels(1)
.NumberPosition = CentimetersToPoints(-1.5)
.Alignment = wdListLevelAlignLeft
.TrailingCharacter = wdTrailingTab
.TabPosition = 0
.TextPosition = CentimetersToPoints(0)
…
End With

After clicking on a heading's number, I can see that Word resets
"NumberPosition" to 0. Why? Negative indentation clearly appears to be
supported (http://office.microsoft.com/en-us/word/HP100165281033.aspx).

I've tried this in Word 2007 and 2010beta

Kindly,
Fredrik
 
P

Peter T. Daniels

A way to work around it would be to let Word think that where the
numbers are appearing _is_ the left margin, and use an indentation
value on all the other paragraph styles to move the visible margins in
to where you want them to be.
 
S

Stefan Blom

Negative indents seem unreliable with outline numbering. Choose to leave the
number at the margin but set the "Number alignment" to "Right" instead.
 
F

Fredrik

Thanks for your info,

the way we used to do it is like Peter says, making all styles BUT the
headings indented. I'm trying to avoid this though, since it renders all
paragraph styles useless in tables, textboxes, etc. It would be cleaner if
all styles were aligned at indentation=0 and the numbering could be placed in
the left margin.

Actually (and oddly enough), the following definition seems to do the trick.
Don't know if I dare trust it though...

.NumberFormat = "%1"
.NumberStyle = wdListNumberStyleArabic
.NumberPosition = CentimetersToPoints(0)
.Alignment = wdListLevelAlignRight
.TrailingCharacter = wdTrailingTab
.TabPosition = 0
.TextPosition = CentimetersToPoints(1.5) ' Somehow, this is
interpreted as a minus indentation! :)
.LinkedStyle = "Numbered Heading 1"
 
S

Stefan Blom

The trick is that you are aligning numbers to the *right* which is what I
suggested in a previous message.
 
F

Fredrik

No, actually it works even smoother with left aligned numbers. The trick is
that the TextPosition is interpreted as a minus indentation for some reason.
But the solution is very unstable. It probably works by exploiting some
obscure bug in the numbering engine.
 
S

Stefan Blom

I see your point, but since you call the solution "unstable," using
right-aligned numbers would seem safer.
 

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