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
1
vote
0 answers

ClosedXML Master-Deatail-Report

community: I'm implementing ClosedXML in C# and I've a query that brings me a set of structured data in the following way: [ { "CustNo":"1", "Company":"Name Company", ..., "Orders": [ { …
1
vote
1 answer

SetDataType in ClosedXML was removed

I am trying to set the DataType of a cell to String using the method SetDataType() in C# in this way: worksheet.Cell(x, y).SetDataType(XLDataType.Text); But SetDataType() was removed from ClosedXML since 0.94.0. I am now unsure on how to resolve…
Alessandro
  • 97
  • 6
1
vote
0 answers

ClosedXML (Windows): Unable to find font Tahoma or fallback font Microsoft Sans Serif

I'm facing an issue to produce an excel file in local machine through a SQL Server job using ClosedXML in a script task (C#). The job under a service account and it has admin privilege in local machine. Below is the error it is producing. "Unable…
1
vote
1 answer

Must ClosedXML support every function in a workbook in order to be able to save it?

I want to load a large Excel workbook, modify a few fields and then save the result. Unfortunately, ClosedXML errors on save on functions it doesn't support, eg: NameNotRecognizedException: The identifier `_xlfn.IFNA` was not recognised. Looking…
Matthew Lowe
  • 1,350
  • 1
  • 17
  • 29
1
vote
0 answers

C# - ClosedXml - Excel cannot open file 'test.xlsx' because the file format or extension is not valid

I have a problem for which I have been unable to find a solution. I am utilizing the following technologies... C# .NET Durable Function - Timer Trigger Azure Blob Storage - to back up workbook SendGrid - to email workbook ClosedXML (including…
IndyDev
  • 81
  • 1
  • 10
1
vote
2 answers

How to add new item into a list without overwriting the old item

I'm exporting some data from database to excel using CLOSEDXML. I need to add the corresponding objects/item to each object in the 'newModelist' IQueryable and add all the object to new List. In my case new row were added in the list using list.add…
Veck
  • 125
  • 1
  • 3
  • 13
1
vote
1 answer

ClosedXML how to set cell width for whole workbook?

i'm using closedXml to export data to Excel. But my columns need to be adjusted to the content therefore i've tried to specify the colums width by hand: var ws = workbook.Worksheets.Add("Column Settings"); col.Width = 50; Wasn't working for…
UwUs
  • 67
  • 1
  • 9
1
vote
1 answer

How to update Excel Cell based on validation using ClosedXML?

I have an input excel file which contains 6 columns and n number of rows. Out of which 3 columns are mandatory columns. If any of mandatory columns are empty then I need to update some custom text in the Remarks column. In the input excel column…
Tech Learner
  • 1,227
  • 6
  • 24
  • 59
1
vote
1 answer

Copy Row in ClosedXML

How can you copy a row in ClosedXML? var sheet = oldFile.Worksheet(1); IXLRow headerRow = sheet.Row(1); var newFile = new XLWorkbook(); var ws = newFile.Worksheets.Add("Sheet to copy to"); // how to copy header row to ws? // this doesn't work //…
thalacker
  • 2,389
  • 3
  • 23
  • 44
1
vote
1 answer

How to convert an Excel file to .CSV using ClosedXML for un-structured data

I have a scenario where I need to convert an MS Excel file to .CSV format in Net core 3.1 application. The data in the Excel file is not in tabular format, some places having merged cells or some headers information and then tabular data. I tried to…
Sachin
  • 459
  • 1
  • 7
  • 22
1
vote
1 answer

Merge Two Columns in ClosedXml

How can I merge two columns {for eg : column Q and column R} in a worksheet using closedxml and c#. Appreciate any kind of help. Thanks
Sushmit
  • 51
  • 1
  • 8
1
vote
1 answer

Insert 'X' symbol into a cell using closedxml in c#

I'm aware of the following solution for adding symbols into cells using closedxml in c# ws.Cell(1, 1).Value = "X"; i am trying to add 'X' symbol but i am getting the symbol code. Could you please provide 'X' symbol code to me.
krishna
  • 19
  • 7
1
vote
1 answer

In C# Writing to Excel, How to show a big number as it is (Not with scientific notation)?

I am sending an excel file from backend. I have got long numbers for some cards' numbers. I need to show them in Excel but I want all of them to be number and edit them as it is (sometimes the value and the shown text differs, I want them to be the…
Sahin
  • 1,032
  • 14
  • 23
1
vote
1 answer

ClosedXML how to freeze rows and columns when i export file

I have implemented the code below, all headers and data are added without any problem. If he wants to block the possibility of editing individual fields or columns in the excel file that is downloaded by the user, then there is a problem, because…
WiceJav
  • 75
  • 5
1
vote
1 answer

Importing Excel to DataGrid using ClosedXML and OpenFileDialog

I want to load an Excel-file into my DataGrid, using ClosedXML. I have this method: public static DataTable ImportExceltoDataTable(string filePath, string sheetName) { using (XLWorkbook wb = new(filePath)) { IXLWorksheet ws =…
Ole M
  • 317
  • 1
  • 17