Skip to content

tommywu23/Open-XML-SDK

 
 

Repository files navigation

Open-XML-SDK

The Open XML SDK provides open-source libraries for working with Open XML Documents (DOCX, XLSX, and PPTX). It supports scenarios such as:

  • High-performance generation of word-processing documents, spreadsheets, and presentations
  • Document modification, such as removing tracked revisions or removing unacceptable content from documents
  • Data and content querying and extraction, such as transformation from DOCX to HTML, or extraction of data from spreadsheets

Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

Documentation

This release of the SDK is the exact source code for version 2.5, therefore the documentation available on MSDN is still accurate.

Open XML SDK 2.5 for Office

In addition to open sourcing of the SDK, Microsoft has opened up the conceptual documentation for public review / contributions. A copy of the documentation is now in GitHub for you to edit and review.

Build Instructions

For a video that shows how to get and build the SDK, see this blog post at OpenXmlDeveloper.org.

Note: for this first release, you must have some version of Visual Studio installed. Visual Studio 2012 Express Edition will work just fine: http://www.microsoft.com/en-us/download/details.aspx?id=34673

Set Execution Policy for PowerShell

In order to run the script that builds the Open XML SDK, you need to set the execution policy. To set the execution policy, you must run PowerShell as administrator.

  • Right click on the PowerShell shortcut, and click "Run as administrator". An easy way to find the PowerShell shortcut is to click the Start button, then type PowerShell. The PowerShell shortcut will be in the search results above the start menu.
  • Click the Yes button in the User Account Control dialog box.
  • Run the command to set the execution policy: The the PowerShell prompt, type: Set-ExecutionPolicy Unrestricted
  • The Set-ExecutionPolicy cmdlet asks: Do you want to change the execution policy? [Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Press Y Enter
  • You can exit the PowerShell session that is running as administrator. At the PowerShell prompt, type: Exit

Build the Open XML SDK Libraries

  • Start a Visual Studio command prompt. It does not need to run as administrator.
  • Change directories into the directory that contains this README.md, and the PowerShell script BldSdk.ps1 For instance, type: CD C:\users\username\Documents\Open-Xml-Sdk
  • Start PowerShell. At the DOS command prompt, type: PowerShell Enter
  • Run the PowerShell script to build the libraries: Type: ./BldSdk.ps1 Enter
  • The build will commence - it can take a few seconds, up to a minute, depending on the speed of your computer.
  • Find the debug libraries in the folder: ./build/OpenXmlSdkLib/Debug. Find the release libraries in the folder: ./build/OpenXmlSdkLib/Release

Building with Mono

Building with Visual Studio

The Visual Studio project contains a pre-build command line that launches a PowerShell script which sets the version string of the AssemblyInfo.cs (in roughly the same way as the normal command line build script). To be able to execute that pre-build command line, you must also set the execution policy as described above. Should you have multiple PowerShell shortcuts, you must use the right one for your Visual Studio installation.

If you get the error "The command "cd C:\Users\Eric\Documents\Open-Xml-Sdk
powershell ./SetAssemblyVersionString.ps1" exited with code 1, then you need to set your execution policy. There is a different execution policy for PowerShell scripts that are run from Visual Studio. To set this execution policy:

  • Start a COMMAND prompt (not PowerShell console) as Administrator
  • Enter the following command:

C:\windows\system32>c:\windows\syswow64\WindowsPowerShell\v1.0\powershell.exe -command set-executionpolicy unrestricted

About

Open XML SDK by Microsoft Open Technologies, Inc.

Resources

License

Stars

Watchers

Forks

Packages

No packages published