我编写了一个代码,将演示文稿中的所有幻灯片保存为 jpeg。它在我系统上本地的 Visual Studio 中运行良好,但是当我在 Azure 应用服务上部署它时,我收到 500 内部服务器错误。
编码:
using pptd = NetOffice.PowerPointApi;
using NetOffice.PowerPointApi.Enums;
using NetOffice.OfficeApi.Enums;
public void genThumbnails(string originalfileName,string renamedFilename, string dirPath)
{
pptd.Application pptApplication = new pptd.Application();
pptd.Presentation pptPresentation = pptApplication.Presentations.Open(dirPath + renamedFilename, MsoTriState.msoFalse, MsoTriState.msoFalse, MsoTriState.msoFalse);
int i = 0;
foreach (pptd.Slide pptSlide in pptPresentation.Slides)
{
pptSlide.Export(dirPath + originalfileName + "_slide" + i + ".jpg", "jpg", 1280, 720);
i++;
}
pptPresentation.Close();
}
我在做什么错误?NetOffice 软件包是否也需要像 Office.Interop 一样在服务器上安装 MS Office?