Questions tagged [openxml]

Questions regarding reading and writing of Microsoft Office Open XML files either through direct manipulation of the XML files contained in a zip package or through the Microsoft Office Open XML SDK.

Office Open XML File Formats Official Standard

http://www.ecma-international.org/publications/standards/Ecma-376.htm

Microsoft Office Open XML SDK 2.0

http://www.microsoft.com/downloads/en/details.aspx?FamilyId=C6E744E5-36E9-45F5-8D8C-331DF206E0D0&displaylang=en

3743 questions
8
votes
2 answers

Comparing Docx files using OOXML

How can I read word-by-word (with styles) from a docx file. I want to compare two docx files word-by-word and based on the differences I have to write into another docx file (using c# and OOXML). I have tried achieving this by using…
user274223
  • 81
  • 1
  • 3
8
votes
3 answers

C# return memory stream from OpenXML resulting to a corrupted word file

I have a problem with a MemoryStream from OpenXML. I succeed with opening a Word file, changing it and downloading it through the HttpResponse if I do all the steps in a single method. But if I try to do it in two different classes (or methods) by…
DotNetBeliever
  • 135
  • 1
  • 1
  • 9
8
votes
2 answers

Excel with xml -> source and guide for tags and attributes

Excel can directly open .xml files and render them properly. An example can be found here: http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats#Excel_XML_Spreadsheet_example I am trying to find a source on tags and attributes that are used and…
Koray Tugay
  • 22,894
  • 45
  • 188
  • 319
8
votes
1 answer

How to add hyperlinks into Word docx using open XML?

I am having a trouble adding hyperlinks to my word document. I don't know how to do it. I would like to make a link in a word document from my C# code using open xml. Is ther a different solution using only href or sth similar? There is a HyperLink…
Antun Tun
  • 1,507
  • 5
  • 20
  • 38
8
votes
2 answers

What is the difference between Office Automation, VSTO, and Open XML SDK?

What is the difference between Office Automation, VSTO, and Open XML SDK? Do we need all of them or some of them are obsolete?
alex
  • 74,215
  • 9
  • 49
  • 57
8
votes
3 answers

How to set cells' background?

How to set the background of several cells within a row (or of a whole row) in OpenXml? Having read several articles: Coloring cells in excel sheet using openXML in C# Advanced styling in Excel Open XML I still cannot make it work. My task is…
horgh
  • 17,918
  • 22
  • 68
  • 123
8
votes
1 answer

Why is Cell.CellReference optional? How do I get cell location otherwise?

According to the OpenXml spec CellReference is optional. But is there an alternative way to get a cell's location? For example, I can get a row's cells by something like: foreach (Row r in sheetData.Elements()) { foreach (Cell c in…
user1792714
  • 129
  • 1
  • 6
8
votes
5 answers

Saving Word DOCX files as PDF

I'm using openxml to create Word DOCX files. I'd like to save these documents once they are created as PDF files. Is there a way I can do this in openxml? I assume the answer is no. If it is no, is there a recommended library or tool I can use to…
Stealth Rabbi
  • 10,156
  • 22
  • 100
  • 176
8
votes
2 answers

Inserting new rows and moving exsisting ones with OpenXML SDK 2.0

I'm using OpenXML SDK 2.0 to add data to the spreadsheet template but I ran into a problem (since I've been using OpenXML for a day that's not so hard to believe). I can't figure out how to add new rows while pushing all the rows that are below the…
wegelagerer
  • 3,600
  • 11
  • 40
  • 60
8
votes
2 answers

Download EXCEL file from ASP.NET page without Generating physical file on server (On The Fly)

I am trying to export C# DataTable to EXCEL file on the fly (without creating physical file) using Microsoft Office EXCEL INTEROP and download it through asp.net webpage through Response object. I am able to generate memorystream using the library…
Sankalp
  • 929
  • 1
  • 7
  • 16
7
votes
6 answers

Set text align to center in an Excel document using OpenXML with C#

I have a document that my asp.net page is creating and I need to align the text of certain columns to center. I have opened the document after manually center the columns in openXML SDK but the code that is reflected does not achieve the desired…
broguyman
  • 1,386
  • 4
  • 19
  • 36
7
votes
4 answers

Working with Office "open" XML - just how hard is it?

I'm considering replacing a (very) large body of Office-automation code with something that works with the Office XML format directly. I'm just starting out, but already I'm worried that it's too big a task. I'll be dealing with Word, Excel and…
Gary McGill
  • 26,400
  • 25
  • 118
  • 202
7
votes
3 answers

Corrupt document after calling AddAlternativeFormatImportPart using OpenXml

I am trying to create an AddAlternativeFormatImportPart in a .docx file in order to reference it in the document via an AltChunk. the problem is that the code below causes the docx file to read as corrupted by Word and cannot be opened. …
Leslie Marshall
  • 171
  • 2
  • 3
7
votes
3 answers

Named Ranges in Excel OpenXML

I am trying to create named ranges in Excel with OpenXML. I am able to add a DefinedName in the DefinedNames collection, but that does not seem to do anything. I noticed a place in the ExtendedFileProperties where the names of ranges are being…
aaron
  • 93
  • 1
  • 4
7
votes
1 answer

Open XML SDK: Format part of an Excel-cell

Using Open XML for Excel with DocumentFormat.OpenXml.Spreadsheet, how do I set only part of a text to bold? var cell = new Cell { //DataType = CellValues.InlineString, CellReference = "A" + 1 }; // TODO: Set "bold text" to bold style //var…
Seb Nilsson
  • 26,200
  • 30
  • 103
  • 130