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

Loading an online image in a word document

Im developing a wpf app that simply inserts an image to a word document. Each time the word document is open i want the picture to call the image from a server, for example (server.com/Images/image_to_be_insert.png) My code is as follow: …
Batman
  • 378
  • 1
  • 3
  • 11
4
votes
3 answers

How to split a document in OpenXML SDK

I need to split a document in OpenXml sdk 2.0. The document has sections that each have a footer with a text element (name of the section). Is there a straightforward way to copy from one OpenXml document to another?
jle
  • 9,316
  • 5
  • 48
  • 67
4
votes
2 answers

Open XML: Delete entire excel column using column index

I have got column index for an excel column in a spreadsheet and need to delete the entire column using this column index. I am confined to use Open XML SDK 2.0. using DocumentFormat.OpenXml.Packaging; using…
Devraj Gadhavi
  • 3,541
  • 3
  • 38
  • 67
4
votes
0 answers

Open XML SDK - Adding a macro programatically to a Word 2007 document

I am trying to dynamically add a new custom ribbon in a Word 2007 document following teh manual method described in this article :- http://msdn.microsoft.com/en-us/library/aa338202(v=office.12).aspx. The article specifies the following :- a) Create…
Ashish Gupta
  • 14,869
  • 20
  • 75
  • 134
4
votes
1 answer

Open XML change fontsize of table

for (var i = 0; i <= data.GetUpperBound(0); i++) { var tr = new DocumentFormat.OpenXml.Wordprocessing.TableRow(); for (var j = 0; j <= data.GetUpperBound(1); j++) { var tc = new…
Ben V.
  • 43
  • 1
  • 1
  • 6
4
votes
1 answer

How can I get an Excel worksheet's used range with OpenXML?

I need to get the used range of cells in a new worksheet. For example: A1:AY55 In Excel VBA, this can be obtained through the aptly named UsedRange property. Is there an equivalent in OpenXML?
Eric Eskildsen
  • 4,269
  • 2
  • 38
  • 55
4
votes
1 answer

Inserting WorkSheet with Open XML - "...unreadable content..."

When I follow this tutorial: http://msdn.microsoft.com/en-us/library/cc881781.aspx to open an Excel document and insert an empty worksheet the final result is a message telling "Excel found unreadable content in ... Do you want to recover the…
Gomiunik
  • 410
  • 4
  • 11
4
votes
3 answers

c# OpenXML search and replace text not saving

I'm trying to do a basic search and replace of text on a .docx word document using OpenXML and Eric White's OpenXmlPowerTools (installed from NuGet). I've followed examples on this site and his blog, but for some reason I never see the changes…
Bret Lien
  • 153
  • 2
  • 8
4
votes
1 answer

Unable to set desired background color in excel using openxml

I am new to open xml and trying to set the background color of header row to gray but it always set it to black. Please refer following code which I am using. return new Stylesheet( new Fonts( new Font( …
Yashpal S
  • 299
  • 4
  • 16
4
votes
1 answer

Programming Word XML in .NET

I'm currently in a development team trying to come up with an app that will be able to accept an Open XML Word document, shred the XML and somehow come up with UI screens on the fly that could be used for data entry. I'm using the Open XML SDK but…
Rufus
  • 61
  • 4
4
votes
2 answers

How to add a comment to a cell in Excel 2007 using the Open XML SDK 2.0?

Has anyone ever had any luck figuring out how to add a comment to Excel using the Open XML SDK 2.0? I couldn't find any documentation on where to get started on this issue.
amurra
  • 15,221
  • 4
  • 70
  • 87
4
votes
1 answer

How to get the row height in Excel?

Is there any way to get row height of excel row in openxml? In my case, i use openxml 2.0 to generate excel table from .net datatable. For each datatable row, i define new row in excel by row = new Row() { RowIndex = rowIndex }; after that i…
Truong Pham
  • 41
  • 1
  • 3
4
votes
1 answer

Can't find method GetCellValue in C# when trying to read values in Excel file

I'm going according to the MS tutorial for retrieving Excel values from a spreadsheet using OpenXML Using directives as specified using DocumentFormat.OpenXml.Packaging; using DocumentFormat.OpenXml.Spreadsheet; But for the life of me I cannot get…
Kevin T
  • 132
  • 1
  • 1
  • 11
4
votes
1 answer

Styling Run/Paragraph to support both RTL and LTR words

How can I style a Run and/or Paragraph to support both RTL and LTR words? The problem is: I have a complex text which contains both Persian and English words, and I'm trying to create a .docx document using OpenXML SDK. But, the English words, get…
amiry jd
  • 27,021
  • 30
  • 116
  • 215
4
votes
1 answer

C# OpenXML memory leak

I had noticed memory leak in my application and tried to find it out. I don't know good and free memory leaking discovering techniques (any suggestions?) so I made it simple - inserted memory usage prints (with and without GC) and then dig deeper…
Alex
  • 4,457
  • 2
  • 20
  • 59