Questions tagged [epplus]

EPPlus is a .NET library that reads and writes Excel files using the Office Open XML format (xlsx) without the need of interop. EPPlus has no dependencies other than .NET.

EPPlus (now migrated to GitHub) supports:

  • Cell Ranges
  • Cell Styling (Border, Color, Fill, Font, Number, Alignments, Merge)
  • Charts
  • Pictures
  • Shapes
  • Comments
  • Tables
  • Protection
  • Encryption
  • Pivot Tables
  • Pivot Charts
  • Data Validation
  • Format Condition
  • Formula calculation
  • VBA

Support for .NET Core 2.0 was added in EPPlus 4.5.

1906 questions
154
votes
10 answers

Auto column width in EPPlus

How to make columns to be auto width when texts in columns are long? I use this code Worksheet.Column(colIndex).AutoFitColumn() 'on all columns' Worksheet.cells.AutoFitColumns() Worksheet.Column(colIndex).BestFit = True 'on all columns' None…
Pengan
  • 1,813
  • 4
  • 15
  • 16
115
votes
4 answers

Merge cells using EPPlus?

I'm using the EPPlus library to read/write Excel files: http://epplus.codeplex.com/ I'm trying to simply merge some cells when writing a document: using (ExcelPackage pck = new ExcelPackage()) { //Create the worksheet ExcelWorksheet ws =…
Steven
  • 18,761
  • 70
  • 194
  • 296
93
votes
5 answers

EPPlus number format

I have an Excel sheet generated with Epplus, I am experiencing some pain points and I wish to be directed by someone who have solved a similar challenge. I need to apply number formatting to a double value and I want to present it in Excel like…
Tonto
  • 2,900
  • 3
  • 25
  • 34
91
votes
5 answers

How to set XLSX cell width with EPPlus?

Hello I have this code where i create an xlsx file and i need to pre set the width of the xlsx sheet cells. The actual problem is that when i open the excell i need to double click on the gap between the columns with the mouse in order to unwrap…
themhz
  • 8,335
  • 21
  • 84
  • 109
87
votes
4 answers

Set custom BackgroundColor of a Excel sheet cell using epplus c#

The problem: I am using EEPlus. I am stuck at applying a hex color code, e.g. #B7DEE8, for a cell in my Excel sheet. I got the following (working) code: ws.Cells["A1:B1"].Style.Fill.PatternType =…
Hakuna Matata
  • 1,349
  • 3
  • 13
  • 22
81
votes
11 answers

Excel date format using EPPlus

I'm having trouble with format my cells to Date. FileInfo info = new FileInfo(path); using (ExcelPackage package = new ExcelPackage(info)) { ExcelWorksheet ws = package.Workbook.Worksheets.Add(sheetName); ws.Cells[3,…
MrProgram
  • 5,044
  • 13
  • 58
  • 98
78
votes
5 answers

Export DataTable to Excel with EPPlus

I want to export a data table to an Excel file with EPPlus. That data table has a property with int type, so I want the same format in the Excel file. Does anyone know way to export a DataTable like this to Excel?
Davood Hanifi
  • 1,234
  • 1
  • 13
  • 19
73
votes
5 answers

How to set Column Type when using EPPlus

I'm using EPPlus to generate Excel files, in DAL I'm populating DataTable, filling data into table, and passing table to Presentation Layer. From there I'm using LoadFromDataTable() method to generate Excel file. Everything works fine, except that…
Michael
  • 2,961
  • 2
  • 28
  • 54
65
votes
6 answers

How do I iterate through rows in an excel table using epplus?

I am new to epplus, and i'm trying to read some values from an excel table. This is what I have so far: var fileInfo = new FileInfo(filename); using(var excelPackage = new OfficeOpenXml.ExcelPackage(fileInfo)) { foreach (var sheet in…
oɔɯǝɹ
  • 7,219
  • 7
  • 58
  • 69
54
votes
6 answers

How to create a link inside a cell using EPPlus

I am trying to figure out how to write a Hyperlink inside a cell using EPPlus instead of the cell containing the link text. I need it to be recognized as a link and be clickable. Any help is appreciated.
IEnumerator
  • 2,960
  • 5
  • 31
  • 33
52
votes
8 answers

Using EPPlus with a MemoryStream

I am using EPPlus to generate an XLSX file in C#. As soon as I instantiate the ExcelPackage with a memory stream - I get the error: "A disk error occurred during a write operation. (Exception from HRESULT: 0x8003001D (STG_E_WRITEFAULT))" Code…
dan
  • 5,664
  • 8
  • 45
  • 59
43
votes
8 answers

EPPlus - Read Excel Table

Using EPPlus, I want to read an excel table, then store all the contents from each column into its corresponding List. I want it to recognize the table's heading and categorize the contents based on that. For example, if my excel table is as…
Liren Yeo
  • 3,215
  • 2
  • 20
  • 41
43
votes
5 answers

Freeze panes in Excel using C# and EPPlus

I want to freeze first 5 columns and three rows in excel. I have written the following code for that Worksheets.View.FreezePanes(5, 5); but it freezes columns in first 4 rows also. I want to freeze first 4 columns in excel except in first 4…
user2148124
  • 940
  • 1
  • 7
  • 20
39
votes
2 answers

Freezing columns in EPPlus (an Excel split function)

I've been working a lot with EPPlus to generate Excel files for the number of exports that my project requires me to do. Most of the exports that they want tend to match up perfectly with exports that they have already in their legacy system. One of…
Corey Adler
  • 15,897
  • 18
  • 66
  • 80
37
votes
3 answers

EPPlus: how can I assign border around each cell after I apply LoadFromCollection?

In my export ActionResult I was able to load the model into my ExcelPackage. Where I am having trouble is assigning a border around each cell once LoadFromCollection is applied. While the AutoFitColumns correctly applies, the border style I…
user4864716
1
2 3
99 100