Need sample examples on applying the font and color to the excel cell with using DocumentFormat.OpenXml
Category: open xml format sdk
Narayana Reddy GundReddy on Tue, 17 Mar 2020 03:23:39
I have a requirement to apply the font and color to the excel cells in a row using DocumentFormat.OpenXml and have to do it programatically. I would like to have sample code examples or article(s) with regards to this. Please share your ideas and information. I appreciate your help and support. Thank you so much!
Narayana Reddy G
Ashidacchi on Tue, 17 Mar 2020 06:54:00
I'd like to confirm:
1) What do you mean by "programatically"? Do you want to use Excel VBA or other programming language (e.g. VB.NET, C#)?
2) Could you share a sample OpenXml file via cloud storage (e.g. OneDrive, Dropbox)?
Narayana Reddy GundReddy on Tue, 17 Mar 2020 09:31:39
Thank you for your reply. I want to use C# language to apply styling on excel cell. I requested any sample programming examples for styling excel cell. If you have any articles explaining to achieve the excel cell styling through c# programming, please share those links here. Thank you so much for your support!
Ashidacchi on Tue, 17 Mar 2020 09:58:34
Thank you for your explanation.
Let me ask one more question. In your first post, you wrote "DocumentFormat.OpenXml". And in the 2nd, you said "excel cell".
Can I understand that you want to style cell in Excel worksheet with C#?
Narayana Reddy GundReddy on Tue, 17 Mar 2020 10:13:19
Yes, I want to style cell in the Excel worksheet, but I have to make use of this class Document
Ashidacchi on Tue, 17 Mar 2020 10:39:19
I've found some examples.
Excel styles and formatting in C# and VB.NET
Formatting Excel Sheet using C#. The Style apply to all cells not to one cell
I hope these articles will be helpful.
Ashidacchi on Tue, 17 Mar 2020 10:49:32
Hello Narayana Reddy G,
Let me ask one more question.
Why is "DocumentFormat.OpenXml.Spreadsheet" needed?
Can't we style cells in the Excel worksheet with "Microsoft.Office.Interop.Excel"?
Narayana Reddy GundReddy on Tue, 17 Mar 2020 11:01:12
We may have to install excel software on the server, if we make use of "Microsoft.Office.Interop.Excel". This is the reason I am advised to make use of DocumentFormat.OpenXml.Spreadsheet. Thank you for your support and time.
Ashidacchi on Tue, 17 Mar 2020 11:41:18
Hi Narayana Reddy G,
We may have to install excel software on the server, if we make use of
In my environment (Win.10 Pro 64-bit, Excel 2016 32-bit), "Microsoft.Office.Interop.Excel.dll" is in a folder
2) "C:\Program Files (x86)\Microsoft Office\root\Office16\DCF"
I suppose it would exist in PCs which can execute Excel and C# program, and your client PCs can execute your C# application without Excel software on the server.
Narayana Reddy GundReddy on Tue, 17 Mar 2020 17:43:53
Thank you for sharing the information. As of now, I am advised to make use of "Microsoft.Office.Interop.Excel.dll. Thank you again for your support and time.