open-xml-sdk - DocumentFormat.OpenXml 2.12.0-ci0024

The Open XML SDK provides tools for working with Office Word, Excel, and PowerPoint documents. It supports scenarios such as:

  • High-performance generation of word-processing documents, spreadsheets, and presentations.
  • Populating content in Word files from an XML data source.
  • Splitting up (shredding) a Word or PowerPoint file into multiple files, and combining multiple Word/PowerPoint files into a single file.
  • Extraction of data from Excel documents.
  • Searching and replacing content in Word/PowerPoint using regular expressions.
  • Updating cached data and embedded spreadsheets for charts in Word/PowerPoint.
  • Document modification, such as removing tracked revisions or removing unacceptable content from documents.

PM> Install-Package DocumentFormat.OpenXml -Version 2.12.0-ci0024 -Source https://dotnet.myget.org/F/open-xml-sdk/api/v3/index.json

Copy to clipboard

> nuget.exe install DocumentFormat.OpenXml -Version 2.12.0-ci0024 -Source https://dotnet.myget.org/F/open-xml-sdk/api/v3/index.json

Copy to clipboard

> dotnet add package DocumentFormat.OpenXml --version 2.12.0-ci0024 --source https://dotnet.myget.org/F/open-xml-sdk/api/v3/index.json

Copy to clipboard
<PackageReference Include="DocumentFormat.OpenXml" Version="2.12.0-ci0024" />
Copy to clipboard
source https://dotnet.myget.org/F/open-xml-sdk/api/v3/index.json

nuget DocumentFormat.OpenXml  ~> 2.12.0-ci0024
Copy to clipboard

> choco install DocumentFormat.OpenXml --version 2.12.0-ci0024 --source https://dotnet.myget.org/F/open-xml-sdk/api/v2

Copy to clipboard
Import-Module PowerShellGet
Register-PSRepository -Name "open-xml-sdk" -SourceLocation "https://dotnet.myget.org/F/open-xml-sdk/api/v2"
Install-Module -Name "DocumentFormat.OpenXml" -RequiredVersion "2.12.0-ci0024" -Repository "open-xml-sdk" -AllowPreRelease
Copy to clipboard

Open XML SDK

NuGet Downloads Build Status MyGet

The Open XML SDK provides tools for working with Office Word, Excel, and PowerPoint documents. It supports scenarios such as:

  • High-performance generation of word-processing documents, spreadsheets, and presentations.
  • Populating content in Word files from an XML data source.
  • Splitting up (shredding) a Word or PowerPoint file into multiple files, and combining multiple Word/PowerPoint files into a single file.
  • Extraction of data from Excel documents.
  • Searching and replacing content in Word/PowerPoint using regular expressions.
  • Updating cached data and embedded spreadsheets for charts in Word/PowerPoint.
  • Document modification, such as adding, updating, and removing content and metadata.

Table of Contents

Releases

The official release NuGet packages for Open XML SDK are available on Nuget.org.

The NuGet package for the latest builds of the Open XML SDK is available as a custom feed on MyGet. You can trust this package source, since the custom feed is locked and only this project feeds into the source. Stable releases here will be mirrored onto NuGet and will be identical.

For latests changes, please see the changelog

Package currently supports the following targets:

  • .NET 3.5
  • .NET 4.0
  • .NET 4.6
  • .NET Standard 1.3
  • .NET Standard 2.0.

How to install the NuGet package

The package you want to install is DocumentFormat.OpenXml.

NuGet packages are available for release builds or CI Builds and follow semantic versioning.

The package feed or the package source is specified by the feed URL. Depending on your version of Visual Studio, choose the appropriate feed URL from the table below.

Table 1: The latest builds are available via a MyGet feed.

Client Feed URL
NuGet V3 (Visual Studio 2015+) https://dotnet.myget.org/F/open-xml-sdk/api/v3/index.json
NuGet V2 (Visual Studio 2012+) https://dotnet.myget.org/F/open-xml-sdk/api/v2

The Install-Package command considers the package source either via configuration or argument. Also, the package version can vary. For the latest version info, see the feed for the DocumentFormat.OpenXml package.

  • To specify the package source via a configuration option, see Configuring NuGet behavior. Note that usually a NuGet.config file is placed in the directory and the configuration options are added there to ensure the sources are persisted in the version control.

    PM> Install-Package DocumentFormat.OpenXml -Version <version retrieved from the web>
    
  • To pass the feed URL as an argument, here is an example for Visual Studio 2015 and later.

    PM> Install-Package DocumentFormat.OpenXml -Version <version retrieved from the web> -Source https://dotnet.myget.org/F/open-xml-sdk/api/v3/index.json
    

Note: If you have trouble installing the package, try restarting Visual Studio. Package sources could be cached and changes you've made to any NuGet.config files may not be detected.

If You Have Problems

If you want to report a problem (bug, behavior, build, distribution, feature request, etc...) with the SDK built by this repository, please feel free to post a new issue and someone will try to help.

If you have "how-to" questions please post to one of the following resources:

Known Issues

  • On .NET Core and .NET 5, zip packages do not have a way to stream data. Thus, the working set can explode in certain situations. This is a known issue.
  • On .NET Core, targeting .NET Framework 4.5+, and .NET 5, System.Uri will not parse invalid links. This causes an exception. A workaround in v2.12.0+ of OpenXml SDK is to use OpenSettings.RelationshipErrorRewriter to rewrite them to something that can be parsed. A discussion is available here to enable something more robust in System.IO.Packaging.
  • On .NET Framework, an IsolatedStorageException may be thrown under certain circumstances. This generally occurs when manipulating a large document in an environment with an AppDomain that does not have enough evidence. A sample with a workaround is available here.

Documentation

The functionality of the specific classes in this version of the Open XML SDK is similar to version 2.5, therefore the Open XML SDK 2.5 for Office documentation available on MSDN is still accurate.

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 available for you to edit and review in GitHub.

Related tools

  • Open XML Powertools: This provides example code and guidance for implementing a wide range of Open XML scenarios.
  • ClosedXml: This library provides a simplified object model on top of the OpenXml SDK for manipulating and creating Excel documents.
  • Serialize.OpenXml.CodeGen: This is a tool that converts an OpenXml document into the .NET code required to create it.
  • Html2OpenXml: This is a tool that takes HTML and converts it to an OpenXml document.
  • DocxToSource: This is a tool designed to be a replacement for the old OpenXML SDK Productivity Tool.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information, see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Version 2.12.0

Added

  • Added OpenSettings.RelationshipErrorHandlerFactory to provide a way to handle URIs that break parsing documents with malformed links (#793)
  • Added OpenXmlCompositeElement.AddChild(OpenXmlElement) to add children in the correct order per schema (#774)
  • Added SmartTagClean and SmartTagId in place of SmtClean and SmtId (#747)
  • Added OpenXmlValidator.Validate(..., CancellationToken) overrides to allow easier cancellation of long running validation on .NET 4.0+ (#773)
  • Added overloads for CellValue to take decimal, double, and int, as well as convenience methods to parse them (#782)
  • Added validation for CellType for numbers and date formats (#782)
  • Added OpenXmlReader.GetLineInfo() to retrieve IXmlLineInfo of the underlying reader if available (#804)

Removed

  • Removed explicit reference to System.IO.Packaging on .NET 4.6 builds (#774)

Version 2.11.3 - 2020-07-17

Fixed

  • Fixed massive performance bottleneck when IndexReferenceConstraint and ReferenceExistConstraint are involved (#763)
  • Fixed CellValue to only include three most signficant digits on second fractions to correct issue loading dates (#741)
  • Fixed a couple of validation indexing errors that might cause erroneous validation errors (#767)
  • Updated internal validation system to not use recursion, allowing for better short-circuiting (#766)

Version 2.11.2 - 2020-07-10

Fixed

  • Fixed broken source link (#749)
  • Ensured compilation is deterministic (#749)
  • Removed extra file in NuGet package (#749)

Version 2.11.1 - 2020-07-10

Fixed

  • Ensure .NET Framework builds pass PEVerify (#744)
  • OpenXmlPartContainer.DeletePart no longer throws an exception if there isn't a match for the identifier given (#740)
  • Mark obsolete members to not show up with Intellisense (#745)
  • Fixed issue with AttributeRequiredConditionToValue semantic constraint where validation could fail on correct input (#746)

Version 2.11.0 - 2020-05-21

Added

  • Added FileFormatVersions.2019 enum (#695)
  • Added ChartSpace and chart elements for the new 2016 namespaces. This allows the connecting pieces for building a chart part with chart styles like "Sunburst" (#687).
  • Added OpenXmlElementFunctionalExtensions.With(...) extension methods, which offer flexible means for constructing OpenXmlElement instances in the context of pure functional transformations (#679)
  • Added minimum Office versions for enum types and values (#707)
  • Added additional CompatSettingNameValues values: UseWord2013TrackBottomHyphenation, AllowHyphenationAtTrackBottom, and AllowTextAfterFloatingTableBreak (#706)
  • Added gfxdata attribue to Arc, Curve, Line, PolyLine, Group, Image, Oval, Rect, and RoundRect shape complex types per MS-OI29500 2.1.1783-1799 (#709)
  • Added OpenXmlPartContainer.TryGetPartById to enable child part retrieval without exception if it does not exist (#714)
  • Added OpenXmlPackage.StrictRelationshipFound property that indicates whether this package contains Transitional relationships converted from Strict (#716)

Fixed

  • Custom derived parts did not inherit known parts from its parent, causing failure when adding parts (#722)

Changes

  • Marked the property setters in OpenXmlAttribute as obsolete as structs should not have mutable state (#698)

Version 2.10.1 - 2020-02-28

Fixed

  • Ensured attributes are available when OpenXmlElement is initialized with outer XML (#684, #692)
  • Some documentation errors (#681)
  • Removed state that made it non-thread safe to validate elements under certain conditions (#686)
  • Correctly inserts strongly-typed elements before known elements that are not strongly-typed (#690)

Version 2.10.0 - 2020-01-10

Added

  • Added initial Office 2016 support, including FileFormatVersion.Office2016, ExtendedChartPart and other new schema elements (#586)
  • Added .NET Standard 2.0 target (#587)
  • Included symbols support for debugging (#650)
  • Exposed IXmlNamespaceResolver from XmlPath instead of formatted list of strings to expose namespace/prefix mapping (#536)
  • Implemented IComparable<T> and IEquatable<T> on OpenXmlComparableSimpleValue to allow comparisons without boxing (#550)
  • Added OpenXmlPackage.RootPart to easily access the root part on any package (#661)

Changes

  • Updated to v4.7.0 of System.IO.Packaging which brings in a number of perf fixes (#660)
  • Consolidated data for element children/properties to reduce duplication (#540, #547, #548)
  • Replaced opaque binary data for element children constraints with declarative model (#603)
  • A number of performance fixes to minimize allocations where possible
  • 20% size reduction from 5.5mb to 4.3mb
  • The validation subsystem went through a drastic redesign. This may cause changes in what errors are reported.

Fixed

  • Fixed some documentation inconsistencies (#582)
  • Fixed ToFlatOpcDocument, ToFlatOpcString, FromFlatOpcDocument, and FromFlatOpcString to correctly process Alternative Format Import Parts, or "altChunk parts" (#659)

Version 2.9.1 - 2019-03-13

Changed

  • Added a workaround for a .NET Native compiler issue that doesn't support calling Marshal.SizeOf
  • Fixed a documentation error (#528)

Version 2.9.0 - 2018-06-08

Added

  • ListValue now implements IEnumerable<T> (#385)
  • Added a WebExtension.Frozen and obsoleted misspelled Fronzen property (#460)
  • Added an OpenXmlPackage.CanSave property that indicates whether a platform supports saving without closing the package (#468)
  • Simple types (except EnumValue and ListValue) now implement IComparable<T> and IEquatable<T> (#487)

Changed

  • Removed state that was carried in validators that would hold onto packages when not in use (#390)
  • EnumSimpleType parsing was improved and uses less allocations and caches for future use (#408)
  • Fixed a number of spelling mistakes in documentation (#462)
  • When calling OpenXmlPackage.Save on .NET Framework, the package is now flushed to the stream (#468)
  • Fixed race condition while performing strict translation of attributes (#480)
  • Schema data for validation uses a more compact format leading to a reduction in dll size and performance improvements for loading (#482, #483)
  • A number of APIs are marked as obsolete as they have simple workarounds and will be removed in the next major change
  • Fixed some constraint values for validation that contained Office 2007, even when it was only supported in later versions
  • Updated System.IO.Packaging to 4.5.0 which fixes some issues on Xamarin platforms as well as minimizes dependencies on .NET Framework

Version 2.8.1 - 2018-01-03

Changed

  • Corrected package license file reference to show updated MIT License

Version 2.8.0 - 2017-12-28

Added

  • Default runtime directive for better .NET Native support.

Changed

  • Fixed part saving to be encoded with UTF8 but no byte order mark. This caused some renderers to not be able to open the generated document.
  • Fixed exceptions thrown when errors are encountered while opening packages to be consistent across platforms.
  • Fixed issue on Mono platforms using System.IO.Packaging NuGet package (Xamarin, etc) when creating a document.
  • Fixed manual saving of a package when autosave is false.
  • Fixed schema constraint data and standardized serialization across platforms.
  • Upgraded to System.IO.Packaging version 4.4.0 which fixes some consistency with .NET Framework in opening packages.

Version 2.7.2 - 2017-06-06

Added

  • Package now supports .NET 3.5 and .NET 4.0 in addition to .NET Standard 1.3 and .NET Framework 4.6

Changed

  • Fixed issue where assembly version wasn't set in assembly.

Version 2.7.1 - 2017-01-31

Changed

  • Fixed crash when validation is invoked on .NET Framework with strong-naming enforced.

Version 2.7.0 - 2017-01-24

Added

  • SDK now supports .NET Standard 1.3

Changed

  • Moved to using System.IO.Packaging from dotnet/corefx for .NET Standard 1.3 and WindowsBase for .NET 4.5.
  • Cleaned up project build system to use .NET CLI.

Version 2.6.1 - 2016-01-15

Added

  • Added hundreds of XUnit tests. There are now a total of 1333 tests. They take about 20 minutes to run, so be patient.

Version 2.6.0 - 2015-06-29

Added

  • Incorporated a replacement System.IO.Packaging that fixes some serious (but exceptional) bugs found in the WindowsBase implementation
  • .NETFramework 3.5
  • .NETFramework 4.0
  • .NETFramework 4.6
  • .NETStandard 1.3
    • NETStandard.Library (>= 1.6.1)
    • System.IO.Packaging (>= 4.7.0)
  • .NETStandard 2.0
    • System.IO.Packaging (>= 4.7.0)
  • .NETFramework 3.5: 3.5.0.0
  • .NETFramework 4.0: 4.0.0.0
  • .NETFramework 4.6: 4.6.0.0
  • .NETStandard 1.3: 1.3.0.0
  • .NETStandard 2.0: 2.0.0.0

Signature validation information

Informational

Signature Hash Algorithm: SHA256

Timestamp: 9/30/2020 5:52:21 PM

Verifying author primary signature's timestamp with timestamping service certificate: 
  Subject Name: CN=Symantec SHA256 TimeStamping Signer - G3, OU=Symantec Trust Network, O=Symantec Corporation, C=US
  SHA1 hash: A9A4121063D71D48E8529A4681DE803E3E7954B0
  SHA256 hash: C474CE76007D02394E0DA5E4DE7C14C680F9E282013CFEF653EF5DB71FDF61F8
  Issued by: CN=Symantec SHA256 TimeStamping CA, OU=Symantec Trust Network, O=Symantec Corporation, C=US
  Valid from: 12/23/2017 12:00:00 AM to 3/22/2029 11:59:59 PM

Signature type: Author

Verifying the author primary signature with certificate: 
  Subject Name: CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US
  SHA1 hash: F404000FB11E61F446529981C7059A76C061631E
  SHA256 hash: 3F9001EA83C560D712C24CF213C3D312CB3BFF51EE89435D3430BD06B5D0EECE
  Issued by: CN=DigiCert SHA2 Assured ID Code Signing CA, OU=www.digicert.com, O=DigiCert Inc, C=US
  Valid from: 2/26/2018 12:00:00 AM to 1/27/2021 12:00:00 PM

Owners

Taylor Southwick Tom Jebo

Authors

Microsoft

Project URL

https://github.com/OfficeDev/Open-XML-SDK

License

´╗┐The MIT License (MIT)

Tags

openxml office

Signature

Validation: Valid

Info

972 total downloads
0 downloads for version 2.12.0-ci0024
Download (8.62 MB)
Found on the current feed only

Package history

Version Size Last updated Downloads Mirrored?
2.12.0-ci0024 8.62 MB Wed, 30 Sep 2020 17:55:00 GMT 0
2.12.0-ci0023 8.62 MB Sun, 20 Sep 2020 04:34:29 GMT 0
2.12.0-ci0022 8.62 MB Thu, 17 Sep 2020 21:08:33 GMT 0
2.12.0-ci0021 8.63 MB Thu, 17 Sep 2020 14:51:36 GMT 0
2.12.0-ci0020 8.62 MB Wed, 02 Sep 2020 20:42:16 GMT 0
2.12.0-ci0019 8.62 MB Wed, 02 Sep 2020 20:46:53 GMT 0
2.12.0-ci0018 8.62 MB Wed, 02 Sep 2020 19:59:46 GMT 0
2.12.0-ci0017 8.62 MB Wed, 02 Sep 2020 19:53:03 GMT 0
2.12.0-ci0016 8.62 MB Tue, 25 Aug 2020 17:05:50 GMT 0
2.12.0-ci0015 8.61 MB Tue, 11 Aug 2020 19:24:15 GMT 0
2.11.3 8.66 MB Fri, 17 Jul 2020 18:58:01 GMT 0
2.11.2 8.72 MB Fri, 10 Jul 2020 23:32:38 GMT 0
2.11.1 8.72 MB Fri, 10 Jul 2020 20:14:15 GMT 0
2.11.0 8.37 MB Thu, 21 May 2020 21:51:35 GMT 0
2.10.1 8.53 MB Fri, 28 Feb 2020 20:02:50 GMT 0
2.10.0 8.53 MB Fri, 10 Jan 2020 22:16:47 GMT 0
2.9.1 8.11 MB Thu, 14 Mar 2019 19:07:57 GMT 0
2.9.0 8.11 MB Fri, 25 Jan 2019 20:15:34 GMT 0
2.8.1 8.62 MB Sat, 06 Jan 2018 01:30:03 GMT 38
2.8.0 8.63 MB Fri, 29 Dec 2017 05:51:30 GMT 3
2.7.2 8.81 MB Tue, 06 Jun 2017 23:06:14 GMT 246
2.7.1 4.29 MB Tue, 31 Jan 2017 21:22:04 GMT 685