O
Oliver Bock
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
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