Select the product you need help with
Considerations for server-side Automation of OfficeArticle ID: 257757 - View products that this article applies to. This article was previously published under Q257757 On This PageSummaryDevelopers can use Automation in Microsoft Office to build custom solutions that use the capabilities and the features that are built into the Office product. Although such programmatic development can be implemented on a client system with relative ease, a number of complications can occur if Automation takes place from server-side code such as Microsoft Active Server Pages (ASP), ASP.NET, DCOM, or a Windows NT service. This article discusses the complications that developers may face. The article also offers alternatives to Automation that can speed performance. Developers should be aware, however, that the suggestions that this article provides are for informational purposes only. Microsoft does not recommend or support server-side Automation of Office. Note In this context, the Microsoft 2007 Office System Driver and the 2010 Access Database Engine are considered Microsoft Office components. The term "server-side" also applies to code that is running on a Windows workstation, if the code is running from a Windows workstation other than the interactive station of the user who is logged on. For example, code that is started by Task Scheduler under the SYSTEM account runs in the same environment as "server-side" ASP code or as DCOM code. Therefore, many of the issues that this article describes may occur. For more information about Windows workstations and about COM, see the "More Information" section and the "References" section. More informationAll current versions of Microsoft Office were designed, tested, and configured to run as end-user products on a client workstation. They assume an interactive desktop and user profile. They do not provide the level of reentrancy or security that is necessary to meet the needs of server-side components that are designed to run unattended. 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. Problems using server-side Automation of OfficeDevelopers who try to use Office in a server-side solution need to be aware of five major areas in which Office behaves differently than anticipated because of the environment. If your code is to run successfully, you must address these issues and minimize their effects as much as possible. Consider these issues carefully when you build your application. One solution cannot address all the issues. Different designs require you to prioritize the elements differently.
In addition to these issues, one of the following common errors may occur when you try to automate Office server-side:
Alternatives to server-side AutomationMicrosoft strongly recommends that developers find alternatives to Automation of Office if they need to develop server-side solutions. Because of the limitations to Office's design, changes to Office configuration are not enough to resolve all issues. Microsoft strongly recommends a number of alternatives that do not require Office to be installed server-side, and that can perform most common tasks more efficiently and more quickly than Automation. Before you involve Office as a server-side component in your project, consider alternatives.Most server-side Automation tasks involve document creation or editing. Office 2007 supports new Open XML file formats that let developers create, edit, read, and transform file content on the server side. These file formats use the System.IO.Package.IO namespace in the Microsoft .NET 3.x Framework to edit Office files without using the Office client applications themselves. This is the recommended and supported method for handling changes to Office files from a service. The Open XML file formats are a public standard. To obtain a copy of the specification, visit the following Web site: http://www.ecma-international.org/publications/standards/Ecma-376.htm Microsoft provides an SDK for manipulating Open XML file formats from the .NET 3.x Framework. For more information about the SDK and about how to use the SDK to create or edit Open XML files, visit the following Microsoft Developer Network (MSDN) Web sites:
(http://www.ecma-international.org/publications/standards/Ecma-376.htm)
Open XML SDK Documentation http://msdn.microsoft.com/en-us/library/bb226703.aspx
(http://msdn.microsoft.com/en-us/library/bb226703.aspx)
How to: Manipulate Office Open XML Formats Documents http://msdn.microsoft.com/en-us/library/aa982683.aspx
(http://msdn.microsoft.com/en-us/library/aa982683.aspx)
Manipulating Word 2007 Files with the Open XML Object Model (Part 1 of 3) http://msdn.microsoft.com/en-us/library/bb656295.aspx
(http://msdn.microsoft.com/en-us/library/bb656295.aspx)
Manipulating Word 2007 Files with the Open XML Object Model (Part 2 of 3) http://msdn.microsoft.com/en-us/library/bb739835.aspx
(http://msdn.microsoft.com/en-us/library/bb739835.aspx)
Manipulating Word 2007 Files with the Open XML Object Model (Part 3 of 3) http://msdn.microsoft.com/en-us/library/bb727374.aspx
(http://msdn.microsoft.com/en-us/library/bb727374.aspx)
Manipulating Excel 2007 and PowerPoint 2007 Files with the Open XML Object Model (Part 1 of 2) http://msdn.microsoft.com/en-us/library/bb739834.aspx
(http://msdn.microsoft.com/en-us/library/bb739834.aspx)
Manipulating Excel 2007 and PowerPoint 2007 Files with the Open XML Object Model (Part 2 of 2) http://msdn.microsoft.com/en-us/library/bb727373.aspx
(http://msdn.microsoft.com/en-us/library/bb727373.aspx)
Building Server-Side Document Generation Solutions Using the Open XML Object Model (Part 1 of 2) http://msdn2.microsoft.com/en-us/library/bb735940.aspx
(http://msdn2.microsoft.com/en-us/library/bb735940.aspx)
Building Server-Side Document Generation Solutions Using the Open XML Object Model (Part 2 of 2) For more
information about using Open XML from the .NET 3.0 Framework and for an
example, click the following article numbers to view the articles in the
Microsoft Knowledge Base: http://msdn2.microsoft.com/en-us/library/bb735939.aspx
(http://msdn2.microsoft.com/en-us/library/bb735939.aspx)
932921
(http://support.microsoft.com/kb/932921/
)
How to use components of the .NET Framework 3.0 to create and then to stream an Office Word 2007 document and an Office Excel 2007 workbook to a client computer
931866 Users who are running earlier versions of Office
(such as Office 2000, Office XP, and Office 2003) can view and edit Open XML
files if the users install the free compatibility pack download from the
Microsoft Web site. To download and install the compatibility pack, visit the
following Microsoft Web site:
(http://support.microsoft.com/kb/931866/
)
How to use the Office XML file format and the packaging components from the .NET Framework 3.0 to create a simple Excel 2007 workbook or a simple Word 2007 document
Microsoft Office Compatibility Pack for Word, Excel, and PowerPoint 2007 file formats When you stream Open XML files from ASP or from ASP.NET, you must provide the correct Multipurpose Internet Mail Extension (MIME) type for the content that you stream. For a listing of the MIME types for Office 2007 files, visit the following Web site:http://office.microsoft.com/en-us/products/HA101686761033.aspx
(http://office.microsoft.com/en-us/products/HA101686761033.aspx)
http://blogs.msdn.com/b/vsofficedeveloper/archive/2008/05/08/office-2007-open-xml-mime-types.aspx If you are targeting pre-Office 2007 clients only, and you do not want to require the use of Open XML in the solution, you can use other non-binary Office file formats, such as HTML, XML, and RTF. You can then stream these files to a client by using a MIME type so that the resulting text appears in Office. The document can be edited, saved, and even returned to the server by using ASP on the server.
(http://blogs.msdn.com/b/vsofficedeveloper/archive/2008/05/08/office-2007-open-xml-mime-types.aspx)
For more information about any of these topics, and for examples that show how to implement them, click the following article numbers to view the articles in the Microsoft Knowledge Base: 270906
(http://support.microsoft.com/kb/270906/
)
How to use ASP to generate a Rich Text Format (RTF) document to stream to Microsoft Word
198703
(http://support.microsoft.com/kb/198703/
)
How to automate Excel from a client-side VBScript
199841
(http://support.microsoft.com/kb/199841/
)
How to display ASP results using Excel in IE with MIME types
260239
(http://support.microsoft.com/kb/260239/
)
How to format cell data when you are creating an Excel file with an Active Server Pages page
278973
(http://support.microsoft.com/kb/278973/
)
ExcelADO demonstrates how to use ADO to read and write data in Excel workbooks
286023
(http://support.microsoft.com/kb/286023/
)
How to use a VB ActiveX component for Word automation from Internet Explorer
288130 If your business requires the server-side creation of the Office 97, Office 2000, Office XP, and Office 2003 binary file formats, third-party vendors offer components that can help you. Microsoft does not provide any such components, so you will need to either build a solution yourself or purchase one from a third-party vendor. Many different third-party products are available. You should investigate each solution to best match the vendor to your business needs.If you want to build your own solution that edits the Office
97, Office 2000, Office XP, and Office 2003 binary file formats directly, you
can obtain the file format specifications for free under the terms of the
Microsoft Open Specification Promise (OSP). No technical support is available
for the documentation or for the products that you create, but documentation is
available. For more information, visit the following Web site:
(http://support.microsoft.com/kb/288130/
)
How to use ASP to build spreadsheet XML for client-side display
http://www.microsoft.com/interop/docs/officebinaryformats.mspx Server-side solutions also may want to allow users to upload
files, and then have the server render the files for viewing on the Web or on
other mediums. Microsoft is currently working to offer such features, and
provides an early version of this capability in Microsoft Excel
Services.
(http://www.microsoft.com/interop/docs/officebinaryformats.mspx)
Excel Services is a new server technology that is included in Microsoft Office SharePoint Server 2007 and that enables you to load, calculate, and display Excel workbooks on Office SharePoint Server 2007. For more information about Excel Services, visit the following Microsoft Developer Network (MSDN) Web sites: Excel Services Overview http://msdn.microsoft.com/en-us/library/ms546696.aspx
(http://msdn.microsoft.com/en-us/library/ms546696.aspx)
Walkthrough: Developing a Custom Application Using Excel Web Services http://msdn2.microsoft.com/en-us/library/ms519100.aspx
(http://msdn2.microsoft.com/en-us/library/ms519100.aspx)
Creating Business Applications by Using Excel Services and Office Open XML Formats Word Automation Services is a new service application in SharePoint Server 2010. Word Automation Services provides unattended, server-side conversion of documents into formats that are supported by the Microsoft Word client application.http://msdn.microsoft.com/en-us/library/cc540662.aspx
(http://msdn.microsoft.com/en-us/library/cc540662.aspx)
Word Automation Services Overview http://msdn.microsoft.com/en-us/library/ee558830.aspx
(http://msdn.microsoft.com/en-us/library/ee558830.aspx)
Introducing Word Automation Services You
need to evaluate which of the options that this article describes suits your
needs, and how best to deploy your solution. The information that this article
provides is not guaranteed to resolve all issues for all clients. You are
encouraged to test your solution thoroughly before you deploy the solution.
http://blogs.msdn.com/b/microsoft_office_word/archive/2009/10/26/introducing-word-automation-services.aspx
(http://blogs.msdn.com/b/microsoft_office_word/archive/2009/10/26/introducing-word-automation-services.aspx)
PropertiesArticle ID: 257757 - Last Review: July 12, 2013 - Revision: 19.3 Applies to
| Article Translations
|


Back to the top








