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

3494 questions
82
votes
4 answers

Set custom BackgroundColor of a Excel sheet cell using epplus c#

The problem: I am using EEPlus. I am stuck at applying a hex color code, e.g. #B7DEE8, for a cell in my Excel sheet. I got the following (working) code: ws.Cells["A1:B1"].Style.Fill.PatternType =…
Hakuna Matata
  • 1,271
  • 3
  • 12
  • 22
73
votes
17 answers

How can a Word document be created in C#?

I have a project where I would like to generate a report export in MS Word format. The report will include images/graphs, tables, and text. What is the best way to do this? Third party tools? What are your experiences?
Schmidty
  • 1,850
  • 1
  • 20
  • 18
61
votes
4 answers

Inserting newlines in Word using OpenXML

I am using openxml WordProcessingDocument to open a Word template and replace placeholder x1 with a string. This works fine unless I need the string to contain a newline. How can I replace x1 with text may contain newlines that word would…
Danny
  • 2,633
  • 5
  • 28
  • 42
51
votes
5 answers

open xml excel read cell value

I am using the Open XML SDK to open an Excel xlsx file and I try to read the cellvalue on position A1 in each sheet. I use the following code: using (SpreadsheetDocument spreadsheetDocument = SpreadsheetDocument.Open(openFileDialog1.FileName,…
jwdehaan
  • 1,355
  • 3
  • 11
  • 24
49
votes
10 answers

How can I search a word in a Word 2007 .docx file?

I'd like to search a Word 2007 file (.docx) for a text string, e.g., "some special phrase" that could/would be found from a search within Word. Is there a way from Python to see the text? I have no interest in formatting - I just want to classify…
Gerry
  • 935
  • 1
  • 7
  • 16
47
votes
2 answers

Cell styles in OpenXML spreadsheet (SpreadsheetML)

I've generated a .xlsx spreadsheet in C# using the OpenXML SDK, but can't figure out how to get cell styles working. I've been studying files produced by Excel, and can't quite figure out how it's done. Right now, I'm creating a fill, creating a…
Polynomial
  • 25,567
  • 8
  • 75
  • 106
44
votes
5 answers

Save modified WordprocessingDocument to new file

I'm attempting to open a Word document, change some text and then save the changes to a new document. I can get the first bit done using the code below but I can't figure out how to save the changes to a NEW document (specifying the path and file…
Paul
  • 2,982
  • 6
  • 34
  • 55
44
votes
7 answers

What indicates an Office Open XML Cell contains a Date/Time value?

I'm reading an .xlsx file using the Office Open XML SDK and am confused about reading Date/Time values. One of my spreadsheets has this markup (generated by Excel 2010)
Samuel Neff
  • 67,422
  • 16
  • 123
  • 169
44
votes
14 answers

reading Excel Open XML is ignoring blank cells

I am using the accepted solution here to convert an excel sheet into a datatable. This works fine if I have "perfect" data but if I have a blank cell in the middle of my data it seems to put the wrong data in each column. I think this is because in…
leora
  • 163,579
  • 332
  • 834
  • 1,328
43
votes
4 answers

C# EPPlus OpenXML count rows

With EPPlus and OpenXML does anyone know the syntax on how to count the rows? Say my worksheet is called "worksheet" int numberRows = worksheet.rows.count()? or worksheet.rows.dimension I'm certainly interested in the answer, but how to find the…
rd42
  • 3,378
  • 14
  • 52
  • 67
42
votes
8 answers

From Excel to DataTable in C# with Open XML

I'm using Visual Studio 2008 and I need create a DataTable from a Excel Sheet using the Open XML SDK 2.0. I need to create it with the DataTable columns with the first row of the sheet and complete it with the rest of values. Does anyone have a…
Rastro
  • 423
  • 1
  • 5
  • 7
41
votes
8 answers

Export DataTable to Excel with Open Xml SDK in c#

Sorry for my english please. I'm new in open xml sdk. My program have ability to export some data and DataTable to Excel file (template) In the template I insert the data to some placeholders. It's works very good, but I need to insert a DataTable…
user1576474
  • 504
  • 1
  • 5
  • 10
37
votes
10 answers

Repaired Records : Cell information from worksheet created from scratch

I'm receiving an error when opening my OpenXML created spreadsheet. The error is as follows. Repaired Records: Cell information from /xl/worksheets/sheet.xml part Repaired Records: Cell information from /xl/worksheets/sheet2.xml part Repaired…
Kulingar
  • 921
  • 3
  • 14
  • 29
33
votes
2 answers

Create page break using OpenXml

I use OpenXml to create Word document with simple text and some tables under this text. How can I force Paragraph with this text to show always on new page? Maybe this paragraph should be some Header but I'm not sure how to do this. Thanks
arek
  • 1,203
  • 4
  • 15
  • 25
32
votes
5 answers

Inserting Image into DocX using OpenXML and setting the size

I am using OpenXML to insert an image into my document. The code provided by Microsoft works, but makes the image much smaller: public static void InsertAPicture(string document, string fileName) { using (WordprocessingDocument…
MintGrowth
  • 4,831
  • 9
  • 58
  • 88
1
2 3
99 100