2

What we do:

We create powerpoints documents for Powerpoint 2010 and Powerpoint 2003.

Where the problem is:

Lables created with following sourcecode appear different in Powerpoint 2010 and Powerpoint 2003. This error only occurs with lables with alignment = center and/or if we set rotation > 0. (see screenshot)

private Microsoft.Office.Interop.PowerPoint.Shape AddLabel(Microsoft.Office.Interop.PowerPoint.Slide Slide,
        float Left, float Top, float Width, float Height, string Text, float FontSize, 
        bool Bold, Microsoft.Office.Interop.PowerPoint.PpParagraphAlignment Alignment)
{
        Microsoft.Office.Interop.PowerPoint.Shape label;

        label = Slide.Shapes.AddLabel(
            Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationHorizontal,
            Left, Top, Width, Height);
        label.TextFrame.TextRange.Text = Text;
        label.TextFrame.TextRange.Font.Size = FontSize;
        label.TextFrame.TextRange.Font.Bold = Bold ? MsoTriState.msoTrue : MsoTriState.msoFalse;
        label.TextFrame.TextRange.ParagraphFormat.Alignment = Alignment;

        return label;
} 

[...]

label = AddLabel(slide, 50, (slide.Master.Height - 30) / 2, slide.Master.Height, 30,
            "Nutzen", 18, false, PpParagraphAlignment.ppAlignCenter);
label.Rotation = -90;

Does anybody know, if there is a simple way to make the source compatible to both Powerpoint versions?

enter image description here

Markus R.
  • 58
  • 10
  • 2
    PowerPoint 2003 and 2010 use fundementally different rendering techniques for shapes and slide positions. Unfortunately, you won't be able to have a single set of code for both. – Todd Main Sep 22 '11 at 19:16

0 Answers0