1 minute read
I’m just starting to work on a Web Service that will generate Word 2007 documents from a set of templates. The inputs will be data from a SharePoint list. (More on that part of it when I get there.)
As I began setting up the Web Service, I realized that the System.IO.Packaging and Microsoft.Office.DocumentFormat.OpenXml.Packaging assemblies don’t seem to be available to add as references if the project is a Web Service. If your project is a Windows application, they are.
I had already downloaded and installed the assemblies:
Microsoft .NET Framework 3.0. You need to use the System.IO.Packaging namespace. You can download and install the .NET Framework 3.0 from the .NET Framework Developer Center.
Open XML object model API. You can download and install the Microsoft SDK for Open XML Formats Technology Preview from the Microsoft Office Developer Center.
Then I needed to manually add the references:
- local_drive:\Program Files\Reference Assemblies\Microsoft\Framework\v3.0\WindowsBase.dll
- local_drive:\Program Files\2007 Office System Developer Resources\OpenXMLSDK\1.0.0531\lib\Microsoft.Office.DocumentFormat.OpenXml.dll
Finally, I added the following code to web.config:
<compilation debug="true"> <assemblies> <add assembly="Microsoft.Office.DocumentFormat.OpenXml, Version=1.0.531.0,
Culture=neutral, PublicKeyToken=31BF3856AD364E35"/> <add assembly="WindowsBase, Version=126.96.36.199, Culture=neutral,
PublicKeyToken=31BF3856AD364E35"/> </assemblies> </compilation>