How to change characters spacing in Powerpoint with C#

234 Views Asked by At

I just want to update the characters spacing in Powerpoint with C#, but I don't know how to do it. I iterate Slides and Shapes, but I cannot find a Spacing property in Font like Word.

int slideCount = pprst.Slides.Count;
for (int s = 1; s <= slideCount; ++s )
{
    MSPPT.Slide slide = pprst.Slides[s];
    int shapeCount = slide.Shapes.Count;
    for (int h = 1; h <= shapeCount; ++h)
    {
        MSPPT.Shape shape = slide.Shapes[h];
        MSPPT.TextRange textRange = shape.TextFrame.TextRange;
    }

}
1

There are 1 best solutions below

0
On

Just paste the code here if someone need it.

                            MSPPT.Slide slide = pprst.Slides[s];
                            int shapeCount = slide.Shapes.Count;
                            for (int h = 1; h <= shapeCount; ++h)
                            {
                                MSPPT.Shape shape = slide.Shapes[h];
                                if (shape.HasTextFrame == MsoTriState.msoTrue)
                                {
                                    if (shape.TextFrame2.HasText == MsoTriState.msoTrue)
                                    {
                                        shape.TextFrame2.TextRange.Font.Spacing = 0;
                                    }
                                    else
                                    {
                                        continue;
                                    }
                                }
                                else
                                {
                                    continue;
                                }
                            }