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

Is there functionality that is NOT exposed in the OpenXML SDK v2?

I want to know if there is anything that you cannot do with SDK that was exposed in the COM interface?
Willbill
  • 4,673
  • 6
  • 24
  • 25
6
votes
1 answer

OpenXML: Replace element with table in WordprocessingML

I'm using the OpenXML SDK to programatically replace some elements with chunks of OpenXML (WordProcessingML) markup. For example, I have a paragraph with these contents: Text before
willvv
  • 8,439
  • 16
  • 66
  • 101
6
votes
1 answer

OpenXML - Get Image Alt Text Title

I am attempting to iterate through the images in a PowerPoint presentation using OpenXML. I have worked out how to do that. I am now attempting to get the Images Alt-Text Title.... Here is my code: List imageParts = new…
Trevor Daniel
  • 3,785
  • 12
  • 53
  • 89
6
votes
2 answers

Write word form fields with DocumentFormat.OpenXML SDK

I am writing an application which should use DocumentFormat.OpenXML SDK for writing data to form fields in a word template. But I cannot find a property in the document-object of the SDK where the form fields are stored. I tried this code: using…
Philipp Eger
  • 2,235
  • 4
  • 23
  • 34
6
votes
2 answers

Relationship between Sheet and Worksheet

As to MSDN the basic document structure of a SpreadsheetML document consists of the Sheets and Sheet elements, which reference the worksheets in the Workbook. For example, there is one workbook with sheets:
chaika_sv
  • 384
  • 1
  • 4
  • 16
6
votes
1 answer

How does Excel show decimal values correctly although no information is stored in the worksheet.xml and styles.xml about the precision of the decimal?

Here are the steps I am following to examine the behavior: 1# Create an Excel(xlsx) file, put 1234.56789 in a cell, save it. 2# Extract the .xlsx file, see the sheet1.xml and styles.xml files. In the xl/worksheets/Sheet1.xml you will see…
Thunderstruck
  • 335
  • 4
  • 15
6
votes
1 answer

How to define data type?

I have to create a big XLSX file. I use OpenXmlWriter to do the task as fast as possible. The file is properly create, but i can't change the data type of the field. It's always standard type, and i would like to use number format for some of…
Habib Rahmoun
  • 218
  • 2
  • 8
6
votes
1 answer

Adding to WordprocessingDocument opened from MemoryStream without getting "Memory stream is not expandable"?

Using Open XML SDK, the following gives "Memory stream is not expandable" when I reach the line FeedData(msData): // Bytes in, bytes out internal static byte[] UpdateDataStoreInMemoryStream(byte[] bytes, XmlDocument xdocData) { using (var…
Stein-Tore Erdal
  • 473
  • 1
  • 6
  • 15
6
votes
2 answers

steps to create excel XML spreadsheet using c#

We have got a requirement like exporting data into excel sheet in Xml Format like creating a new XML SpreadSheet I have followed this link for creating excel xml Spreadsheet. In this link he has mentioned sample < ?xml version="1.0"?> <…
Glory Raj
  • 17,397
  • 27
  • 100
  • 203
6
votes
2 answers

How to add content control in a Word 2007 document using OpenXML

I want to create a word 2007 document without using object model. So I would prefer to create it using open xml format. So far I have been able to create the document. Now I want to add a content control in it and map it to xml. Can anybody guide me…
Anoop
  • 5,246
  • 6
  • 27
  • 29
6
votes
1 answer

OpenXML Spreadsheet- Preserve space before or after the value when writing a cell value

I am using OPENXML SDK 2.0 to stream the spread sheet file. The source data is come from data table and writing this to Spreadsheet using openxml. If there is a one of the column data of a data table has " Treshold%" (this text has tab space on…
user2390252
  • 61
  • 1
  • 2
6
votes
1 answer

Convert OpenXML SDK .docx files to PDF

I am filling a word template with data from the database, using OpenXML sdk 2.5 and i need to export the result in PDF. I am currently using a server-side Interop approach but from time to time I get the…
user1761123
6
votes
1 answer

How do I know the font size (for example) of a specific piece of text in a word document?

The idea is simple, but the answer may get complicated: In fact, I can check the run properties for the font size. If absent I need to check the style applied to the paragraph in order to find the run properties defined for the font size, then that…
Jose Cordeiro
  • 131
  • 1
  • 7
6
votes
1 answer

Getting OpenXmlElements between CommentRangeStart and CommentRangeEnd

What I am trying to do is find the OpenXMLElements between a CommentRangeStart and the corresponding CommentRangeEnd. I have tried two methods to achieve this however the problem is a CommentRangeEnd does not need to be on the same level as the…
Mike B
  • 1,166
  • 11
  • 11
6
votes
2 answers

Justification in text from tableCell with OpenXML SDK 2.0

I want to apply a text alignment in table cell in a table with OpenXML. I don't understand why it is not applied. Table table = new Table(); TableRow tableHeader = new TableRow(); table.AppendChild(tableHeader); TableCell tableCell = new…
Aelios
  • 11,849
  • 2
  • 36
  • 54