但我问“怎么样?”特别是“从图像列表?”
这就是我打破ppt到图像的方法
var app = new PowerPoint.Application();var pres = app.Presentations;var file = pres.Open(input,MsoTriState.msoFalse,MsoTriState.msoFalse);file.SaveAs(output,Microsoft.Office.Interop.PowerPoint.PpSaveAsfileType.ppSaveAsJPG,MsoTriState.msoTrue);file.Close();app.Quit();
我该如何反过来?
解决方法 它会是这样的:string picturefilename = "C:\temp\test.jpg"; Application pptApplication = new Application();Microsoft.Office.Interop.PowerPoint.SlIDes slIDes;Microsoft.Office.Interop.PowerPoint._SlIDe slIDe;Microsoft.Office.Interop.PowerPoint.TextRange objText;// Create the Presentation filePresentation pptPresentation = pptApplication.Presentations.Add(MsoTriState.msoTrue);Microsoft.Office.Interop.PowerPoint.CustomLayout customLayout = pptPresentation.SlIDeMaster.CustomLayouts[Microsoft.Office.Interop.PowerPoint.PpSlIDeLayout.ppLayoutText];// Create new SlIDeslIDes = pptPresentation.SlIDes;slIDe = slIDes.AddSlIDe(1,customLayout);// Add TitleobjText = slIDe.Shapes[1].TextFrame.TextRange;objText.Text = "test";objText.Font.name = "Arial";objText.Font.Size = 32;objText = slIDe.Shapes[2].TextFrame.TextRange;objText.Text = "Content goes here\nYou can add text\nItem 3";Microsoft.Office.Interop.PowerPoint.Shape shape = slIDe.Shapes[2];slIDe.Shapes.AddPicture(picturefilename,Microsoft.Office.Core.MsoTriState.msoFalse,Microsoft.Office.Core.MsoTriState.msoTrue,shape.left,shape.top,shape.WIDth,shape.Height);slIDe.NotesPage.Shapes[2].TextFrame.TextRange.Text = "Test";pptPresentation.SaveAs(@"c:\temp\test.pptx",Microsoft.Office.Interop.PowerPoint.PpSaveAsfileType.ppSaveAsDefault,MsoTriState.msoTrue);//pptPresentation.Close();//pptApplication.Quit();总结
以上是内存溢出为你收集整理的c# – 如何以编程方式从图像列表中创建powerpoint全部内容,希望文章能够帮你解决c# – 如何以编程方式从图像列表中创建powerpoint所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)