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
1 answer

Combination of vertical and horizontal table in closedxml.report

I am working on a project and I’m using ClosedXML to document some results in an Excel sheet. I have the following data structure: The PortTag Dictionary is just a Key Value Pair of Port Id and Tag (either “T”, “U”, “F” or “-“) This should result…
1
vote
1 answer

Set row color with closedXML based on column value

I am trying to write Excel file from datatable with VB.NET. I am able to achieve few excel operations also. Now I want to colour a row based on cell value of a particular column (Col-4 for example). Here is my Excel file - Here is my Excel file I…
1
vote
1 answer

How to Convert Table into a Normal Range of cells while exporting excel in c#

How to Convert Table into a Normal Range of cells while exporting excel in c#. By default it is in Table format, not able to sort due to tabel format. I need this to normal range of cells. After excel exported, you able to do in manually by…
Akash
  • 11
  • 4
1
vote
2 answers

Calling WEB API to download excel file

below is C# WEB API Code to generate Excel : public class FileExportController : ApiController { [HttpGet] public HttpResponseMessage Get() { var callerContext = CallerContext.DefaultCallerContext; ReportingInput…
suresh
  • 33
  • 1
  • 2
  • 10
1
vote
1 answer

ClosedXML Copy and Paste Range of formulas as values

I have a function ApplyFormulas() that will obviously apply formulas like so detailWs.Range(companyModel.RevenueFormulaRangeDollars).FormulaR1C1 = companyModel.RevenueFormulaDollars; However Now I need to copy that range and paste it in the same…
boo
  • 129
  • 1
  • 4
  • 12
1
vote
1 answer

ClosedXML - Could not load file or assembly exception

I am trying to use ClosedXML to produce excel documents within an application, however, Whenevet I try to run it I receive a could not load file or assembly server error. This is my form application This is my Package and this is my error when I…
ahmedshpt
  • 23
  • 1
  • 6
1
vote
1 answer

Find the last cell that contains data in column

I have an excel file that contains the names of the columns in the first row. How can I find the number of the last non-empty column in the first row? I use the library ClosedXML.Excel;
RobinВricks
  • 93
  • 1
  • 1
  • 10
1
vote
1 answer

ClosedXML save workbook to prompt for readonly open

Using ClosedXML (v0.93.1) on .Net Core 2.0, attempting to save a workbook so that when opened it prompts the user to open as "Read Only" or enter the protected password. (See linked question below). I have seen IXLWorksheet.Protect() and…
Neil
  • 1,613
  • 1
  • 16
  • 18
1
vote
2 answers

ClosedXML get image / picture from specific cell

I'm programming in C#.NET (VS 2017) using ClosedXML. And I have one Excel file like this: | A | B | C | D 1| Code | Image | Price | Others 2| PX1 | [IMAGE] | $0.25 | Text 3| XYZ | [IMAGE] | $0.58 | Descp I can get all text…
Iván Saravia
  • 25
  • 1
  • 6
1
vote
1 answer

closed xml protect worksheet don't allow edit objects

I don't want the user allowed to edit objects. The checkmark for "edit objects" should be unchecked. Here is my code: using (var workbook = new XLWorkbook(download)) { foreach (var worksheet in…
MIKE
  • 1,039
  • 7
  • 24
1
vote
2 answers

Export to excel returns Blank sheet

I am trying to export a datatable using closed xml but it gives me blank sheet. Here is my code [HttpPost] public FileResult ExportExcel() { List productDetails = (List)Session["CartItems"]; …
LearningPal
  • 554
  • 2
  • 12
  • 27
1
vote
1 answer

Encrypt excel file using ClosedXML

We are using ClosedXML library to generate our excel reports. A new requirement form client is to password protect reports marked as confidential. There is a method XLWorkbook.Protect() with some overloads, however, none of it is encrypting a file,…
Diomos
  • 420
  • 5
  • 15
1
vote
1 answer

ClosedXML Export to xlsx error: 'Unable to set cell value to ' + uniqueidentifier

I'm looking to create a simple windows service to export data from SQL tables, through a .NET datatable, directly to an Excel xlsx file. Whilst testing ClosedXML, I found that when the 1st column is a uniqueidentifier the ClosedXML.dll errors "An…
Wowdude
  • 139
  • 1
  • 5
  • 16
1
vote
1 answer

No reference to business logic from api controller?

The following code is a function that I wrote in my API controller to call my business logic: [HttpGet] [Route("api/file/{id}")] public async Task GetSysMaintExcelFile(int id) { var wb = await…
gwatson117
  • 32
  • 6
1
vote
1 answer

ClosedXml : Set column's name in a table with spaces

I'm trying to create a table in excel with closedxml and i want it to be having names it's columns with spaces as in thhis picture Table with spaces in its column's names. in the default case the names should not have spaces, i tried rewrite these…
Soufien Hajji
  • 477
  • 1
  • 8
  • 24