在 Microsoft Graph 中是否有互操作的替代方案?

Is there an alternative to interop in microsoft graph?

我目前正在使用 interop 自动更新 word 模板,然后将其转换为 pdf。

我看到很多链接都说微软不建议使用互操作来自动化任何类型的办公室工作,因为它可能表现不当。

我面临着类似的问题,这就是为什么我正在寻找更好的替代方法来更新 docx。自动文件,然后将其转换为 pdf。

我在microsoft graph中搜索相同,但只发现文档可以由用户编辑。如果我遗漏了什么,请帮助我。

提前致谢。

您需要使用 Open XML SDK 即时处理 Word 文档(仅限打开 XML 文档)。有关详细信息,请参阅 Welcome to the Open XML SDK 2.5 for Office

从其他应用程序自动执行 Word 可能需要更多时间,并且有以下限制:

Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, ASP.NET, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when Office is run in this environment.

If you are building a solution that runs in a server-side context, you should try to use components that have been made safe for unattended execution. Or, you should try to find alternatives that allow at least part of the code to run client-side. If you use an Office application from a server-side solution, the application will lack many of the necessary capabilities to run successfully. Additionally, you will be taking risks with the stability of your overall solution.

Considerations for server-side Automation of Office 文章中阅读更多相关信息。