Click here to Skip to main content
15,890,527 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 Updated

OpenXML 

2 Apr 2018 by #realJSOP
You're interested in the TextFrame.AutoSize property. It's an enumeration of the following values: ppAutoSizeMixed, ppAutoSizeNone, and ppAutoSizeShapeToFitText.
2 Sep 2013 by aatish442000
private void toolStripMenuItemMcDonald_Click(object sender, EventArgs e) { try { ////saveData(); string ndocPath = String.Empty; OpenFileDialog dlgOpenFile = new OpenFileDialog(); if...
11 Jul 2016 by Abhilash.J.A
Sir, I am trying to create a pie chart, then export to word using OpenXml in c#.net. But the problem is, 1) It is exporting but nothing shows ms word 2010 only. 2) I am using ASP.NET MVC4 project, there is a google pie chart which has around 1000 data by representing with multiple...
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#[^]
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...
18 Oct 2014 by adityaswami89
A generic way of adding a table to Powerpoint using OpenXML
15 Nov 2016 by ahmdr
Hello,I am extracting data from database and adding them to Excel sheet, my data as below:ID, Name, Description, CV Linkand already extracted the CV's to be in physical folder, and I wrote in the excel sheet the data even link for CV in physical folder.My problem how can I make...
3 Jun 2020 by ahmed_sa
I work on c# desktop app I cannot export data to excel sheet with multiple tab meaning multi sheet based on data exist on data table module field I use open XML library Data table data as below : Divide Output Excel File To Multi Tab based...
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 ....
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
28 Sep 2015 by Alivia Banerjee
Can any body provide some idea/codesnip on how to add superscript in excel using Openxml sdk?
30 Oct 2014 by Am Gayathri
Below is the code am using to create excel from datatable using openxml. XLWorkbook workbook = new XLWorkbook(); workbook.Worksheets.Add(datatable, "excel"); workbook.SaveAs(pathtosave); Its working perfect but all the cells...
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.
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
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) { ...
21 Jul 2022 by Aman Bhullar
check this: C# – How To make some text bold in cell using OpenXml – iTecNote[^]
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...
15 Oct 2014 by AmolPatil19787
Hi,I have one xml string I have created that using string some string functions.eg.
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 Jan 2016 by Andy Lanng
Hi,I'm finding it difficult to get to grips with OpenXML.All I need to do it read the rows and cells into an object[][].here is what I have:SpreadsheetDocument doc = SpreadsheetDocument.Open(new MemoryStream(file), false);List products = new List();foreach...
24 Jan 2016 by Andy Lanng
Hi,Let me explain the title:I am reading in a *.xmls file. I need to get put the cells into an object[][] before the next step. I had been adding each row in index order but I have found that if a cell is left blank then it is not included in the row object: foreach...
25 Jan 2016 by Andy Lanng
Ok, so I wrote my row-by-row parser. I'll be dealing with the order of 1,000's of rows so it's speedy enough. Some suggestions on StackOverflow (datatable - reading Excel Open XML is ignoring blank cells - Stack Overflow[^]) may be more efficient:foreach (OpenXmlWorksheetSelector...
29 Oct 2019 by Anibalito
Hi, I'm working with SpreadsheetLight in Visual Studio 2008. DocumentFormat - 2.05 SpreadsheetLight - 3.4 When executing the SaveAs ("File Name") method on some terminals, regardless of whether it is Windows 7 or 10 it takes a long time to finish its execution, not allowing you to do anything...
29 Oct 2019 by Anibalito
Hello, After continuing to test, without results, I decided to change and do it in Visual Studio 2019 with NetFramework 4.7.2. and the same libraries. Problem solved!
5 Aug 2021 by Ashish Dubey 2021
Open XML Formats and file name extensions - Office Support[^] OpenXML will not work with doc format but with docx format. So if you are trying with doc format then first change it extension using below method ]public void...
23 Jan 2018 by AzureAWS
May I ask, How you are generating the Spreadsheet,What I mean by that is, are you writing each cell in a loop? If so, then you can set the DataType of each cell as string. Cell cell = new Cell(); cell.DataType = CellValues.String; cell.CellValue = new...
26 Aug 2016 by B. Clay Shannon
In which the esteemed and humble author selflessly - indeed quasi-heroically! - presents a grab bag of snippets to use when utilizing the open-source EPPlus library to create spreadsheet files
30 Sep 2016 by Balaji5
I have the requirement to read user selected value from SdtContentDropDownList field from .docx using Open XML, C# and also can you please tell me, how can we use DocumentFormat.OpenXml.Wordprocessing.DropDownListSelection in c#, OpenXMLWhat I have tried://To Read Control Value ...
6 Mar 2013 by Bharath from India
234234 64850 234 234 ...
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...
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...
14 Jan 2016 by bjay tiamsic
Hi. I am trying to create multiple .docx files (base on the number of rows in gridview) using 1 template only. It goes through but I am encountering a message saying that "Duplicate Headers received from server" Here is my code:TextInfo txtInfo = new CultureInfo("en-US",...
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...
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 =...
12 Oct 2023 by chiaracat
I opened an Excel file with OpenXML. I need to lock some cells into sheet. What I have tried: I used the protection object, but I can only lock the entire sheet.
17 Oct 2023 by chiaracat
Hi I have find solution: I add a protection to sheet SheetProtection objStyleSheetP = new SheetProtection(); objStyleSheetP.Password = "123"; objStyleSheetP.Sheet = true; objStyleSheetP.Objects =...
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...
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) { ...
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 Jun 2017 by Dankwansere
How to insert an image into an "inline shape" in Word Document using Microsoft Open XML SDK
13 Jan 2023 by Darryl Bryk
Does anybody know how to add text to a footer using OpenXML? Unfortunately, knowing how to add text to the document part is not helping much since footer/headers are setup differently and don't seem to have corresponding parts. What I have...
13 Jan 2023 by Darryl Bryk
Good solution from Seergius96 on StackOverflow: doc = WordprocessingDocument.Open(_stream, true); FooterPart footerPart = doc.MainDocumentPart.FooterParts.LastOrDefault(); footerPart.Footer.AppendChild(new Paragraph(new Run(new Text("CUI\n"))));
11 Oct 2023 by Dave Kreskowiak
Yes, protection only works on the entire sheet, not cells. What you do is set the cells you want to protect as "locked" and all other cells as "unlocked", then you enable protection on the sheet to turn the protection of locked cells on and off. ...
30 Sep 2016 by David_Wimbley
Like richard said, you need to review the documentation for what you are trying to do.Google needs to become your friend:DocumentFormat.OpenXml.Wordprocessing.DropDownListSelection - Google Search[^]DropDownListSelection Class (DocumentFormat.OpenXml.Wordprocessing)[^]You really...
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...
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...
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[^]
26 Sep 2019 by F-ES Sitecore
One of your queries on that line is returning no results. Split the line into separate queries so you can test them in the debugger. Something like var a = mainPart.Document.Body.Descendants(); var b = a.Where(r => r.SdtProperties.GetFirstChild().Val == "Name"); SdtBlock block...
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...
9 Jan 2018 by Gaushick
Below code will work for update the table of content automatically with Macro popup DocumentSettingsPart settingsPart = mainPart.Document.MainDocumentPart.GetPartsOfType().First(); // Create object to update fields on open ...
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 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 +...
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?[^] ......
28 Dec 2022 by Graeme_Grant
I did a quick Google search using your question: How can I insert a bitmap object (not a file) into a word document using openxml? - Google Search[^] and the 3rd search result was to this CodeProject article: Inserting an Image into an "inline...
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...
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 =...
15 Mar 2013 by hasenn
thanks for replyi tried but i got an error when i try word document :(
27 Sep 2013 by Hisham Saber
This code solves the problem when exporting very large data size to Excel file.
21 Sep 2016 by IamWsk
How to make different colors of texts in same excel cell using closedXMLClosedXML doesn't have something like I tried below please help me to make 2 different font colors in same cellWhat I have tried:worksheet.Cell(1,1).Value.Character[StartIndex, NoOfChar].Font.Color....??
21 Sep 2016 by IamWsk
I found the solution by my selfUse RichText to style different parts of the cell, for example:worksheet.Cell(1,1).RichText.Substring(StartIndex, NoOfChar).SetFontColor(XLColor.Red);See the [documentation] for more details.
30 Oct 2018 by IamWsk
OpenXML not opening a .xlsx (latest version) file on the windows server due to missing document properties, however if you open that file on your local system and you upload it on server then it works because all the properties got created when you opened it. on the server when application...
31 Jan 2016 by Ivica Vesic - Pidzi
I have a word file that should be embedded in excel file. I can put a word file, but it only shows as .bin file inside excel zipped file. How can I make it visible inside excel (let's say at position cell C3)? I also need to edit that embeded word file later. Interop is not an answer, because...
8 Feb 2016 by Ivica Vesic - Pidzi
Nevermind, I stoped searching for this, even if I foind out how, I have to generate screenshot for a file everytime embeded file get updated because the view of the file is actually just an image. Thank you anyway.
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...
21 Jul 2022 by jekin77
To make a cell bold use c.StyleIndex = (UInt32Value)1U;
9 Jun 2017 by Jeremy James
I'm building a payroll application for a client and have run into a problem with generating a report in Microsoft Word. All information for salary and employees are saved in a Sql Server database. So, the problem is that I'm not sure how to go about creating the report dynamically to meet the...
23 Oct 2015 by Jillumani
How to convert ppt slides to image using Open XML.
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 May 2016 by jinesh sam
Hi Friends,I have a method which will append the rows to the existing excel file. The problem which i am facing is, my excel file have two sheets, when i try to update the first sheet second sheet get automatically populated. So basically whatever the changes i made in sheet 1 get...
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...
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...
13 Oct 2016 by José Amílcar Casimiro
Hello,Check this tutorial from Microsoft: > How to: Open a word processing document for read-only access (Open XML SDK)[^] @JAFC
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 Apr 2016 by JT1992
Please refer using sheet.Cells.DeleteRow(2);Thanks.
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
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...
14 Dec 2017 by Kannan Ar
A step by step guide to integrate AngleSharp HTML parser into MariGold.OpenXHTML
9 Jun 2017 by Karl Erlacher
The solution may not be that difficult at all. What you need is a Word template (which you've got already), but it has to be able to work with a list component where you can repeat rows of data placeholders, so you can get several lines with the same formatting in your final document. You can...
21 Mar 2017 by Karthik_Mahalingam
try this using (DocX document = DocX.Create(path)) { Hyperlink h = document.AddHyperlink (name, new Uri(uri)); Paragraph p = document.InsertParagraph(); p.AppendHyperlink(h).Font(new FontFamily("Comic Sans...
22 Sep 2022 by Karyna Arciniega Sánchez
Como puedo incrustar objetos en un excel file con la libreria OpenXML es que Microsoft.Office.Interop.Excel me causo problemas al usbirlo al server :(
21 Jan 2020 by Kayman Luther
I am running some test and using OpenXML now I want to get the data into an Array and save to their respective content controls. I tried and I am getting this execption Sequence contains no Elements at System.Linq.Enumerable.Single[Tsource](IEnumerable'1 source) I have this Source code ...
31 Jul 2015 by kedar001
Hi..i have Code to Update Custom Variables using OpenXml SDK in C#to Update custom variables in document i have added using (_objDoc = WordprocessingDocument.Open(szFileName, true)){ DocumentSettingsPart settingsPart = ...
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.
16 Jul 2015 by kedar001
how i can accept formatting Changes
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...
8 Nov 2015 by koolprasad2003
This article help you to create word table using OpenXML without interop object
13 Feb 2017 by koolprasad2003
This article gives you idea, How to Disable Copy/Paste option from Word (Docx) document using C# and OpenXML
18 Nov 2019 by kpanchal
i replace text in presentationDocumentNew Save file on Physical path - Its worked presentationDocumentNew.SaveAs(tmpFilePath); presentationDocumentNew.Close(); Question: OpenXml Presentation(PPT-pptx) i don't want to save in physical part. I just want to download file directly from...
13 Mar 2014 by Kunal Khosla
Hello,I have written code to generate xlsx file using OpenXML. It's working very well on my local machine through IIS and through visual studio. I have hosted the web application on windows server 2003 and on windows server 2008. The excel file are generating fine for small data. But when...
7 Jul 2013 by lanep
Hi Guys, I have a program that creates xml files, I have to import these into XLSX spread sheets. I can do this using COM but when the xml file gets big (+50mb) it can up to an hour to open. I've done some looking around and I have found OpenXML - which is apparently faster.I've had a...
5 Feb 2014 by LazyCoder0
This article describes how to merge PowerPoint Presentations (PPTX format) and save as PDF in .NET applications using Office Automation (OpenXML SDK).
22 Sep 2022 by Lenin Mathi
I am using closed xml for data population in a predefined excel macro template file (xlsm) in sheet-1, along with that i have to insert PDF file as an object in sheet-2. vb.net - Embed Object in the existing Excel Worksheet using ClosedXML -...
25 Apr 2013 by Maciej Los
In previous version of Excel application, there was a NumberFormat[^] property for cell.Please, follow the below...
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...
17 Sep 2013 by Maciej Los
Set ReadOnly attribute using File.SetAttributes Method[^].
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[^]