C# 如何使用PowerPoint API控制挂起缩进?
我正在用C#编程创建PowerPoint 2007演示文稿,但当我添加文本时,第二行缩进。在UI中,我会通过进入主页->段落->缩进并将“文本前”设置为“0”,将“特殊”设置为“无”。我如何通过编程来完成同样的事情C# 如何使用PowerPoint API控制挂起缩进?,c#,api,ms-office,powerpoint,C#,Api,Ms Office,Powerpoint,我正在用C#编程创建PowerPoint 2007演示文稿,但当我添加文本时,第二行缩进。在UI中,我会通过进入主页->段落->缩进并将“文本前”设置为“0”,将“特殊”设置为“无”。我如何通过编程来完成同样的事情 PowerPoint.Application app = new PowerPoint.Application(); PowerPoint.Presentation p = app.Presentations.Add(Office.MsoTriStat
PowerPoint.Application app = new PowerPoint.Application();
PowerPoint.Presentation p = app.Presentations.Add(Office.MsoTriState.msoTrue);
app.Visible = Office.MsoTriState.msoTrue;
PowerPoint.CustomLayout customLayout = p.SlideMaster.CustomLayouts[PowerPoint.PpSlideLayout.ppLayoutText];
PowerPoint.Slide slide = p.Slides.AddSlide(p.Slides.Count + 1, customLayout);
PowerPoint.Shape textShape = slide.Shapes[2];
textShape.TextFrame.TextRange.ParagraphFormat.Bullet.Type = PowerPoint.PpBulletType.ppBulletNone;
PowerPoint.TextRange range1 = textShape.TextFrame.TextRange.InsertAfter(@"Just enough text so that wrapping occurs.");
range1.Font.Size = 54;
p.SaveAs(@"c:\temp\test1.pptx", PowerPoint.PpSaveAsFileType.ppSaveAsDefault, Office.MsoTriState.msoTrue);
p.Close();
app.Quit();
所以。。。如何摆脱悬挂缩进?在PPT 2007及以上版本中,使用形状的TextFrame2.Textrange.parages(x).ParagraphFormat
属性。LeftIndent为您提供段落的整体缩进,.FirstLineIndent为您提供第一行的缩进(它与.LeftIndent值相关)您一针见血!谢谢史蒂夫!碰巧我也在敲打同一根钉子