当扩展名为“.ppt”时,我可以使用该Microsoft.office.interop.powerpoint.presentation.slide export
方法拆分文件,但对于 pptx 文件,它不起作用。
有什么帮助吗?
当扩展名为“.ppt”时,我可以使用该Microsoft.office.interop.powerpoint.presentation.slide export
方法拆分文件,但对于 pptx 文件,它不起作用。
有什么帮助吗?
您可以在拆分之前将 *.pptx 文件转换为 *.ppt 文件。
一些示例代码供您参考:
using System;
using System.Collections.Generic;
using System.Text;
using PowerPoint = Microsoft.Office.Interop.PowerPoint;
using Microsoft.Office.Core;
namespace pptxTOppt
{
class Program
{
static void Main(string[] args)
{
PowerPoint.Application app = new PowerPoint.Application();
string sourcePptx = @"c:\test.pptx";
string targetPpt = @"c:\test.ppt";
object missing = Type.Missing;
PowerPoint.Presentation pptx = app.Presentations.Open(sourcePptx, MsoTriState.msoTrue, MsoTriState.msoTrue, MsoTriState.msoTrue);
pptx.SaveAs(targetPpt, PowerPoint.PpSaveAsFileType.ppSaveAsPowerPoint4);
app.Quit();
}
}
}
回复太晚了。但这可能对其他人有帮助
foreach ( Slide slides in Pres.Slides)
{
slides.Export(Filename, "pptx" (or the target type), Scale-Width, Scale-Height);
}