对于 C#
File.Copy(SourceFile,ExportedFile);
您基本上保留原始文件。
现在您打开 ExportedFile
PowerPoint.Application ppApp = new PowerPoint.Application();
PowerPoint.Presentation presentation;
presentation = ppApp.Presentations.Open(ExportedFile, MsoTriState.msoFalse, MsoTriState.msoTrue, MsoTriState.msoTrue);
现在迭代所有幻灯片/形状
foreach (PowerPoint.Slide slide in presentation.Slides)
{
slide.Select();
foreach (PowerPoint.Shape shape in slide.Shapes)
{
if (shape.Type.ToString().Equals("<any type of shape>"))
{
if (shape.TextFrame.TextRange.Text.Equals("<contains a name"))
{
shape.TextFrame.TextRange.Text = <new value>;
shape.Delete(); // or delete
shape.AddPicture(<your new picture>, MsoTriState.msoTrue, MsoTriState.msoTrue, left, top, width, height);
}
}
}
}
希望这可以澄清您的要求。