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
2 answers

OpenXML, PresentationML Table Height and Row Height on word wrap

I'm new to Open Xml, and have created a reporting application using Open Xml SDK. It populates the data in to a table, and when the table height exceeds slide border clone the slide and and populate the next set of data in new slides and so on. All…
Aneef
  • 3,641
  • 10
  • 43
  • 67
4
votes
2 answers

Changing the margins of a Word Document

I have created a web part with a button that once clicked generates a word document containing the list item values of particular list. I want to be able to change the margins for the document (top, bottom margins), but I am unsure as to how to…
Dev P
  • 1,157
  • 5
  • 32
  • 54
4
votes
2 answers

OpenXML 2.0 Gets wrong cell value

I'm having a bit of a problem reading a value from an Excel 2010 worksheet. On a standard Excel 2010 worksheet I have a cell with the currency format with two decimal places and the value 1270,14 €. When I read this value on OpenXML 2.0 (C# code) I…
Gil
  • 1,113
  • 2
  • 12
  • 13
4
votes
1 answer

What frameworks built upon Open XML SDK are there?

Since the Open XML SDK only provides strongly typed classes it does not really take pain of creating and manipulating Open XML documents. Are there any frameworks built upon the Open XML SDK that do what a framework is supposed to do: adding a new…
Kuepper
  • 992
  • 13
  • 39
4
votes
2 answers

Powerpoint OpenXML whitespace is disappearing

I'm coming across a problem where whitespace is being removed in powerpoint documents as soon as I reference a slide. The following code sample illustrates what I mean- //Open the document. using(PresentationDocument presentationDocument =…
ptrc
  • 840
  • 8
  • 16
4
votes
1 answer

Open XML SDK: How to update Excel cell?

I am trying to update a cell in Excel's spreadsheet via Open XML SDK: test.xlsx using System.Linq; using DocumentFormat.OpenXml.Packaging; using DocumentFormat.OpenXml.Spreadsheet; namespace DotNetSandbox.SO { public class CellUpdating { …
Adam Shakhabov
  • 1,194
  • 2
  • 14
  • 35
4
votes
1 answer

How to copy content of Rich Text Content Control from Word document and remove the control itself using Open XML SDK

I'm trying to copy the content of Rich Text Content Control(s) from one to another Word document. Each of Rich Text Content Control(s) contains a text block and a few of Plain Text Content Controls. The code below seems to work... using…
hex494D49
  • 9,109
  • 3
  • 38
  • 47
4
votes
1 answer

OpenXML: Anyway to see if a Word Document fits one page

While I doubt it, if I open up a word document using OpenXML sdk in C# and add some info, is there any way for me to see if it still fits one page? If it doesn't I wan't to reduce font size on specific items I added until it fits. I could write this…
Ingó Vals
  • 4,788
  • 14
  • 65
  • 113
4
votes
1 answer

Open XML SDK - image not showing in excel

I'm able to successfully create a spreadsheet, and I appear to have added the image via code, the problem is that when I open the spreadsheet, there is no image. Here is my code: public static void CreateSpreadsheetWorkbook(string filepath) …
hoakey
  • 998
  • 3
  • 18
  • 34
4
votes
2 answers

open xml excel Insert actual value in the placeholder

I have a cell that contains the placeholder "$$value" in the Excel sheet, the thing is that I need to replace the placeholder's actual value using Open XML and save it as separate workbook. Here is the code that I tried...it is not replacing the…
kart
  • 625
  • 3
  • 12
  • 21
4
votes
1 answer

C# Open XML Find Row Offset of Excel

I am using Open XML for excel manipulation in C#. I have scenario where I want Row number of merged cell using Cell Value like below is sheet and I will pass product name and it will return its row offset Excel Template I am using below linq…
4
votes
1 answer

Open Xml - File Needs To Be Repaired To Open

I am having an issue where the file generation process works as expected, but when I open the excel file it says that it is corrupt and needs to be repaired. When the repair is complete, the file opens and all of the data is there. The error…
4
votes
1 answer

Using OpenXML SDK with .Net framework 4.0

We are building our application in .Net framework 4.0 and need to have reference to OpenXML v2.0 sdk for generating word documents. OpenXML needs .Net 3.5 Sp1 (even though we have .net 4.0 installed on the system, it insists on installing .net 3.5…
Premkumar
  • 111
  • 1
  • 8
4
votes
1 answer

Close OpenXML Document Without Saving

From what I understand, when you open, edit, then close an OpenXML document such as an .DOCX file, the revised document is automatically saved. If you change your mind and decide not to save the edits, is there a way to close the document without…
Len White
  • 892
  • 13
  • 25
4
votes
2 answers

How do I have Open XML spreadsheet "uncollapse" cells in a spreadsheet?

I'm working with xslx Excel file on the server side in C#. In a spreadsheet, say there are 15 columns (cells) total. In the rows of cells, some values are missing. So the first row is my header will properly have the 15 cells. But my data rows,…
Shane
  • 4,185
  • 8
  • 47
  • 64