Click here to Skip to main content
15,881,709 members
Everything / OpenXML

OpenXML

OpenXML

Great Reads

by yuvalsol
Create professional-looking Excels (Filters, Charts, Pivot Tables) with EPPlus
by koolprasad2003
This article help you to create word table using OpenXML without interop object
by koolprasad2003
This article gives you idea, How to Disable Copy/Paste option from Word (Docx) document using C# and OpenXML
by Kannan Ar
A step by step guide to integrate AngleSharp HTML parser into MariGold.OpenXHTML

Latest Articles

by yuvalsol
Create professional-looking Excels (Filters, Charts, Pivot Tables) with EPPlus
by Kannan Ar
A step by step guide to integrate AngleSharp HTML parser into MariGold.OpenXHTML
by Roshan Choudhary
Creating ExcelSheet with dropdown containing pre populated dropdown data of its own excelsheet.
by Dankwansere
How to insert an image into an "inline shape" in Word Document using Microsoft Open XML SDK

All Articles

Sort by Score

OpenXML 

23 May 2018 by yuvalsol
Create professional-looking Excels (Filters, Charts, Pivot Tables) with EPPlus
8 Nov 2015 by koolprasad2003
This article help you to create word table using OpenXML without interop object
8 Dec 2015 by Mario Z
First regarding the OpenXML SDK, what you can do with it is manipulate (create, read, write, modify, etc.) with OOXML (Office Open XML) files which are DOCX, XLSX and PPTX.Note that OpenXML SDK enables you to process only OOXML files, nothing else, and it does this with an API which is...
13 Feb 2017 by koolprasad2003
This article gives you idea, How to Disable Copy/Paste option from Word (Docx) document using C# and OpenXML
21 May 2020 by phil.o
No, you cannot use OpenXML to open a .mdb file.
3 Jun 2020 by Maciej Los
Quote: I use open XML library Sorry, but you're wrong. You're using EPPlus, because OpenXml does not have built-in LoadFromDataTable method. All you have to do is: 1. create Excel file (workbook) 2. loop through the DataRows collection of...
1 May 2013 by Sergey Alexandrovich Kryukov
There is absolutely nothing wrong with installing this SDK anywhere. This is nothing but a library and presents no threats at all. In many ways, it's also much better then Office Interop. Interop operations depends on availability of Office installation, which is the subject of serious license...
17 Dec 2013 by Sergey Alexandrovich Kryukov
Please see my comment to the question: it may or may not make sense, depending on what you are doing. In the meanwhile, read on the "compatibility...
6 Jan 2015 by Peter Leow
Refer: Read and write Open XML files (MS Office 2007)[^]
21 Jan 2020 by Pete O'Hanlon
Single() implies that an element is being returned from the XML selection. What happens if there is no matching element? If there's a potential that you might not have a value returned, you should use SingleOrDefault() instead.
21 May 2020 by Richard MacCutchan
If you do not have Microsoft Access you can read the file's contents through the OLEDB interface using the Download Microsoft Access Database Engine 2016 Redistributable from Official Microsoft Download Center[^] . This article: Working with MS...
20 May 2021 by D-Kishore
I Am trying to add title and image to the PPT using Open XMLHere I am able to add the title and subtitle to the ppt template slide, My problem is for the same slide I need to add the Image.Below is my codeprotected void Page_Load(object sender, EventArgs e) { ...
28 Jan 2014 by Tilak Rathour
Hi...I solved this problem itself by altering the below statementbyte[] buf = (new System.Text.UTF8Encoding()).GetBytes("" + mystring + "");the above statement is replace by byte[] buf =...
17 Feb 2014 by hari111r
Hi, I am using below code to get the content from word document using Open xml SDK. I want to convert that to html with the formatting is there any option available to convert or we need to do it by parsing xml. string Path = Server.MapPath("Files\\Resume.docx");if...
4 Jan 2015 by CHill60
It's not clear whether you are asking how to manipulate word files with C# (so why have you tagged your question with VB.NET??) OR you are asking how to search word files with C#.These CodeProject links should help ...Search and highlight text in MS Word through C#[^]C#: Create and...
22 Apr 2015 by Maciej Los
Have a look here:Alignment Class[^]Set text align to center in an Excel document using OpenXML with C#[^]
8 May 2016 by Patrice T
You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.The debugger allow you to follow the execution line by line, inspect variables and you will see that there...
10 Jun 2016 by George Jonsson
As you don't state how you want to use the result, I just created a list of booleansXNamespace xns = "http://www.somesite.com/";XDocument xdInput = XDocument.Load(@"C:\Temp\input.xml");XElement xeWP = xdInput.Root.Element(xns + "p");var existList = from el in xeWP.Elements(xns +...
28 Sep 2016 by rajah rajah
How to add a sheet as a first sheet in a excel sheet while exporting excel . .Existing sheet having 2 sheets already.Now i wants to add a new sheet in that excel while exporting excel using openxml.What I have...
28 Sep 2016 by Suvendu Shekhar Giri
Haven't tried to do this, but looking at few suggestions found on the web, you can try something like-workbook.Sheets.Add(Before: workbook.Sheets[0]); Check following links for further information-c# - Excel Interop - Add a new worksheet after all of the others - Stack...
14 Dec 2017 by Kannan Ar
A step by step guide to integrate AngleSharp HTML parser into MariGold.OpenXHTML
7 Jan 2018 by rajah rajah
Hi, I want to copy sheet1 data to sheet2 with some particular range. like below sheet1 data 1 John 123 2 Max 235 3 Steve 265 Sheet2 have 3 header Sno Name ID Expecting : in Sheet2 Sno Name ID 1 John 123 2 Max 235 3 Steve 265 What I have tried: Formula1 formula = new Formula1(); ...
7 Feb 2018 by OriginalGriff
Look at the error message: The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION It couldn't be more specific! Your ROLLBACK in your Catch block has no BEGIN TRANS - there is no transaction there at all, except the ROLLBACK, you have no COMMIT either! To roll back a...
5 Oct 2019 by Devesh S
Single can throw this error if no element is present in the sequence. Try using SingleorDefault which will return null if no value found. Msdn link: Enumerable.Single Method (System.Linq) | Microsoft Docs[^] A good explanation here Linq First vs Single vs Last methods. | Code Martini[^]
21 Jan 2020 by phil.o
Enumerable.Single method will throw an exception whenever the collection does not hold a single element (i.e., collection is empty or collection contains more than one element). You should probably use Enumerable.SingleOrDefault method which will return null instead of throwing an exception. ...
21 Dec 2022 by Graeme_Grant
I was not sure myself, so I used Google: How do change the foreground color of a table cell in word file using openxml using C - Google Search[^] and found this: How can I modify the foreground and background color of an OpenXML TableCell?[^] ......
7 Mar 2013 by RedDk
Straight from BOL SQLSERVER2K8 ... "OPENXML" (/w substitution):DECLARE @idoc intDECLARE @doc varchar(1000)SET @doc =' 234234 64850 234 234 324 234234 'That's the look to the data.EXEC...
14 Mar 2013 by hasenn
Help me. My problem is I want to replace a word document using openxml and add a page break. Then I want to write replaced text on the second page.BUT I CAN NOT WRITE THE SECOND PAGEhow do i this ? Here my code:using (WordprocessingDocument wordDoc =...
14 Mar 2013 by Oliver Bleckmann
I think the problem is in your Body.InsertAfter statement. Look at http://openxmldeveloper.org/blog/b/openxmldeveloper/archive/2011/04/11/137431.aspx[^] where Eric White uses this routine static void AppendPageBreak(WordprocessingDocument myDoc) { MainDocumentPart mainPart...
15 Mar 2013 by hasenn
thanks for replyi tried but i got an error when i try word document :(
22 Mar 2013 by Joseph Regis
With the help of following "http://msdn.microsoft.com/en-ca/library/ee355229.aspx" i am able to embed documents in word successfully. But while embedding i am unable to change the name of the object. (By default it shows as 'Embedded document' -- May be comes from the image part.). Is there any...
25 Apr 2013 by Bhargava Katta
My requirement is to read,write spreadsheets in excel file using OpenXml.My spreadsheet cells are in many formats like numbers,strings,dates etc..My code is reading everything except dateformat cell. one cell is a Custom dateformat(d-mmm), which is returning numbers (like 7-Aug is returning...
25 Apr 2013 by Maciej Los
In previous version of Excel application, there was a NumberFormat[^] property for cell.Please, follow the below...
25 Apr 2013 by keespiet
I narrowed it down to://aantal auto'sRow aantalAutosRow = new Row();aantalAutosRow.RowIndex = Convert.ToUInt32((tblXML.Rows.Count) + 2);Cell aantalAutosCell = new Cell();aantalAutosCell.CellReference = getColumnName(1);aantalAutosCell.CellValue = new...
1 May 2013 by surajsurve
I want to create and download excel file from datatable.Following methods I have used to do this.1] Directly stream through HTTP response. Sent HTML code directy in HTTP response with some HTML tags with datatable loop through in. Problem - When we (Save as) excel file while saving it...
6 May 2013 by Bhargava Katta
Hi,My requirement to change background color of cells in a row of a excel sheet. ex : if A1 cell value is less than 100, i need to show it in Red Background.I searched alot, i found some code to create stylesheets from this...
13 May 2013 by Bhargava Katta
my requirement to is to insert formula for a cell. i am using below method to insert formula. And its inserting formula corectly and formula working fine. but when i insert formula my excel file got corrpted and showing the message "Excel found unreadable content in "exceltemplate.xlsx". Do you...
8 Jul 2013 by sri4dotnet
Hi, I need have a maintain the cell values in an excel in different worksheets using openxml. I have 6 columns A,B,C,D,E,F where 'A' has 720 rows, 'B' is splitted in to 6 elements with 120 rows, 'C' with 120 rows, 'D' is splitted in to 5 elements each with 24 rows , 'E' with 24 rows...
8 Jul 2013 by Maciej Los
Please, read my comment to the question.As i mentioned, you need to loop through the collection of cells in range (in your example: A1:A720).Please, follow below links:How to: Parse and read a large spreadsheet document (Open XML SDK)[^]How to: Retrieve the values of cells in a...
10 Sep 2013 by MayurVijay04
I have a scenario where I want to add meta data to individual cells in Excel(.xslx) file. While going through Cell class in OpenXML, I found that there are provision to store metadata for cell. Refer : http://msdn.microsoft.com/en-us/library/documentformat.openxml.spreadsheet.cell.aspx.There...
17 Sep 2013 by naveedahmed43
Hi,I've a c sharp code where im creating a excel file using openxml and this code runs on a task scheduler every 15 mins to create the excel file. I cant use interop since it wont work with the task scheduler so i have used open xml. This excel file should be in readonly. im NOT able to make...
17 Sep 2013 by Maciej Los
Set ReadOnly attribute using File.SetAttributes Method[^].
2 Oct 2013 by P. Zantinge
Hi Guy's and Girls,I got a problem when generating een OpenXML Excel worksheet. Specially the stylesheet part.When the stylesheet somehow got a style for a Timeline (excel 2013 only) it is able to generate a excel-file. The stylesheet then contains the right namespace (xmlns:x="..."). This...
4 Dec 2013 by Reshma Babu
I have a data in bytes[]. I have to write the same to a worksheet. I created a spreadsheet doc, added workbook, and appended all the sheets. But I am not able to access a particular sheet and write the data to it. (It provides cell wise writing- I want to write the whole block at once)
5 Dec 2013 by Deepak.rr
Hi All,I have word document, and in that document i have a table and also some data.My tasks are:1) For that table i need to add some rows at the end of the table.2) Replace some text in the word document(Not in the table), with some other text.I have done both of them. and here...
30 Dec 2013 by Member 9990662
Hi I am having a collection which i want to export to Excel sheet. Along with export functionality i also want to add protection to the excel sheet. I doesn't want the user to edit that file, not by using 'Password'. I am using SpreadsheetDocument from OpenXmlPackage in my WPF application,...
30 Dec 2013 by Maciej Los
Please, read my comment to the question first.Have a look here: Overview of Protected Office Open XML Documents[^]
7 Jan 2014 by Member 10009041
Hi I'm New in Openxml.I want export the data from Excel to Sql server table,Using OpenXml.How to do ?Thanks in Advance.
9 Jan 2014 by Maciej Los
Have a look here:Building an ASP.NET Web Application with Open XML Functionality[^]Read and write Open XML files in ASP.NET (Excel XLSX)[^]
20 Jan 2014 by Tilak Rathour
Hi all,I am generating a word report through c# and open xml but the problem is that when i append altchunk the below code string id = "ReportChkName" + details.check_id; string altChunkId1 = id; AlternativeFormatImportPart altchunk =...
10 Feb 2014 by devdev13
I have a template document that has a few paragraphs and tables with some styles associated with them.I need to select the elements from template document based on a sequence, and then append them to the body of my new document. Below is my code that does the copying. I somehow need to copy...
27 Feb 2014 by markand911
I have a macro enabled excel file. I want to open the file as a stream and populate the file using OpenXML. Following is my code to Open the file. But i dont know how to take this file in stream and populate it with data.SpreadsheetDocument spreadsheetDocument =...
13 Mar 2014 by ajitsit07
Hi Kunal, Check for the excel file (it is read only or not). If you have given all the permission to respective files and folder, then share your code if you can. Ajit
13 Mar 2014 by ajitsit07
What are you using for dumping the data into excel sheet.. i mean OLE DB or something different..check for the closing and opening of object.. or better to use Using keyword...If you can share you code it would be good to response ....
20 Mar 2014 by Amalraj Ramesh
General Input/Output Error Problem help meIm generating docx file using Open XML When i open the file in Oppenoffice,org Writer its throw General Input/Output ErrorMy codepublic void WordprocessingFromString(string InputPath, string OutputPath, string InputDir) { ...
9 Jun 2014 by JainPrince
I am trying to populate hyperlink in excel sheet using Open Office xml sdk.Description of Excel sheet:The excel sheet contains 3 tables –• Table 1• Table 2• Table 3Table 1 and Table 3 already contains some data along with hyperlinks. Now I want to populate hyperlink and other data in...
12 Jun 2014 by Silver Lightning
Hi to all,I would like to ask on how could I get the blank row in excel file using open xml in vb.netmy existing code doesn't get the blank row where my excel file has 10 records including the blank row. Open xml only gets 9 records of my excel file, it ignores the blank row or null...
16 Jul 2014 by Silver Lightning
Hi Sir/s,Great day.I'm new to open XML vb.netI would like to know on how to assigned dummy value in cell.CellValue if the cell.CellValue in openxml is nothing or nullI'm getting error when the function GetExcelEnumerator catches nothing in cellValue.The error is 'Object...
21 Jul 2014 by Member 10962025
I want to create a pivot table in a worksheet called pivot from a table which is in another worksheet. The excel File is in the shared documents document library in SharePoint 2010.so far i managed to write data into the file but couldn't create or refresh an existing pivot table using...
13 Aug 2014 by Anand Kumar Devendran
Hello Experts,I am currently working on office AddIn.In my active(opening) document i have many contents controls like name, Age, Address, etc., In my UI screen am listed all the contents controls(xml tags) in tree list.Here am selecting the name controls from tree list and...
15 Oct 2014 by AmolPatil19787
Hi,I have one xml string I have created that using string some string functions.eg.
26 Oct 2014 by Member 11182322
In Word document i have some math equations like a+b=cNow i need its mathml by using openxml in C#.
26 Oct 2014 by George Jonsson
First you need to understand the two formats. Wikipedia at least gives you a starting point and references for further reading.Wikipedia MathML[^]Wikipedia OpenMath[^]You can use XSLT to convert one XML structure to another.XSLT Tutorial[^]MSDN is a good source of information, here...
10 Nov 2014 by Bob Sidie
How is the image height defined for an embedded object? In this case, referencing an Excel workbook embedded in a PowerPoint slide.Steps to reproduce:1. Create a new Excel workbook with one column and 38 rows. Fill the cells with the row number from 1 to 38 just to have data.2. Set the...
13 Nov 2014 by Dammit Jim
Hi,I have some XML stored in a single column of a table. I have written the following SQL query but get nothing back. Can somebody a bro xml novice in a bind out with some suggestions?
21 Nov 2014 by Am Gayathri
How do i read the values in a excel files in to data table using open xml ?How can i read the values from excel stored in my local in to datatable using open xml.
21 Nov 2014 by PIEBALDconsult
http://epplus.codeplex.com/[^]
1 Dec 2014 by Am Gayathri
How do i convert a string in to html format?To be precise, i want to convert excel cell value in to html format.For example: if excel cell values is 'am a programmer'. I want to convert it in to 'am a programmer'.Is it possible?If any values are bold then html bold tag should...
2 Dec 2014 by Am Gayathri
Loop through each character in excel then check the format.StringBuilder html = new StringBuilder(); for (int index1 = 1; index1
26 Dec 2014 by Pratik2210
I am getting error while opening the excel which is newly created using OpenXML 2.5. I am facing below mention issues1. Asking to mark as trust the source2. Repaired records: Format from xl/styles.xml part (Styles)However, I have validated the excel using SDK productivity tool and...
4 Jan 2015 by JShayan
Is there any sample of splitting docx file into multiple files by searching keywords? for example we have a big word file which has repeating content but with different ID and informations. I would like to split them into separate files. How can we achieve this in C#? Separating...
26 Mar 2015 by Mario Z
Hi, I cannot be 100% sure, you really did not provide much information, but I believe your solution is not using the IsolatedStorage, you see your issue ("Initialization failed") occurs due to it.Unfortunately you don't have a control over this, the OpenXML SDK uses System.IO.Packaging...
26 Mar 2015 by july2008
Hi guys I am new to openxml, I want to get the background color for a cell in Excel using openxml, but i don't know how to start it.Anyone can help me ?Many thanks
27 Mar 2015 by Mario Z
Refer to this answer[^].
29 Mar 2015 by july2008
Thanks for your help Mario.I have tried the example in the link But it is not giving me the exact background color of the cell. some times i am getting object reference null exception as well even when the color is present for the cell. also there are some indexed based colors which i am not...
8 Apr 2015 by jinesh sam
Hi Friends,My requiremnet is to merge three cell of excel. I am using Open XMl for excel.Another requirement is to delete a particular column from the SheetDataBelow is the method which i am using to generate the excel file.Please go through the code. There i mention my requirement as...
8 Apr 2015 by Maciej Los
Please, read these:How to: Merge two adjacent cells in a spreadsheet document (Open XML SDK)[^]How to Delete a Column in Excel using Open XML SDK[^]
10 Apr 2015 by Sergey Alexandrovich Kryukov
First of all, please see my comment to the question.The direct answer is: if you want to parse HTML, the best way to do it would be applied if you have HTML well-formed as XHTML, that is, XML. Then you can use one of the many available parsers. This is my short overview of what you could use...
15 Apr 2015 by RS.Ratheesh
How can i embedded CSV/Text file object in to the word document using OpenXml sdk?Regards,Ratheesh
14 May 2015 by wfsush
The docText may be invalid after you change the document by add rows?Stey by step debug to see the details may help you。
21 May 2015 by Shreechand Mukati
using (var workbook = SpreadsheetDocument.Create(destination, DocumentFormat.OpenXml.SpreadsheetDocumentType.Workbook)) { var workbookPart = workbook.AddWorkbookPart(); workbook.WorkbookPart.Workbook = new...
27 May 2015 by JonKarlsson
I have similar scenario, where I have to present CSV text data from external file in MS Word table, which needs to be formatted as well. I am using 3rd party tool for that, because it is very easy to create a template document, format it and then I am reading CSV file into a .NET class. In my...
2 Jun 2015 by nits23
I want to Take out those theme from the Slide want to put that theme in another slide .
4 Jun 2015 by Aksh@169
hi, I want to password protect my Open XML.please help me out i am new to this.Thanks in advance.regards,aksh@169
3 Jun 2015 by nits23
I used powerpoint interop :- By using Themecolorscheme.Save() method i am saving the theme file of ppt and by using ThemeColorscheme.Load() method i am loading that particular theme to another ppt file.
1 Jul 2015 by kedar001
i have a document which contains some tags in table. how i can read/get it using openxml or XDocument i want to Remove and then Add updated tag in the document.
1 Jul 2015 by Abhinav S
These might help you -Read/ Write tags in PowerPoint using OpenXML in C#[^]Read and write Open XML files (MS Office 2007)[^]Read Excel as DataTable using OpenXML and C#[^]
16 Jul 2015 by kedar001
how i can accept formatting Changes
5 Nov 2015 by Madan Mishra
Currently I have a task that insert custom note to a particular slide of a ppt using openxml. from referencing this link. I am trying to add note to a slide but I am getting the following Error. Error Message :Only one instance of the type is allowed for this parent.Stack Trace:at...
28 Sep 2015 by Patrice T
An idea: Read Openxml sdk documentation.- Google is your friend.- read/search documentation.- follow tutos.-Create an Excel WorkBook, put what you want in it, save it in Openxml format, open the file in text editor to see how it is done. It may help.
7 Oct 2015 by ZenigataCP
Hello all,I had a requirement where I need to group columns in the excel using OpenXMl SDK.I have gone through the several websites but was unlucky.Any help would be appreciated.Thanks!!
28 Oct 2015 by ganesh.dks
Hi,In our application we have used EPPlus to create excel 2007 files. But as per client requirement we had to create an excel 2003 file generation function for same data. We used OpenXML to create excel 2003 file. Now I came up with idea to use the same excel 2007 or xlsx file for both...
28 Oct 2015 by Richard Deeming
Neither EPPlus nor the OpenXML SDK support generating Excel 2003 files, which were a proprietary binary format. You'll need to change your code to use a library which supports the older file format - for example, NPOI[^] (NuGet package[^] | Documentation[^]).
5 Nov 2015 by BooPaul30-04
This is working for me please check with this code. Thanks using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using DocumentFormat.OpenXml.Packaging; using P =...
15 Nov 2015 by Amit Upadhyay
Dear Sir,I am developing a word addin for MS Word 2013. In this when the user open a new word document file and click on the addin, the custom task pane will get filled with the attributes of the table from the database in multi check box. After selecting the desired attributes, when user...
23 Nov 2015 by rajah rajah
i've done excel export using OpenXml instead of excel objects.I've Sheet1 and sheet2.In sheet one i have dropdown list in column "C1",where i used the source data from sheet2 . Now i want to delete/hide sheet2 while exporting excel sheet without effecting dropdown data.When i tried below...
23 Nov 2015 by rajah rajah
This Solution worked for me after some alterationhttps://social.msdn.microsoft.com/Forums/en-US/7191e89b-ef46-423f-b099-d98750f3fefd/hide-column-in-excel-using-openxml[^]
5 Jan 2016 by Nawab Ahmad
Hi,I am using this Code to add data to row and column in closed xml ,how to use this in open xmlforeach (var header in dynamicHeaderList) { ws.Cell(rowID, column).Value = header; ws.Cell(rowID, column).Style.Alignment.Horizontal =...
5 Jan 2016 by Abhinav S
I'm not sure how you want to use openxml here.To create a table you will need to use the Open xml SDK. Working with WordprocessingML tables (Open XML SDK)[^] provides and example where a table is created from an xml.On the database side, Sql server OpenXml provides a rowset view over an...