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

OpenXML Excel File Parsing

I have an excel document that is supposed to be parsed using the following block of code: var handler = new ExcelHandler(byteStream); var currentExcelDocument = handler.CurrentDocument; //now if the document is null if…
Paul Plato
  • 1,471
  • 6
  • 28
  • 36
0
votes
1 answer

Executing a macro in Excel sheet

I would like to execute a macro (VBA Code for formatting the sheet) in an excel sheet that i create from code. The approach I use right now is put the macro in the workbook_open event and open the Excel sheet from code. That applies the formatting…
Ron
  • 886
  • 13
  • 39
0
votes
1 answer

writing to excel file from a two dimentional array VB.net

I have a two dimentional array formed by iterating a data reader. Earlier i was using automation to write to excel and using range, i was able to write the contents of two dimentional array to excel in one shot. This improves the performance a lot…
user1447718
  • 669
  • 1
  • 11
  • 23
0
votes
1 answer

Streaming Word Doc in OpenXML SDK using ASP.NET MVC 4 gets corrupt document

I am trying to do this on ASP.NET MVC 4: MemoryStream mem = new MemoryStream(); using (WordprocessingDocument wordDoc = WordprocessingDocument.Create(mem, DocumentFormat.OpenXml.WordprocessingDocumentType.Document, true)) …
RicL
  • 533
  • 2
  • 6
  • 24
0
votes
1 answer

Parsing OpenXML document [Windows Store Apps/Metro Apps]

I do not feel like reinventing the whole wheel on Windows Store Apps, but is there any readily available way that I am able to parse OpenXML document quickly on Windows Store Apps? I had been using the OpenXML SDK (currently on 2.5) but it is…
VT Chiew
  • 663
  • 5
  • 19
0
votes
1 answer

create a report from template using C# excel OpenXML API

I've been using Microsoft COM model to prepare reports but it is slow and fails if server does not have excel installed. So I am moving to using OpenXML for creating reports from a server process that does a ton of other things as well. I've a…
user236215
  • 7,278
  • 23
  • 59
  • 87
0
votes
1 answer

Consistent procedure to extract Excel document data using Open XML SDK?

If anything, this serves as my notes for parsing/importing Open XML Excel file data. I created code below using Open XML SDK 2.0 that extracts Excel 2007 data from one Excel file successfully but fails returning empty strings on a different but…
Zachary Scott
  • 20,968
  • 35
  • 123
  • 205
0
votes
0 answers

OpenXML put text in form field that has bookmark

I have a word template that when opened has grey form fields to fill in, and each form field has a bookmark. I can get the bookmark without a problem but I am having trouble adding text at that exact spot. I have tried the following but the text is…
Kyle
  • 32,731
  • 39
  • 134
  • 184
0
votes
1 answer

Reading data from Excel cells using OpenXML SDK 2.0

I'm trying to get value from Excel cells in this way: SpreadsheetDocument spreadSheetDocument = SpreadsheetDocument.Open(filePath, true); WorksheetPart worksheetPart = getWorksheetByName(spreadSheetDocument, DEFAULT_SHEET_NAME); …
Andriy Zakharko
  • 1,623
  • 2
  • 16
  • 37
0
votes
1 answer

How to delete data or table within two bookmarks from word document using OpenXml in C#

I am creating word document in C# using OpenXML. I can insert my Text after specified bookmark, but how can delete data within two bookmarks. Following is the code to insert text after specified Bookmark. string fileName =…
shyam
  • 1
  • 1
  • 1
0
votes
1 answer

Microsoft Office Interop Excel to Open XML SDK 2.0

I have an Excel 2010 Automation project using Microsoft Office Interop library in C#.NET. But now i need to migrate it to work with Open XML SDK 2.0. Any guidelines or suggestions?
Srinivas
  • 2,479
  • 8
  • 47
  • 69
0
votes
1 answer

Creating an Excel file via OpenXML in ASP.NET/VB.NET and sending over Response

trying to just create a simple OpenXML document based on http://www.codeproject.com/Articles/371203/Creating-basic-Excel-workbook-with-Open-XML i moved it over to asp.net (below) on my dev server but the file that is created is corrupted and will…
user1272386
  • 49
  • 2
  • 10
0
votes
1 answer

What do you need to do to get Excel to read the styles in files created by the OpenXML SDK library?

There seem to be a lot of problems with this library - often it seems to do the wrong thing despite you having written the data correctly - are there any 'magic' undocumented things you just need to know to get it to work or is it just full of…
JonnyRaa
  • 7,559
  • 6
  • 45
  • 49
0
votes
2 answers

Can I find the location of text in a Word document using OpenXML SDK?

I would like to put some known text in a Word doc and programmatically find it's x,y location with respect to the document or page using .NET. Is that possible? I was looking at using the OpenXML SDK but I don't see a path to getting that to work.…
Bryan
  • 857
  • 1
  • 11
  • 25
0
votes
1 answer

LINQ queries against Open XML

I have ID of WorksheetPart object obtained earlier from: var id = document.WorkbookPart.GetIdOfPart(worksheetPart); Now I'm trying to get object back by using LINQ. However, I'm unable to find ID property of the mentioned object: var worksheetPart…
Admir Tuzović
  • 10,997
  • 7
  • 35
  • 71