Questions tagged [openxml-sdk]

The Open XML SDK for Microsoft Office is built on top of the System.IO.Packaging API and provides strongly typed part classes to manipulate Open XML documents.

Open XML is an open ECMA 376 standard and is also approved as the ISO/IEC 29500 standard that defines a set of XML schemas for representing spreadsheets, charts, presentations, and word processing documents. Microsoft Office Word 2007, Excel 2007, and PowerPoint 2007 and later versions all use Open XML as the default file format.

The Open XML file formats are useful for developers because they use an open standard and are based on well-known technologies: ZIP and XML.

The Open XML SDK for Microsoft Office is built on top of the System.IO.Packaging API and provides strongly typed part classes to manipulate Open XML documents. (Use version 2.5 whenever possible as it fixes some problems in version 2.0.) The SDK also uses the .NET Framework Language-Integrated Query (LINQ) technology to provide strongly typed object access to the XML content inside the parts of Open XML documents.

The Open XML SDK simplifies the task of manipulating Open XML packages and the underlying Open XML schema elements within a package. The Open XML Application Programming Interface (API) encapsulates many common tasks that developers perform on Open XML packages, so you can perform complex operations with just a few lines of code.

Above is taken from the Overview section here.

In 2015 the Open XML SDK was made open source, public on GitHub. Version 2.6.0 was released which fixes a bug in the way it works with System.IO.Packaging. It is otherwise the same as 2.5. More details are available here.

1516 questions
0
votes
1 answer

Trying to get all pictures in a PowerPoint 2010 slide, but getting an error

I have a small console program that I'm writing that uses the Open XML SDK 2.0. I basically just want to get all pictures on a PowerPoint slide. When I run the program, though, I get the following error: Cannot access part because parent package…
Kevin
  • 4,798
  • 19
  • 73
  • 120
0
votes
1 answer

OpenXml ChangeDocumentType

I need to convert a powerpoint template from potx to pptx. As seen here: http://www.codeproject.com/Tips/366463/Create-PowerPoint-presentation-using-PowerPoint-te I have tried with the following code. However the resulting pptx document is invalid…
Atti
  • 160
  • 10
0
votes
1 answer

Adding a header to a Word doc created with HtmlToOpenXml not working

I am using HtmlToOpenXml to create a Word doc from a html site, that part is working fine. but after I created the Word doc, I am trying to add a header to the document, that part isn't working. It is working fine if I use a Word doc created in…
PNR
  • 555
  • 3
  • 12
  • 26
0
votes
1 answer

OpenXML Open SpreadsheetDocument from HTML

I'm trying to create an excel file from an HTML file using MVC5. My HTML is a table with some additional markup in the HTML tag
collinszac10
  • 198
  • 1
  • 1
  • 12
0
votes
1 answer

Cannot apply Cell styles in OpenXML spreadsheet

I have a problem with the Cell Style in OpenXml/C# code. I cannot define a style to a cell. I tried many ways to do this but I was unsuccessful. Can someone help me? This part of the code, to apply the Cell Style, is: Stylesheet stylesheet =…
0
votes
0 answers

How to add custom property in Microsoft Office 2007 Document

I am trying to add custom property in the Microsoft Office 2007 Document (docx) using the Open XML SDK. Ref: http://msdn.microsoft.com/en-us/library/office/hh674468(v=office.15).aspx The API sets the custom property but when trying to open the…
Prakash
  • 422
  • 1
  • 12
  • 31
0
votes
1 answer

Create Two Tables Side by Side in Open XML Word Document

I can create two tables easy enough but I am having trouble getting them to appear side by side like this: I am unsure how to achieve this using the Open XML SDK. I'm guessing it will either be a TableProperty or a trick with paragraphs but using…
Adam Knights
  • 2,141
  • 1
  • 25
  • 48
0
votes
1 answer

iterate two dimensional array only bring up one character of the end word

I have been writing some code to popular a word document through the content controls with XML mapping using open xml format sdk 2.0. I have an two dimensional array which I want to loop through and place each par of the information on a new line on…
willa
  • 629
  • 1
  • 9
  • 17
0
votes
1 answer

Merge Rich Text ( HTML ) to Word Document Content Control using Open XML

I have a word template which has a content control placeholder to hold rich text data. The data comes from a sharepoint list (rich text field) and may also include tables in it. On checking the data from sharepoint list I found it returns me a HTML…
user2975939
  • 65
  • 1
  • 10
0
votes
1 answer

How to set table caption with OpenXML?

I want to set caption to my table: var caption = new TableCaption(); caption.Val = "Test"; table.Append(caption); But nothing happens. Whats wrong here? UPADATE foreach (var tabl in mainPart.Document.Body.Descendants()) …
Kliver Max
  • 5,107
  • 22
  • 95
  • 148
0
votes
1 answer

converting docx,doc to open xml using open xml sdk 2.0 its working fine with docx when converting doc its error that file has corrupted data

if (fileExt == ".doc" || fileExt == ".docx") { using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(document,true)) { string docText = null; using (StreamReader sr =…
0
votes
1 answer

How to password-protect a VbaProjectPart using OpenXml SDK

I have a scenario where users download their Word document from our local server and when they save that document, instead of saving it locally, the document is sent back to the server using a macro (which is "injected" by the server every time a…
leandro koiti
  • 423
  • 1
  • 7
  • 18
0
votes
1 answer

Different excel column appearance when working with open xml

This question edited several times and I Found the problem and its solution. I edited this post for other users use. I created an excel file using open xml. The created excel file opens with no errors. It has the following problems: The size of…
Ali Fattahian
  • 495
  • 1
  • 6
  • 24
0
votes
3 answers

Editing custom XML part in word document sometimes corrupts document

We have a system that stores some custom templating data in a Word document. Sometimes, updating this data causes Word to complain that the document is corrupted. When that happens, if I unzip the docx file and compare the contents to the previous…
Jon
  • 16,212
  • 8
  • 50
  • 62
0
votes
1 answer

OPEN XML SDK Infinite Loop

I have written some code based on some tutorials to update an existing word document with data from my database tables. I keep getting the program crashing and advising that I may have an infinite loop, however I am using a for each statement and…
ccocker
  • 1,146
  • 5
  • 15
  • 39