Office 365 仍然可以实现 Office 服务器端自动化? [英] Office server-side Automation still possible with Office 365?

查看:64
本文介绍了Office 365 仍然可以实现 Office 服务器端自动化?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 ASP.NET Webforms 应用程序,用户可以在其中使用服务器端办公自动化创建报告.它基本上适用于正在填写的 FormFields,最终用户可以下载 Office 文档.应用程序很旧,我没有设计这个软件.我也知道办公服务器自动化和这篇文章的副作用:

I have an ASP.NET Webforms Application where the user can create reports with server-side office Automation. It basically works with FormFields that are being filled out and in the end the user gets a download with the Office document. The Application is quite old and I did not design this software. I'm also aware of the side effects of office server Automation and this article:

https:///support.microsoft.com/en-us/help/257757/thinkations-for-server-side-automation-of-office

它在几个不同的 Office 版本上只工作了将近 15 年,最新的是 Office 2016,但现在我必须知道它是否仍然适用于 Office 365.它看起来像一个混合解决方案,软件即服务,但仍然需要以某种方式安装在机器上.

It just works for almost 15 years with several different Office Versions, the newest one is Office 2016 but now I have to know if it still would work with Office 365. It looks like a hybrid solution, Software as a Service but still requires installation on the machine somehow.

设置如下有点麻烦:

IIS 应用程序用户需要取得以下文件夹的所有权:

IIS Application User needs to take ownership of the following folder:

  • C:\Programme(x86)\Microsoft Office
  • C:\Programme\Microsoft Office
  • C:\Windows\System32\config\systemprofile\AppData
  • C:\Windows\System32\config\systemprofile\Desktop(有时会丢失所以需要创建)
  • C:\Windows\SysWOW64\config\systemprofile\AppData
  • C:\Windows\SysWOW64\config\systemprofile\Desktop(有时会丢失所以需要创建)
  • C:\Programme(x86)\Microsoft.Net\
  • C:\Program Files (x86)\Microsoft ASP.NET\

此外,还需要一些 Word 和 Excel 的 DCOM 配置.IIS 应用程序用户需要启动办公应用程序等的权限.

And in addition, some DCOM Configuration for Word and Excel needed. The IIS Application User needs permission to start the office application etc.

我不确定 Office 365 是否仍然存在所有必需的依赖项.

I'm not sure if all the requiered dependency are still there with office 365.

这是一个代码片段:

Function CreateDoc(ByVal docpath As String, ByVal docname As String, ByVal Document As String) As String

        Dim ff_name As String = ""
        Dim strFileName As String = Nothing
        Dim strExtension As String = Nothing
        Dim fileBytes As Byte() = Nothing


        Try

            Dim w = New Word.Application

            w.Visible = m_obj.Project.OfficeDisplay
            w.DisplayAlerts = Word.WdAlertLevel.wdAlertsNone
            w.Documents.Open(docpath)

            SetRanges(Document)

            Dim i As Integer

            For Each ff As Word.FormField In w.ActiveDocument.FormFields
            .
            .
            .

推荐答案

到目前为止,Microsoft Office 桌面版没有任何变化.但我建议使用 Open XML SDK 在服务器端生成文档,请参阅 欢迎使用 Open XML SDK 2.5 for Office 了解更多信息.

Nothing has been changed so far with desktop editions of Microsoft Office. But I'd recommend using the Open XML SDK for generating documents on the server-side, see Welcome to the Open XML SDK 2.5 for Office for more information.

这篇关于Office 365 仍然可以实现 Office 服务器端自动化?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆