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

Read XLSX file in C#

I have an Excel Workbook I am trying to read using DocumentFormat.OpenXml.Spreadsheet; using DocumentFormat.OpenXml.Packaging; but I'm unsure on how to know when the value is a date. Shared strings and numbers are fine but the type associated with…
mattpm
  • 1,310
  • 2
  • 19
  • 26
0
votes
1 answer

OpenXML Headers

I have a docx which I am processing using the OpenXML SDK. The doc.MainDocumentPart.HeaderParts property has 2 items in it, yet when I open the docx as a zip file, it has header1.xml up to header6.xml. How can I access (and modify) all of these…
user1365247
  • 337
  • 7
  • 17
0
votes
1 answer

Manipulating text of a document while it's open

Is it possible to extract, modify or simply read text in an Office while user types in words? It it possible through OpenXML SDK & InterOp library? Thanks.
0
votes
1 answer

Repaire Message in Office 2013 but open fine in other versions

I've generated a presentation using OpenXML SDK 2.0 which opens fine in Office 2007 or 2010 but gives Repaire message in Office 2013, OpenXML SDK Productivity tool validation functionality didn't provide much help. Can anyone please tell me what's…
Ali
  • 1,648
  • 2
  • 26
  • 48
0
votes
1 answer

With OpenXML how do I get the StyleIndex of an existing style in an excel spreadsheet

I am editing an existing excel spreadsheet with an existing cell Style in it called "myFavouriteStyle". Using OpenXML SDK V2 c# how do I find the StyleIndex of that style so I can apply it to new cell(s) I add to the spreadsheet. Thanks.
David
  • 560
  • 4
  • 13
0
votes
1 answer

Word Document creation using OpenXML

We are creating word document using openxml programatically. Everything works fine but when we protect the document also programactially using openxml for editing then contents of the document are getting affected for example the sentence نحاول…
Verybiztalker
  • 75
  • 1
  • 7
0
votes
1 answer

images get cropped in the generated presentation

i am using open xml sdk to copy slides into another presentation , when the slides are copied and my desired presentation is generated , I iterate through each slide of the generated document and replace its existing images with the image of my…
user8189
  • 79
  • 1
  • 10
0
votes
1 answer

Get selected value from StdContentComboBox

I would like to get the selected value from a StdContentComboBox, this is a Content control placed in a docx document. I need to get the selected value in .NET, Thanks
Rafael
  • 1,099
  • 5
  • 23
  • 47
0
votes
1 answer

Applying Style To A Document

How can I apply a style to a document like "CSS", but programmatically with OpenXML? I don't want to apply style to individual elements, but set defaults and have the document parts obey them. I've found HTMLToOpenXML, but would prefer doing this…
Dane Balia
  • 5,271
  • 5
  • 32
  • 57
0
votes
1 answer

How can we access rels file of a slide thorugh code?

I want to access rels file for slide for example "\ppt\slides\_rels\slide1.xml.rels" through open xml C#, how can i do this ?, or is there any property or method that returns these relationships. Please help.
user8189
  • 79
  • 1
  • 10
0
votes
2 answers

Insert a picture on the top of each page in an OpenXML document

I am creating OpenXML documents in C# for Word and I find always that it's not possible to determine where a page break will appears in the document. This creates the following problem: I want to insert on the top of each page a little image, which…
JonSmi
  • 1
  • 1
0
votes
1 answer

Maintain CSS styling when converting HTML to Docx in ASP.NET

I am trying to convert HTM to docx without using interop dll. I have tried with Dynamically generate a MS Word document using HTML & CSS and also with Html to OpenXml. I don't find a way to convert with HTML to Docx with all the styles and images…
San
  • 1,797
  • 7
  • 32
  • 56
0
votes
1 answer

How do I create a check box in C# using Open XML SDK

I would like to create a certain number of checkbox using Open XML SDK in C#. How would I do that? Example: (Checkbox) - Shoes (Checkbox) - Shirt The checkbox count also varies. I am reading a template document, then make edits to return. I have…
MrM
  • 21,709
  • 30
  • 113
  • 139
0
votes
1 answer

Get style of excel cell with Epplus

Is there any way to get the style of a specific cell with open xml sdk and epplus? Currently I'm getting the value in the following way: currentWorksheet.Cells[nRowId, 3].Text.Trim(); In adittion to this I want if there is a background color, and a…
ffffff01
  • 5,068
  • 11
  • 52
  • 61
0
votes
1 answer

Getting an Error Meassage "System.IO.FileFormatException: Compressed part has inconsistent data length" calling XmlDocument.Load()

I'm new to OpenXML,here i'm trying to export chart data to powerpoint.Here in the code i trying to save it as excel file and then to powerpoint,while trying click on the export button it showing me an error message(Written as aheading).here i'm my…
shankar.parshimoni
  • 1,289
  • 5
  • 22
  • 42