如何用C#更改Powerpoint中的字符间距

问题描述 投票:0回答:1

我只想用C#更新Powerpoint中的字符间距,但我不知道该怎么做。我迭代SlidesShapes,但我找不到Spacing中的Font属性,如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;
    }

}
c# powerpoint office-interop kerning
1个回答
0
投票

如果有人需要,只需将代码粘贴到此处。

                            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;
                                }
                            }
© www.soinside.com 2019 - 2024. All rights reserved.