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

Microsoft Open XML SDL 2.0 append document to template document asp.net c#

My asp.net c# web-application is creating word documents by filling an existing template word document with data. Now I need to add a further existing documents to that document as next page. For example: My template has two pages. The document I…
raven_977
  • 475
  • 2
  • 8
  • 25
5
votes
1 answer

Read only or Lock the particular cells or rows using open xml sdk

I am using open xml sdk to export excel. I get the excel file and copying that file to another place and then I'm inserting new rows with the data. I should make that rows as read only (or I've to lock) using open xml sdk.. How to do that ?
user3035874
5
votes
2 answers

Open XML Altchunk Html with base64 images Embedded

In short: I would like to create a word document from htmlstring and the html contains embedded base64 images. My problem: I have managed to create the word document with the use of Altchunk, but when I open the document the place where the image…
Davy
  • 51
  • 1
  • 2
5
votes
2 answers

Creating an ImagePart isn't saving the Relationship in OpenXML

--Updated to provide full working class example, with 2 sample documents-- www.sklinar.co.uk/wp-content/uploads/mydoc.docx - Original Document with a INCLUDETEXT instruction to merge in Footer.Docx www.sklinar.co.uk/wp-content/uploads/footer.docx I…
Stuart.Sklinar
  • 3,683
  • 4
  • 35
  • 89
5
votes
1 answer

Remove the x namespace using openxml

I have found this question and I got somewhat the same question. XLSX- how to get rid of the default namespace prefix x:? I got a problem when generating an OpenXML Excel worksheet. Specially the style sheet part. When the style sheet somehow got a…
P. Zantinge
  • 185
  • 1
  • 15
5
votes
1 answer

Open XML SDK - AddImagePart - Change image location from /media to /word/media

I am trying to insert an image into a document from C# using the Open XML SDK 2.5. The document is subsequently going to be uploaded to Google Drive and converted to a Google Document. I am currently using the MainDocumentPart.AddImagePart method…
Jacob Bundgaard
  • 943
  • 11
  • 29
5
votes
3 answers

OPEN XML add custom not visible data to paragraph/table

Is there a way to store additional data for a paragraph, that would be persisted after user opens and saves a document in MS Word. Ive been using CusotmXML for this, but it turns out that this is no logner possible due to the fact that MS-Word…
aerkain
  • 592
  • 1
  • 4
  • 16
5
votes
3 answers

How can I remove bookmarks from an OpenXML docx file?

I thought the following would work: var bod = wordDoc.MainDocumentPart.Document.Body; foreach (var bookmark in bod.Descendants()) { bookmark.Remove(); } foreach (var bookmark in bod.Descendants()) { …
DaveDev
  • 41,155
  • 72
  • 223
  • 385
5
votes
2 answers

Word OpenXML . Traversing OpenXmlElements between bookmarks

I need to traverse nodes between a bookmark start and a bookmark end tag. The problem appears to break down into a tree traversal but I am having trouble pinning down the correct algorithm. The bookmark start and end elements are non-composite…
user166244
  • 77
  • 2
  • 6
5
votes
1 answer

How to parse mathML in output of WordOpenXML?

I want to read only the xml used for generating equation, which i obtained by using Paragraph.Range.WordOpenXML. But the section used for the equation is not as per MathML which as i found that the Equation of microsoft is in MathML. Do I need to…
serene
  • 685
  • 6
  • 16
5
votes
1 answer

How can I return a stream rather than writing to disk?

I am using OpenXML SDK. The OpenXML SDK creates a method called CreatePackage as such: public void CreatePackage(string filePath) { using (SpreadsheetDocument package = SpreadsheetDocument.Create(filePath, …
Nate Pet
  • 44,246
  • 124
  • 269
  • 414
5
votes
1 answer

Clone ParagraphProperties in Word using OpenXml SDK 2.0

I am programmly generating new paragraphs in Word document via Open XML SDK 2.0. A have first paragraphs with properties, that i would like to append to all new generated paragraphs. Somthing like this: var _texts = new List() { "Text 1",…
BigMan
  • 425
  • 5
  • 13
5
votes
3 answers

How to get the Position & Dimension of a Shape in Powerpoint?

I'm playing around with OpenXmlSDK to see if it's a viable solution for our Powerpoint needs. One thing that is required is the ability to position shapes in the Powerpoint. I've been searching around for a way to get the position of a Shape, but…
Ryan Abbott
  • 5,317
  • 7
  • 31
  • 34
5
votes
1 answer

Embed an Excel graphic in a Word document with OpenXML working with Word 2010 and 2003

I have to implement a Microsoft Word document generator with embed excel graphics in it. One of my constraint is to make my generated docx work both with Microsoft word 2010 and 2003 + compatibility pack. I didn't managed to make it works for both…
PuK
  • 305
  • 1
  • 5
  • 15
5
votes
2 answers

Restart page numbering in header with OpenXML SDK 2.0

I can't figure out how to start the page numbering at a specific point for a section using OpenXML SDK 2.0. Here's what I see when I reflect on a header in a document using the OpenXML Productivity Tool:
Michael Nero
  • 1,396
  • 13
  • 24