Re: [WORD] Align To Decimal
I bit more digging and I think I might have to use something like
VB Code:
Selection.Rows.SpaceBetweenColumns
Selection.Information(wdHorizontalPositionRelativeToPage)
Selection.Information(wdHorizontalPositionRelativeToTextBoundary)
I can't fully work it out though, I think it might have something to do with returning different types of measurement points/twips/cm/in etc
Re: [WORD] Align To Decimal
So you want all numbers aligned center with the deimal points? Can you post a sample?
1 Attachment(s)
Re: [WORD] Align To Decimal
Table 1 is centred.
Table 2 is aligned to decimal.
This is just doing it by eye.
Re: [WORD] Align To Decimal
Its being aligned correctly by the PIMMS + Left font?
Re: [WORD] Align To Decimal
I forgot that the style was still applied.
The first table is aligned by the Style (Normal + Centred)
The second table still has the Style applied but I have put Decimal tabs over each column and aligned to the left.
The net result is that the columns are aligned to the centre (or near enough) and all the decimal points line up.
I am running Word 2000.
If you are running Word XP it will probably give a slight change to the description of the style in the second table.
The important thing is the decimal tab.
You can add them by either double clicking in the horizontal ruler and selecting decimal Tab then typing the position you want.
Or you can click the tab icon (to the left of the horizontal ruler) several times until it looks like an inverted 'T' with a dot on the right.
Re: [WORD] Align To Decimal
You can set a decimal tab via code like so.
VB Code:
Selection.ParagraphFormat.TabStops(InchesToPoints(0.35)).Position = InchesToPoints(0.35)
Selection.ParagraphFormat.TabStops.ClearAll
ActiveDocument.DefaultTabStop = InchesToPoints(0.5)
Selection.ParagraphFormat.TabStops.Add Position:=InchesToPoints(0.35), Alignment:=wdAlignTabDecimal, Leader:=wdTabLeaderSpaces
Re: [WORD] Align To Decimal
The complicated bit is knowing where to put the decimal tab though.
The tabs would be in different positions depending upon the number of decimal places in the column.
I suppose I could manually work it out then have a lookup table, but calculating it seems better.
Psuedo code of what I am trying to do
Code:
A = Column Width
B = String Width
Tab position = (A / 2) - (B / 2)
Although the tab wouldnt be exactly in this position due to the decimal place being after the negative sign and the first 0 :ehh: :sick: