dotnet / dotnet/Open-XML-SDK

Cannot open presentation theme (.thmx) file

Open
#739 5 comments 2 reactions 1 assignee Claimed by @tomjebo View on GitHub
request: feature
Dominant language
C#
Stars
4.6k
Forks
605
PR merge metrics
No merged PRs in 30d

Description

Is this a:
- [x] Issue with the OpenXml library
- [ ] Question on library usage

**Description**

Trying to preserve themes and and generate presentations with specific themes (with slidelayouts). The logical way to store themes seemed like the thmx. It cannot be opened with OpenXML SDK.

**Information**

- .NET Target: .NET Framework 4.7.2
- DocumentFormat.OpenXml Version: 2.10

**Repro**

Open a presentation with the desired theme. Go to Design tab, open Themes and "Save current theme..."

Write a simple code that tries to open it:
using (PresentationDocument themeDocument = PresentationDocument.Open(@"d:\temp\OfficeTheme.thmx", false)){}

**Observed**

Exception is thrown:
DocumentFormat.OpenXml.Packaging.OpenXmlPackageException
HResult=0x80131500
Message=The specified package is not valid.
Source=DocumentFormat.OpenXml
StackTrace:
at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.Load()
at DocumentFormat.OpenXml.Packaging.OpenXmlPackage.OpenCore(String path, Boolean readWriteMode)
at DocumentFormat.OpenXml.Packaging.PresentationDocument.Open(String path, Boolean isEditable, OpenSettings openSettings)
at DocumentFormat.OpenXml.Packaging.PresentationDocument.Open(String path, Boolean isEditable)

The MainPartContentType will be "application/vnd.openxmlformats-officedocument.themeManager+xml" which is not a valid content type.

**Expected**

PresentationDocument is loaded.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.