Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Controlling horizontal anchor points in PowerPoint 2010

59 views
Skip to first unread message

Oliver Bock

unread,
Mar 7, 2010, 9:30:48 PM3/7/10
to
If you use add a TextFrame to a PowerPoint slide and then enter new
text, the frame will expand to the right. However if you rotate it and
then add extra text it will expand equally to both left and right. That
is, the horizontal anchor point moves to the centre when text is rotated.

PowerPoint 2007 also exhibitted this behaviour in the GUI, but not when
I added objects using C# + COM interop. The code below works on
PowerPoint 2000, 2002, 2003 and 2007, but not on 2010.

PowerPoint.Shape text =
shapes.AddLabel(MsoTextOrientation.msoTextOrientationHorizontal, 0, 0,
0, 0);
text.TextFrame.HorizontalAnchor = MsoHorizontalAnchor.msoAnchorNone;
text.TextFrame.TextRange.ParagraphFormat.Alignment =
PpParagraphAlignment.ppAlignLeft;
text.TextFrame.VerticalAnchor = MsoVerticalAnchor.msoAnchorMiddle;
text.TextFrame.TextRange.Text = s;
text.Left = (float)x;
text.Top = (float)y;
double degrees = angle * 180.0 / Math.PI;
text.Rotation = (float)degrees;

In PowerPoint 2010 the position of the new label is wrong because it
rotates about its centre. I am trying to position a label on the
perimeter of a circle (at x,y) and I want the label text to grow away
from this point.

Is there any way to force the horizontal anchor point to the left side
with rotated text?


Oliver

Colbert Zhou [MSFT]

unread,
Mar 9, 2010, 9:00:05 AM3/9/10
to
Hello Oliver,

The issue is caused from the shape size and autofit mode. You can try the
following codes to achieve what you want in PowerPoint 2010,

Sub Test()
Dim text As Shape
Set text =
Application.ActivePresentation.Slides(1).Shapes.AddLabel(msoTextOrientationH


orizontal, 0, 0, 0, 0)

text.TextFrame.HorizontalAnchor = msoAnchorNone
text.TextFrame.TextRange.ParagraphFormat.Alignment = ppAlignLeft
text.TextFrame.VerticalAnchor = msoAnchorMiddle
text.TextFrame.TextRange.text = "sssssssssss"
text.Left = 30
text.Top = 30
Dim degrees As Double
degrees = 45 * 180 / 3.1415926
text.Height = 0
text.Width = 0
text.TextFrame.AutoSize = ppAutoSizeNone
text.Rotation = degrees
End Sub


Best regards,
Ji Zhou - MSFT
Microsoft Online Community Support

0 new messages