Questions tagged [closedxml]

ClosedXML is a .NET library for reading, manipulating and writing Excel 2007+ (.xlsx, .xlsm) files.

ClosedXML is a .NET library for reading, manipulating and writing Excel 2007+ (.xlsx, .xlsm) files. It aims to provide an intuitive and user-friendly interface to dealing with the underlying OpenXML API.

ClosedXML provides a object oriented way to manipulate Excel 2007+ (.xlsx, .xlsm, etc) files (similar to VBA) without dealing with the hassles of XML Documents. It can be used by any .NET language like C# and Visual Basic (VB).

Online resources:

615 questions
5
votes
0 answers

How To Import and Display Excel (.xlsx) File to Blazor WASM Client Side (Without Uploading to Server)

Like the title says. Lots of examples online for uploading files to backend but I'm after verification client side/offline followed by an upload of data only (no files). In theory, anything that runs on .Net5 should be able to run in WASM at a close…
Waleed Al Harthi
  • 705
  • 9
  • 25
5
votes
1 answer

Closed XML change entire row background color based on cell value

I'm trying to color an entire row based on a cell selection(value).I want to change the color of the row just for the used range in my worksheet but not for unused cells. Here's the code I have right now: class Program { static void…
Andrei
  • 270
  • 1
  • 5
  • 12
5
votes
1 answer

ClosedXML does not give me option to format column

I'm having an issue when I try to change the format of an entire column. My issue is that I don't get the XLCellValues operand. I am able to choose XLDataType.Text but that does not work. This is what I…
5
votes
1 answer

ClosedXml C# to display formula output numbers

I'm using closedxml to generate and download an xlsx file from a .NET c# application Is there a way to display the formulas output numbers without the user having to click Enable Editing after downloading and opening the file in excel?
5
votes
1 answer

ClosedXML Worksheet from DataTable isn't following Culture

When I add a worksheet via a DataTable, I would expect the date formats to follow the locale/culture of the application but it appears to take that from the computer. string culture = "en-GB"; var newCulture = new…
5
votes
4 answers

ClosedXML - Setting data type for cell does not work

I have similar question about ClosedXML, like this one but a little bit diferent. The SetDataType method does not work. For example, I have value string dps = "3.12.02" which is not a date nor number, it is valid text. When I do this: ws.Cell(1,…
Lucas
  • 83
  • 1
  • 10
5
votes
2 answers

How to add multiple datatable to one worksheet using closedxml?

I have multiple datatables with data and I would like to add those in single sheet with space. I am using ClosedXML to develop export excel utility.
LearningPal
  • 554
  • 2
  • 12
  • 27
5
votes
1 answer

Find a string in a Range using ClosedXML C#

I want to be able to find if a particular string exists in a range using ClosedXML, however, I cannot find any find command in the documentation. Currently I loop through 1000s of rows to find if the string exists. Is there a more efficient way to…
djblois
  • 963
  • 1
  • 17
  • 52
5
votes
3 answers

How can we create charts in excel using closedxml

How to create charts in excel,While exporting data from database to excel sheet..! I'm exporting data to excel from database.I need to create chart in the excel sheet based on data from database. Below code creates simple excel sheet I need to make…
Junaid
  • 51
  • 1
  • 1
  • 5
5
votes
4 answers

export Gridview to Excel using ClosedXML without warning: the file you are trying to open is in a different format

I am working on a ASP.NET 4.5 Webform and I have a Gridview (that has custom TemplateField and gets data from a sqlDataSource) I have this event to export the gridview contents to an excel sheet, and it does its jobs well except the created file is…
Ronaldinho Learn Coding
  • 13,254
  • 24
  • 83
  • 110
4
votes
1 answer

How to process an iFormFile with ClosedXML with c#

I want to load an excel file into XLWorkbook using var workbook = new XLWorkbook("iFormFile needs to go here"); var ws = workbook.Worksheet(1);
Ashane Alvis
  • 770
  • 2
  • 18
  • 42
4
votes
1 answer

Exception in ClosedXML GetString with Excel formula

I am opening an Excel spreadsheet and processing it. When I get to a cell that contains a formula (LOOKUP in this case), there is an exception: Cannot convert Submission!G6's value to System.String This is happening in this line of code: …
Jess
  • 23,901
  • 21
  • 124
  • 145
4
votes
2 answers

Style border Excel using ClosedXML in C#

I have a table data in Excel I want to apply style broder as image How to code script in C# using ClosedXML?
Ly Thanh Ngo
  • 394
  • 1
  • 2
  • 15
4
votes
1 answer

Getting a range of cell values into a list using closedXML and C#

I am using closedXMl to retrieve data from excel into my C# WPF. I am using the Range() function to manually select a range for data retrieval. How can I get the values in the cells and store them into a list? Is there a way to work around this?…
Nate
  • 119
  • 1
  • 2
  • 10
4
votes
2 answers

How to format Accounting number format for cells using ClosedXML

How to format a cell as Number Accounting category using ClosedXML?
user1517433
  • 41
  • 1
  • 4