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
23
votes
12 answers

Replace bookmark text in Word file using Open XML SDK

I assume v2.0 is better... they have some nice "how to:..." examples but bookmarks don't seem to act as obviously as say a Table... a bookmark is defined by two XML elements BookmarkStart & BookmarkEnd. We have some templates with text in as…
Mr. Boy
  • 60,845
  • 93
  • 320
  • 589
23
votes
2 answers

How to create Excel file using OpenXML without creating a local file?

Is it possible to create and edit an excel document using OpenXML SDK without creating a local file? As per the documentation the Create method demands for a filepath, which creates a local copy of the file. SpreadsheetDocument spreadsheetDocument =…
Bishnu Das
  • 462
  • 1
  • 3
  • 9
23
votes
7 answers

How to insert a date to an Open XML worksheet?

I'm using Microsoft Open XML SDK 2 and I'm having a really hard time inserting a date into a cell. I can insert numbers without a problem by setting Cell.DataType = CellValues.Number, but when I do the same with a date (Cell.DataType =…
Manuel
  • 10,869
  • 14
  • 55
  • 86
22
votes
3 answers

How can I create multistyled cell with EPPlus library for Excel

I use EPPlus for Excel file generation. I mean I need to convert HTML text (bold, italic, font color, name, size parameters) to Excel Cell. I suppose it needs to create the multi-styled cell, like: cell text is "hello!" the style I want is: he -…
Anton Norko
  • 2,166
  • 1
  • 15
  • 20
22
votes
11 answers

OpenXml and Date format in Excel cell

I am trying to create an Excel file in xlsx format using OpenXML because I need to use that on a web server. I don’t have any problem to fill the values in the sheets; however I am struggling to set the classic Date format in a cell. Below a quick…
Dan
  • 625
  • 2
  • 7
  • 23
22
votes
1 answer

C# OPENXML XLSX Custom Column width

C# newbie here! I need to create a small console application to convert CSV files into XLSX files. I have all my styles and data working, but I want to set a different (from default) width on some columns. And after a day of searching and reading I…
Zankul
  • 247
  • 1
  • 3
  • 7
22
votes
5 answers

OpenXML 2 SDK - Word document - Create bulleted list programmatically

Using the OpenXML SDK, 2.0 CTP, I am trying to programmatically create a Word document. In my document I have to insert a bulleted list, an some of the elements of the list must be underlined. How can I do this?
kjv
  • 11,047
  • 34
  • 101
  • 140
22
votes
3 answers

Add a row to an existing table in a Word Document (open XML)

I need to open an existing Word document (.docx) with an existing table (with, for example, 3 columns) and add a new row to that table. Is there any way of doing this? I am using Open XML I am creating the table like this (for the first time): Table…
Nicole
  • 1,356
  • 3
  • 21
  • 41
22
votes
1 answer

C# Open XML 2.0 NumberFormatId range

Working with Open XML 2.0 using c# to parse large excel files. Issue I'm running into is the cell I'm parsing does not have a DataType I then check the NumberFormatId to determine if it is decimal, number or date. I'm looking for the exact…
maguy
  • 1,599
  • 1
  • 15
  • 26
21
votes
4 answers

Will Subversion efficiently store OpenXML Office documents?

I have been managing Subversion as an engineering document storage repository for my company. It is working fairly well, however I have a question about how MS Office 2007 formats are (should be) handled by Subversion. I'm looking at an Excel 2007…
RjOllos
  • 2,900
  • 1
  • 19
  • 29
21
votes
7 answers

Streaming In Memory Word Document using OpenXML SDK w/ASP.NET results in "corrupt" document

I am unable to stream a word document that I create on the fly down to the browser. I am constantly getting a message from Microsoft Word that the document is corrupt. When I run the code via a Console Application and take ASP.NET out of the…
Ta01
  • 31,040
  • 13
  • 70
  • 99
20
votes
2 answers

Open XML SDK 2.0 to get access to excel 2010 worksheet by name

I have an Excel 2010 spreadsheet that has 3 worksheets named Sheet1, Sheet2 and Sheet3. I'm trying to get a reference to a worksheet by name. I'm using the code: using (SpreadsheetDocument myWorkbook = SpreadsheetDocument.Open(FileName, true)) { …
Rick Hodder
  • 2,189
  • 3
  • 26
  • 54
20
votes
7 answers

OpenXML - Writing a date into Excel spreadsheet results in unreadable content

I am using the following code to add a DateTime to a column in my spreadsheet: var dt = DateTime.Now; r.AppendChild(new Cell() { CellValue = new CellValue(dt.ToOADate().ToString()), DataType = new…
Extrakun
  • 19,057
  • 21
  • 82
  • 129
20
votes
11 answers

Get the Column Index of a Cell in Excel using OpenXML C#

I've been looking around for a while now and cannot seem to find out how to do this. I've got an excel sheet, which I'm reading using OpenXML. Now the normal thing would be to loop through the rows and then loop through the cells to get the values,…
QV1
  • 529
  • 2
  • 5
  • 17
20
votes
6 answers

OpenXML: Auto Size column width in Excel

I have written a code to generate Excel file using OpenXML. Below is the code which generates the Columns in the Excel. Worksheet worksheet = new Worksheet(); Columns columns = new Columns(); int numCols = dt1.Columns.Count; for (int col = 0; col <…
Mittal Patel
  • 808
  • 1
  • 22
  • 37