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
2
votes
2 answers

How to get the cutted column range in ClosedXML?

I want to apply data validation and styling to a column range, but without the header cell. Now I'm doing it in two steps: Apply rules to a column range Clear the header cell It works, but I have to edit header cells after all other cells. And it…
astef
  • 8,575
  • 4
  • 56
  • 95
2
votes
2 answers

Download an excel file in JQuery-AJAX request from ASP.NET MVC

In my ASP.NET MVC project, I generated a excel file using ClosedXML. It works well in non-ajax call. Here is my controller action method // Prepare the response Response.Clear(); Response.ContentType =…
s.k.paul
  • 7,099
  • 28
  • 93
  • 168
2
votes
1 answer

ClosedXML export column header to excel [C#]

I have a function to export datagridview to excel using CloedXML. Everything works ok, BUT: I add columns from datagridview to datatable using foreach (DataGridViewColumn column in dgvLoadAll.Columns) { …
tomiteko
  • 49
  • 1
  • 8
2
votes
1 answer

Obtaining a Worksheet by it's codename

Every Excel worksheet has a SheetName (name displayed to the user) and a Codename (internal immutable name not visible by the user), see picture below. I need to obtain a worksheet by it's codename instead of by it's SheetName. The reason is that if…
Jabberwocky
  • 48,281
  • 17
  • 65
  • 115
2
votes
2 answers

Rename header of table ClosedXML

I am creating a workbook with a worksheet and a table. Afterwards I want to change the title of the header for each column. I have already tried different ways, but when I open the xmls file, excel shows an error message(after pressing repair file…
xandi1987
  • 519
  • 1
  • 5
  • 17
2
votes
1 answer

ClosedXML Outline

I am trying to create a Group in the exported Excel Workbook using OpenXML. My source data table looks like this: Row State Product Sales 1 NY A 100 2 NY A 200 3 NY B 300 4 CA A …
MillinMo
  • 395
  • 1
  • 7
  • 21
2
votes
2 answers

Azure, ClosedXML: Build will NOT include DocumentFormat.OpenXML in the bin folder of my application

I set the dll to copy local on build as seen here: It shows up in my drop folder on Azure: but it never makes it into the bin folder of my actual application as seen here: as a result: Anyone have experience with this specific dll not getting…
Daniel Kempner
  • 415
  • 5
  • 14
2
votes
1 answer

Is OpenXML SDK required to be installed in every computer that will run my program?

Is there a way to deploy my application (which uses ClosedXML) and not be required to install OpenXMLSDKv2.msi on each computer? If I uninstall the sdk I get this error at runtime: I already referenced DocumentFormat.OpenXml (copy local = true)…
Vallo
  • 1,827
  • 2
  • 21
  • 42
2
votes
1 answer

How to remove decimal separator if the decimal part is zero?

I'm using ClosedXML to create a excel spreadsheet. The issue takes place while formatting cells, containg percentages. The format I came up to is 0.##%. It works well when the decimal part is not zero, it shows: 1,15%; but when it's…
horgh
  • 17,918
  • 22
  • 68
  • 123
2
votes
1 answer

Example of how to create a Pivot Table in ClosedXML

We are using ClosedXML to generate .XLSX spreadsheets because it is small, nimble, and quick. It appears that all the pivot table classes and methods are there in the API, but there is no documentation or examples on how to go about (in the correct…
Jay Imerman
  • 4,475
  • 6
  • 40
  • 55
2
votes
1 answer

Custom FileResult on Azure: Browser Waits forever

I have an action that returns an Excel as a custom FileResult. My solution is based on the ClosedXml library (internaly using OpenXml). My XlsxResult class uses a read-only .xlsx file on the server as a template. It then passes on the template into…
cleftheris
  • 4,626
  • 38
  • 55
2
votes
3 answers

"Cannot convert theme color to Color" in ClosedXml

I am trying to read the fill background colour of cells in Excel using ClosedXml. I am working from this sample code and have been able to read the content of a Excel document without issues, but am not able to read the Fill BackgroundColor for the…
BruceHill
  • 6,954
  • 8
  • 62
  • 114
2
votes
2 answers

C#: Reading values from Excel formulas

I've been using Closed XML to generate my Excel reports automatically. So far so good, but however I need to save certain formula-generated values back into the database. The formula would be something like this: =SUM(Day1, Day2, Day3), so simply an…
matt
  • 2,857
  • 7
  • 33
  • 58
1
vote
2 answers

Can you populate a range in ClosedXML (C#)

I wanted to see if you can populate a range all at once from an array when using closedXML instead of populating a single cell at a time. Also, if it is possible to set a range from an array, would that be faster than looping through cell by cell…
leora
  • 188,729
  • 360
  • 878
  • 1,366
1
vote
1 answer

ClosedXML: assign data type to a cell

I am trying to set a data type for a cell in CLosedXML, however the answers I have found about my problem all rely on Cell.SetDataType(x) or Cell.DataType = x and both of them seem to be impossible for me for some reason. Some pages with answers I…
Kotyo
  • 15
  • 4