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

ClosedXML. Memory leak while Workbook.Save()

I need to add new worksheet from dataTable. For this task I use ClosedXML: workbook.Worksheets.Add(dataTable); workbook.Save(); workbook = new XLWorkbook(filePath); //reload file to avoid exception at next saving My process used 128 Mb of memory…
InfernumDeus
  • 1,185
  • 1
  • 11
  • 33
2
votes
1 answer

ClosedXML Adding Formula creates unreadable content

I am adding a formula to worksheet using C# closedxml but it is coming back as unreadable content. I think the reason is the slashed that I added to the formula but I need the slashes to escape the quotes because I need the quotes in the formula. …
Daniel Blois
  • 187
  • 1
  • 1
  • 7
2
votes
1 answer

ClosedXML parsing comma in number

I just downloaded ClosedXML for use in a small app I'm writing. In the app, I load in some data from a database to output to an Excel file. My local number format uses comma for a decimal indicator. It looks like ClosedXML doesn't recognize these…
schneiju
  • 115
  • 1
  • 1
  • 9
2
votes
1 answer

How to get the Row count for only Specified Range of columns in WorkSheet using ClosedXMl

I have a worksheet and one column of work sheet has more number of rows and remaining columns has different number of rows. I had a requirement like need to get the rowcount of those columns only not the irrelevant column. I had used the below code…
jose
  • 1,044
  • 1
  • 12
  • 35
2
votes
2 answers

Excel Sheet Reading - ClosedXML - Date shown as Number

I have an excel sheet which i am trying to parse. All works correctly except when i have a date e.g. 01-Nov-2016. When trying to read this value via _value = cell.Value.ToString(); it is returning just a number. After the sheet has been parsed…
Qpirate
  • 2,078
  • 1
  • 29
  • 41
2
votes
3 answers

How to merge cell using closedxml with a dynamic column count?

This is how to merge cell using ClosedXML based on the documentation. worksheet.Range("B2:D3").Row(1).Merge(); My problem is my column count is dynamic, I can't set column letter value to merge because i will based the merging of cell on my…
odlan yer
  • 721
  • 1
  • 7
  • 15
2
votes
1 answer

ClosedXML Add WorkSheet with Conditional Formatting

I am using ClosedXML to add new worksheet to existing Excel document. It works fine for normal Excel document. But if a excel document sheet contains conditional formatting on some cell then it throws error at…
2
votes
0 answers

Refresh pivot table without opening in Excel

I need to add a digital signature to some of our reports. However, these reports use pivot tables which only load once the document has been opened. If the document is signed before this, the pivot tables will not load. I would like to avoid…
Jonathan
  • 1,923
  • 2
  • 16
  • 34
2
votes
1 answer

Print Excel Worksheet/Workbook

I'm trying to improve performance of a C# Winform project. Previously, generate an Excel file was during 100000ms (using Office.Interop.Excel). Using ClosedXml it is about 5000ms. Really Great. But now I need to print this Excel document (only a…
ZwoRmi
  • 1,093
  • 11
  • 30
2
votes
2 answers

ClosedXML Change existing Footer / Header

How can I change an existing header / footer (PageSetup, OddPages) with ClosedXML? With AllPages the missing header / footer (FirstPage, EvenPages) was created, but not changed for OddPages. Does anyone have an idea what I'm doing…
Duffy
  • 21
  • 1
  • 3
2
votes
2 answers

closedxml add image vb

i am doing a webform in ASP.NET and currently working with ClosedXML,is there a way to insert an image inside a worksheet in a position?, i have this code Dim wb As New XLWorkbook() Dim ws As IXLWorksheet = wb.Worksheets.Add("NAME") Dim httpResponse…
2
votes
1 answer

Difference between center and centercontinuous alignment in ClosedXML?

I am working on ClosedXML for Export an Excel, and just find a property for alignment Center and CenterContinuous. worksheet.Column(9).Style.Alignment.Horizontal = XLAlignmentHorizontalValues.Center; And…
Smit Patel
  • 2,992
  • 1
  • 26
  • 44
2
votes
0 answers

Encoding and Decoding excel file as Base64 string

This is for a Windows Console App I am saving an Excel file that I am using as a template for reports as a Base64 string. using the code below to encode the file as a base64 string. I then store it in an SQL Database as NVARCHAR(MAX) Stream myStream…
scripter78
  • 1,117
  • 3
  • 22
  • 50
2
votes
0 answers

How to export datagridview and treeview data to excel in c#?

I have one datagridview and one treeview in my form. I have a problem like where I need to show the details of items carried in each container and exporting it to excel Here is an example, Several items are carried in container and moved to another…
CST RAIZE
  • 428
  • 1
  • 5
  • 18
2
votes
1 answer

ClosedXML generating malformatted xlsx

Can't seem to output a good file with ClosedXML, when I open the file I'm getting We found a problem with some content in 'filename.xlsx' Do you want us to recover as much as we can? If you trust the source of this workbook, click Yes. using (var…
jacobsgriffith
  • 1,448
  • 13
  • 18