【问题标题】:How to change characters spacing in Powerpoint with C#如何使用 C# 在 Powerpoint 中更改字符间距
【发布时间】:2018-09-19 03:52:37
【问题描述】:

我只想用 C# 更新 Powerpoint 中的字符间距,但我不知道该怎么做。我迭代了SlidesShapes,但我在Font 中找不到像Word 这样的Spacing 属性。

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】:

如果有人需要,只需在此处粘贴代码即可。

                            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;
                                }
                            }

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-11
    • 1970-01-01
    • 2014-12-06
    • 1970-01-01
    相关资源
    最近更新 更多