epplus

Add List Validation to Column except the first two rows

狂风中的少年 提交于 2019-12-06 12:38:03
I am trying to add a dropdown (list validation) upon creating the excel, I already found the way to add it to whole column but my scenario is different because I only add the validation to whole column except the first row and second row. This is what I have tried so far: public MemoryStream GetExcelSheet() { using (var package = new ExcelPackage()) { ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("Test"); var val = worksheet.DataValidations.AddListValidation("A:A"); val.Formula.Values.Add("Male"); val.Formula.Values.Add("Female"); val.ShowErrorMessage = true; worksheet.Cells["A1"]

EPPlus chart from list of single excel cells. How?

会有一股神秘感。 提交于 2019-12-06 11:55:41
I want to make an excel chart, using EPPlus, from a list of single cells. Say I want a pie with three pieces getting their values from cells C4, C6 and C8. How? These two attempts is among those that does not work: ExcelChart chart = ExcelWorksheet.Drawings.AddChart(myTitle, eChartType.Pie); ExcelAddress values = myWorkSheet.Cells["C4;C6;C8"]; // => 'Invalid Address format' ExcelAddress values = myWorkSheet.Cells["C4,C6,C8"]; // => No chart is made So, is it possible? If so, what's the syntax? The line with cell names separated by commas is the format you want. Did you specify both the x and y

Load large amount of excel data with EPPlus

自古美人都是妖i 提交于 2019-12-06 11:26:59
I have a basic winforms app that a user can upload an excel file (.xlsx) and I want to read the contents of this file so I am using EPPlus. The problem is, I am trying to load the contents of a very large excel file, it has 7 tabs, with one tab haveing more then 200k rows, and another tab with 70k. The other 5 total to about 50k. These file will also only continue to get bigger.(The end goal) Since I want to import the data, read the data, and depending on the rules/data I have, I need to write data back on the excel file and export it. I am having issues though with EPPlus in achieving the

How to get a value from Excel spreadsheet cell using EPPLUS?

我的未来我决定 提交于 2019-12-06 06:25:29
I'm using EPPlus library to create excel from datatable. This is what I do: using (ExcelPackage pck = new ExcelPackage()) { ExcelWorksheet ws = pck.Workbook.Worksheets.Add("Demo"); ws.Cells["A5:I5"].LoadFromDataTable(dt, true); ws.DefaultColWidth = 25; var headerCell = ws.Cells["A5:I5"]; headerCell.Style.Fill.PatternType = ExcelFillStyle.Solid; headerCell.Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.BurlyWood); var headerFont = headerCell.Style.Font; headerFont.Bold = true; int totalRow = ws.Dimension.End.Row; int totalCol = ws.Dimension.End.Column; using (ExcelRange rng = ws.Cells

How to use Epplus with cells containing few rows

社会主义新天地 提交于 2019-12-06 06:13:16
I want to import some excel file using epplus the problem is that some cells contains more than one row (and that cause a problem My excel look like this (in realite their is more tests (test2,test3....) I can only get the first column by this algorithm..but it will be more complicated to get the seconde column //this is the list than contain applications (column 2) ICollection<Application> applications = new List<Application>(); int i = 0; for (int j = workSheet.Dimension.Start.Row; j <= workSheet.Dimension.End.Row; j=i+1) { //this is the object that contain the first column //and also a list

C# Change Excel Chart Axis Format using EPPLUS

邮差的信 提交于 2019-12-06 05:39:48
问题 Is there anyway to change the chart X or Y axis to set a custom label formatting? For example, in the XAxis my labels are datetime but the formatting is yyyy-mm-dd hh:mm:ss. I would like to change it to just yyyy-mm-dd. Was wondering if it is possible in EPPLUS without using interop 回答1: This is a bit of a pain with charts and EPPlus. They have exposed the chart.XAxis.Format property to set the format but does not account for the attribute souceLinked which, when not set to 0 (default) tells

Error reading xlsx (2007) file in EPPLUS

早过忘川 提交于 2019-12-06 04:17:51
I have an error while trying to read excel files ( xlsx ) which were saved in Excel 2007 using EPPlus library. Some workaround: ASP.net mvc 5 app with EPPlus v. 4.0.4.0 User can download template file from my site, then fill required data in it, and upload it back. File contains 4 worksheets, one of them is hidden . Workbook is password protected, worksheets are proteced too. All of them have different passwords. Template file ( xlsx ) produced in Excel 2007 or 2010 . When user posts file back I'm trying to open and read it using EPPlus When I post file which was filled in Excel2010 everythins

Set cells merged and set its value, but it not work?

旧街凉风 提交于 2019-12-06 03:25:26
问题 //use EPPlus.dll using OfficeOpenXml string path = @"C:\Users\Superman\Desktop\recc\1996.xlsx"; ExcelPackage package = new ExcelPackage(new FileInfo(path)); var sheet3 = package.Workbook.Worksheets[3]; sheet3.Cells["A1:B5"].Merge = true; var mergedId = sheet3.MergedCells[1, 1]; sheet3.Cells[mergedId].First().Value = "123"; // error: System.InvalidOperationException : Sequence does not contain any elements package.Save(); What's wrong? How to do it? 回答1: To answer why the exception from using

Handle merged cells in Epplus Excel conversion to HTML

狂风中的少年 提交于 2019-12-06 00:21:11
问题 I'm using Epplus to render an Excel spreadsheet into HTML. So far it's going very, very well, except for one thing... spanning merged cells. I just can't seem to get the logic right. I thought I would throw it out there to see how the community would deal with it. Here is my code so far. public String ParseExcelStamps(String FileName) { FileInfo theFile = new FileInfo(FileName); String html = ""; using (ExcelPackage xlPackage = new ExcelPackage(theFile)) { var workbook = xlPackage.Workbook;

Epplus SetPosition picture issue

蓝咒 提交于 2019-12-05 22:29:25
问题 I am using Epplus library to generate Excel 2010 and up compatible files in Asp.Net C#. I am using version 3.1.2 which is the latest at this moment. I am setting the row height first, before adding any pictures like this: ExcelPackage pck = new ExcelPackage(); var ws = pck.Workbook.Worksheets.Add("sheet 1"); while (i < dt.Rows.Count + offset) { ws.Row(i).Height = 84; i++; } dt is my DataTable with DataRows. After setting the height, I am looping again through the rows to add the pictures