634 questions
1
vote
0
answers
58
views
Issue width from xlsx (closed xml) to pdf (itextsharp)
I’m having an issue with the text font. I’m trying to convert an Excel file to PDF using ClosedXML and iTextSharp, and I want the text to fit perfectly inside each cell. However, sometimes the text ...
0
votes
1
answer
51
views
ClosedXML filters do not work with opened files
I'm trying to implement filters in ClosedXML, but they aren't working.
I can only get them to work in new files created with ClosedXML, but I can't add filters to other files.
This is an example of ...
0
votes
0
answers
75
views
ClosedXML not providing proper formatted Excel in .NET 6
I am trying to export my list data to Excel using the ClosedXML NuGet package. The Excel file is exported, but the format is incorrect, as shown in this screenshot:
I am expecting the output to look ...
0
votes
0
answers
118
views
Find and Replace string in a column using ClosedXML Excel
Using Interop in VB .Net, I am able to find and replace a string in a range of cells in an Excel file. For example, I want to replace any blank cells in Column A of a worksheet with "Not provided&...
0
votes
0
answers
160
views
How do I prevent IronXL from corrupting my saved Excel file?
I have a .NET Framework 4.8, C# application. I'm using IronXL.Excel 2025.2.5 to read and export data to an xls file (that's an old Excel 97-2003 file; unfortunately this cannot be changed to a modern ...
0
votes
1
answer
280
views
ClosedXML debugging System.OutOfRangeException (maximum allowed length of the value is 255 characters) when loading an XlWorkbook
I'm getting a the below error when trying to load an xlworkbook:
System.ArgumentOutOfRangeException: 'The maximum allowed length of the value is 255 characters. (Parameter 'value')'
The code is ...
0
votes
1
answer
287
views
ClosedXML empty string instead of null value while bulk copy C#
I'm bulk copying DataTable into excel file with ClosedXML.
In DataTable not all items have values. When puting it in file it seems that the value in this cells are "" (empty strings) instead ...
1
vote
0
answers
123
views
How can I extract image placed inside a cell in excel with C#?
I am currently trying to extract all images and their positions from an Excel file in C#. It works fine if the image is placed over the cells. In that case, I can use ClosedXML.Excel and retrieve them ...
0
votes
1
answer
164
views
Why do I get the error "Cannot access a disposed object" when using a stream
I am trying to read an xlsx file using CloseXlm so I created the below ReadFile method. In order to test it, I've created a test method using MSTest and another method that creates an xlsx file and ...
0
votes
1
answer
123
views
How to create and download an Excel workbook with "Enable Editing" using ClosedXml in a Blazor WASM app
A Google search yielded: To create a spreadsheet with "Enable Editing" using ClosedXML in C#, simply create a new workbook and add data to it without applying any protection mechanisms; by ...
0
votes
1
answer
175
views
Comparing values of ClosedXML cells
I have been working on a program in VB.NET using ClosedXML. It basically should take in data from 2 Excel files.
Here is a sample of 1st (and only) worksheet from the first file (referred to as ws2):
...
0
votes
1
answer
640
views
Closed XML - Excel - VB,Net
I'm pretty new to the field, I have been trying to use ClosedXML to create and modify Excel files automatically.
But this doesn't seem to be working. I'm basically trying to copy data from 2 files ...
0
votes
1
answer
378
views
ClosedXML and System.Memory Error in .NET 8: Anyone Solved This?
I’m migrating a project from .NET 4.8 to .NET 8. The ClosedXML library is compatible with .NET 8, but I’m encountering an error when using the XLWorkbook class. Despite installing System.Memory, the ...
0
votes
1
answer
99
views
Write protect columns but allow Auto-Filter in Excel created with ClosedXML
I am using ClosedXML with C# to create a Excel Worksheet.
The requirement is to
Allow Auto-Filer on all columns
Allow edit only form column "B", write protect the remaining columns
Allow ...
0
votes
1
answer
86
views
How to get typed data from sql select statement to Excel
ASP.NET Core 8 MVC application controller should create an Excel spreadsheet with typed data in columns (numbers, strings, dates, logical) from arbitrary SQL select.
I tried this code:
public async ...
0
votes
0
answers
219
views
Export files to Excel XLSX file using C# and ClosedXML.Excel
I have a problem with exporting my data to Excel XLSX format using C# ASP.Net and ClosedXML.Excel
In practice when I execute the stored procedure "sProc_20241009" on the MySQL DB I have this ...
0
votes
0
answers
74
views
[Solved]Use ClosedXML to modify Crystal Report export stream - cannot SaveAs - get an exception
I use ClosedXML(0.102.3) to modify Crystal Report export Stream,
when I use this code
ReportDocument crReportDocument = new ReportDocument();
crReportDocument.Load("D:\\Sample\\test.rpt");
...
0
votes
0
answers
95
views
Export data as excel - last column shows unknown identifier 'item'
I am using Datatable.js and ClosedXML to export grid data to excel.
This is the template snapshot, column name changed for privacy -
And when I download the excel sheet, I get error in the last ...
0
votes
0
answers
117
views
Export to excel with dynamic columns & values in .net C#
I have a dynamic grid in kendo the column names and column number changes will be different based on conditions.I am not able to export since it is a dynamic list
I have provided the code below
....
0
votes
0
answers
230
views
ClosedXML Gives 'File Corrupt' Error after written by NPOI extension, But File is Not Corrupt C#
I am using the ClosedXML package (version 0.95.4) to open an Excel file (.xlsx), which was written via NPOI extension and upload to blob storage in Azure. So, the file have access.
However, when I ...
0
votes
1
answer
344
views
When opening an xlsx file with ClosedXML in C#, I get an ArgumentOutOfRangeException
I'm using the latest version of ClosedXML from NuGet: .102.3. I can open some spreadsheets with ClosedXML, but there are many which I cannot.
New information: I went to the ClosedXML site and got the ...
0
votes
2
answers
180
views
FileContentResult return - 2 different controller methods, different result
I am using ASP.NET Core and ClosedXML to generate an Excel export.
Export Method 1
Here is the controller method that DOES return an .xlsx file to the browser. The method gets called from a .cshtml ...
0
votes
1
answer
462
views
ClosedXML (Ver 0.102.2): Setting horizontal alignment not working
I am trying to set horizontal alignment of cells when exporting data to excel. Cells with numbers should align right.
What I did:
First creating the table:
var table = CurrentWorksheet.Range(1, 1, ...
0
votes
2
answers
114
views
Why is this code with ClosedXML not working: BC32023 Expression is of type 'IXLRow', which is not a collection type
I have tried my own brain and severail AI tools but somehow this code with ClosedXML generates an error:
BC32023 Expression is of type 'IXLRow', which is not a collection type.
For Each cell As ...
0
votes
1
answer
337
views
Issue with Adding Comments to Excel Cells using ClosedXML 0.102.2
I'm trying to add comments to specific cells in an Excel file using the ClosedXML library (version 0.102.2) in my C# project. However, when I open the generated Excel file, I encounter the following ...
0
votes
1
answer
566
views
How to download an Excel file from ClosedXML in ASP.NET
I'm working on an ASP.NET webforms app, and I want to generate Excel files using ClosedXML from data that I retrieve from a database. So far, I've tried the example which should save the file to the C:...
1
vote
2
answers
469
views
Convert var to int with ClosedXml in C#
I want to convert my var in a cell to an int, I know it is an int because I know that this column in my .xlsx file is full of int, but Convert.ToInt32() makes an error;
I did:
var km = feuille.Cell(&...
0
votes
1
answer
115
views
Change Background-Color of portion of Text with Closedxml in Excel
Is there a way to change the background-color of a part of the text inside a cell? im aware of the richttext functions to change text-stylings but could no find anything for the background-color.
I ...
0
votes
2
answers
499
views
How to do AutoFill in Excel with OpenXml or ClosedXml?
In our organisation, people use an Excel spreadsheet with tabular data and a few formulas, which I need to connect to a data provider in C#. With OpenXML, or even better, ClosedXml, we can create or ...
1
vote
1
answer
161
views
Adding a predefined cell style in ClosedXml
Excel comes with a number of predefined cell styles such as Good, Note and Heading 3, as shown in the Cell Styles popup below.
Is there a way to assign these cell styles to a range of cells in ...
0
votes
1
answer
137
views
ClosedXML insertData(List<Double>, True) results in only the first row as a Number while rest of the rows as general
I am using ClosedXML to handle exporting data from an addin to an excel file.
I first get my data as List and convert it to List:
List<double> columnData_lst = curr_data_woHdrs_lst[colIndex]...
0
votes
1
answer
224
views
ClosedXML - Data Inserted Doesn't Match Data Extracted
Getting away from OLEDB, I decided to try ClosedXML. Very simple to code, but most of the the data coming from the datatable isn't being written to the sheet correctly, and as when using OleDB, I'm ...
0
votes
0
answers
132
views
C# - Excel - DisplayFormat - Get formatting details
I'm trying to get Excel cell formatting as users sees it. In VBA or the Microsoft.Office.Interop.Excel this is done via the DisplayFormat API. But I can't use interop or VBA on the prod server.. Is ...
-1
votes
1
answer
430
views
Solved: c# closedxml excel saveas on a network drive throws error The process cannot access the file '...' because it is being used by another process
we wrote a tool to open an excel-file, fill it with datas from a database and save it with another name with closedxml.excel in c#.
Sometimes it throws this error:
The process cannot access the file '...
0
votes
1
answer
117
views
ClosedXML number formatting not working in version 0.102.2
I recently updated to .NET 8.0 from .NET core 3.1 and updated ClosedXML to verison 0.102.2 but the number formatting stopped working any idea what I am doing wrong?
Formatting doesn't apply the first ...
0
votes
1
answer
398
views
ASP .NET Cannot access a disposed stream
I'm trying to generate an excel file and then pass it to http response:
[HttpPost("downloadCodesFile")]
public async Task<IActionResult> DownloadExcelFile(...
0
votes
1
answer
541
views
ClosedXML problem with templates including chart
I'm working with Excel files via the ClosedXml library and have run into an issue I can't quite resolve.
Normally there are no issues opening Excel files and adding data to them, formatting them etc. ...
0
votes
1
answer
178
views
ClosedXML export datagrid to excel only 10 rows
I have a Datagrid with 60 rows full of data and a button to import it to excel:
<DataGrid AutoGenerateColumns="False" ItemsSource="{Binding Source}"
CanUserAddRows=&...
0
votes
1
answer
2k
views
Set column format to boolean (TRUE FALSE) in ClosedXML
I am using ClosedXML to generate an Excel file which is partly filled in. One of the columns has boolean values. I would like to display these boolean values as TRUE / FALSE. I noticed that Column....
0
votes
1
answer
1k
views
Locking column in excel sheet with ClosedXml
I'm getting to grips with using ClosedXml and trying to get it to lock a whole column. I've set it up like so:
void addingDataTable()
{
using (XLWorkbook workbook = new XLWorkbook())
{
...
3
votes
1
answer
1k
views
Missing Method when importing
Imports ClosedXML.Excel
Sub import()
'Open the Excel file using ClosedXML.
Using workBook As New XLWorkbook(file_pr)
'Read the first Sheet from Excel file.
Dim workSheet As ...
0
votes
1
answer
576
views
Error in ClosedXML System.Memory returns different assembly in Vb .NET 2022
I am implementing ClosedXML to export a datatable. When compiling and testing with the source everything was fine. But when I run the .exe on other stations it returns this error:
System.IO....
1
vote
1
answer
779
views
How to create a table with custom column names?
Using ClosedXML I want to create an Excel file, that contains an Excel table. I tried with
List<string[]> rows = new();
rows.Add(new string[] { "Id", "Title" }); // this is ...
0
votes
1
answer
204
views
Right way to implement downloading Excel file
I have a .Net 6 Web API, which returns JSON data.
I am converting that JSON data and downloading it in UI(Blazor WebAssembly).
I saw this implementation and thought of the right way to implement this.
...
1
vote
1
answer
704
views
ClosedXML-generated xlsx file has formula errors when opened; using Azure Function App in C#
I have been tasked with creating automation that generates an xlsx file once a day and then sends it via email to a designated recipient. The Excel file contains formulas. Using Azure Function App in ...
0
votes
2
answers
173
views
How to export an Excel document through a server? [duplicate]
I made a simple web page with some data that can be manipulated and i used ClosedXML to convert that list to an exel document. The data manipulation works fine. The problem is with the Excel ...
0
votes
1
answer
111
views
Remove green triangle in excel with 13 numbers using winnovative vb.net
I'm using
to create an MS/Excel spreadsheet file. other columns has 13 digits, Excel displays those cells with a small green triangle in the corner, along with the warning that "The number in ...
0
votes
3
answers
767
views
Use ClosedXml to convert an XML document in OpenXML format
I have an XmlDocument in OpenXML format. Looks like this:
<?xml version="1.0" encoding="utf-8"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook>
...
0
votes
0
answers
155
views
.NET Core Razor Pages + ClosedXML + Unobtrusive AJAX = File Download Fail
I'm attempting to allow the user to download a set of data as *.xlsx when they click a button. The code completes without error, but no file is downloaded and I'm stumped.
Index.cshtml
<form class=...
1
vote
0
answers
351
views
How do i serialize a excel file stream?
I need to convert the Excel file into a stream with XLWorkbook (using ClosedXML.Excel) and then serialize with JSON format (Newtonsoft.Json) but a code error appears.
I already have a excel file saved ...