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
6
votes
1 answer

How can I retrieve some image data and format using MS Open XML SDK?

This is a follow-up question to How can I retrieve images from a .pptx file using MS Open XML SDK? How can I retrieve: The image data from a DocumentFormat.OpenXml.Presentation.Picture object? The image name and/or type? in, say, the…
user610650
6
votes
2 answers

How can I retrieve images from a .pptx file using MS Open XML SDK?

I started experimenting with Open XML SDK 2.0 for Microsoft Office. I'm currently able to do certain things such as retrieve all texts in each slide, and get the size of the presentation. For example, I do the latter this way: using (var doc =…
user610650
6
votes
1 answer

where can i find office open xml complete reference?

i am planning to develop a server side generation of MS office files with the help of office open XML method..... I found only less examples/reference in microsoftsite.... does any one know where can i find the complete…
Jeba Prince
  • 1,669
  • 4
  • 22
  • 41
6
votes
3 answers

Using Open XML how do you insert a formula into an Excel 2010 worksheet?

I'm using Visual Studio 2010 (VB.Net) and Open XML SDK 2.0. How do you insert a formula into an Excel 2010 worksheet? When I do this I also wish to set the CellValue property of the cell to a DBNull or EmptyString to force Excel to recalculate the…
vbasic321
  • 61
  • 1
  • 2
6
votes
1 answer

new lines, default font and size (open xml sdk)

What I need is to insert a new line at the end of a text. I try with run.Append(**new Break()**); but this simulates to pressing (Shift+Enter) keys, and if I want a justified text the latest line autofits with lot of spaces between word and…
Displaying
  • 117
  • 3
  • 8
6
votes
1 answer

Resources for learning about Word XML format?

What resources would you recommend to learn about the Microsoft's Open Office format (the XML format introduced with Office 2007, not to be confused with OpenOffice.org), specifically for .docx Word files? (Ideally, ones with lots of samples and…
Tony the Pony
  • 40,327
  • 71
  • 187
  • 281
6
votes
1 answer

Read Password Protected Excel Files Using OpenXml

I have an Excel file which is password protected. I am using OpenXml to read the excel files. As shown in the below code snippet, there is no overload/ Optional Parameter to specify Password. _document = SpreadsheetDocument.Open(_stream, false); I…
Saurabh Rai
  • 361
  • 2
  • 18
6
votes
2 answers

Copying a slide from one presentation to another using Open XML SDK

Sorry my English :) There is a code using (var sourceDoc = PresentationDocument.Open(@"d:\source.pptx", false)) { using (var destDoc = PresentationDocument.Open(@"d:\dest.pptx", true)) { } } I try copy slide №2 from sourceDoc and paste…
Adam Shakhabov
  • 1,194
  • 2
  • 14
  • 35
6
votes
3 answers

how to programmatically access the builtin properties of an open xml worddoc file

i would like to access some built in properties(like author,last modified date,etc.) of an open xml word doc file. i would like to use open xml sdk2.0 for this purpose. so i wonder if there is any class or any way i could programmatically access…
stazera
  • 293
  • 1
  • 3
  • 9
6
votes
2 answers

Removing a formula from Excel using OpenXML

I am trying to remove all formulas from a sheet using openxml. This what I am trying: internal static void ReplaceFormulaWithValue() { var res = _worksheetPart.Worksheet.GetFirstChild().Elements(); foreach (Row row in…
Tacy Nathan
  • 344
  • 1
  • 6
  • 15
6
votes
1 answer

How to make a section optional when mapped to optional data in a Word OpenXml Part?

I'm using OpenXml SDK to generate word 2013 files. I'm running on a server (part of a server solution), so automation is not an option. Basically I have an xml file that is output from a backend system. Here's a very simplified example:
Steve B
  • 36,818
  • 21
  • 101
  • 174
6
votes
1 answer

Adding a date in an Excel cell using OpenXML

This is what I am doing: CellFormat cellFormat = new CellFormat() { NumberFormatId = (UInt32Value)14U, FontId = (UInt32Value)0U, FillId = (UInt32Value)0U, …
Tacy Nathan
  • 344
  • 1
  • 6
  • 15
6
votes
1 answer

Using TDD with OpenXml-SDK

I have started using a TDD approach to develop a small app that reads data from Excel files. Using a repository pattern type approach I have come to a hurdle which baffles me. In order to read the Excel files, I am using the OpenXml-SDK. Now…
Ahmad
  • 22,657
  • 9
  • 52
  • 84
6
votes
4 answers

Excel "Refresh All" with OpenXML

I have an excel 2007 file (OpenXML format) with a connection to an xml file. This connection generates an excel table and pivot charts. I am trying to find a way with OpenXML SDK v2 to do the same as the "Refresh All" button in Excel. So that I…
Julio Guerra
  • 5,523
  • 9
  • 51
  • 75
6
votes
2 answers

C# to replace strings of text in a docx

Using C#, is there a good way to find and replace a text string in a docx file without having word installed on that machine?
TimothyAWiseman
  • 14,385
  • 12
  • 40
  • 47