excelpackage

NullReferenceException in creating Excel worksheet

╄→尐↘猪︶ㄣ 提交于 2020-01-02 02:40:06
问题 i want to fill an excel file and so i use ExcelPackage: Office Open XML Format . but i have an error. my code: string fileName = "DBE_BAKIM_FORMU" + ".xlsx"; FileInfo fi = new FileInfo(HttpContext.Current.Server.MapPath("~/") + fileName); using (ExcelPackage xlPackage = new ExcelPackage(fi)) { ExcelWorksheet worksheet = xlPackage.Workbook.Worksheets[1]; dbeDataContext db = new dbeDataContext(); CAGRI c = (from x in db.CAGRIs where x.CagriID == ID select x).SingleOrDefault(); USER u = (from x

How to add dropdown in excel sheet programmatically?

ぐ巨炮叔叔 提交于 2019-12-25 01:46:19
问题 I am using the ExcelPackage dll to creating the excel from the .net application. I want to add drop down list in one of column of Excel sheet. How to add it? Also I want to do some formatting changes to the cell values. 回答1: Try spreadsheetgear .... 回答2: protected void AddDropDownToExcel(string path) { //path gives the location where u have created excel file string fileName = path.Replace("\\", "\\\\"); // F is the column name where you want to place the dropdown string RowCount = "F" +

How to set color or background with “excelpackage”

核能气质少年 提交于 2019-12-21 07:01:37
问题 I use this package: ExcelPackage though I can't figure out how to set the background color for the cell. I tried to use this: ws.Cells["A1"].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; But it shows that the properties are not found. Sounds like I should use something similar to this: worksheet.Cell(5, columnIndex + 1).Style = "background-color: red"; But I am not sure how it works and I couldn't find the tutorial for it. Please help. 回答1: Try something along these lines

C# ExcelPackage (EPPlus) DeleteRow does not change sheet dimension?

与世无争的帅哥 提交于 2019-12-10 14:55:17
问题 I am trying to build a data import tool that accepts an EXCEL file from the user and parses the data from the file to import data into my application. I am running across a strange issue with DeleteRow that I cannot seem to find any information online, although it seems like someone would have come across this issue before. If this is a duplicate question, I apologize, however I could not find anything related to my issue after searching the web, except for this one which still isn't solving

NullReferenceException in creating Excel worksheet

假装没事ソ 提交于 2019-12-05 05:44:53
i want to fill an excel file and so i use ExcelPackage: Office Open XML Format . but i have an error. my code: string fileName = "DBE_BAKIM_FORMU" + ".xlsx"; FileInfo fi = new FileInfo(HttpContext.Current.Server.MapPath("~/") + fileName); using (ExcelPackage xlPackage = new ExcelPackage(fi)) { ExcelWorksheet worksheet = xlPackage.Workbook.Worksheets[1]; dbeDataContext db = new dbeDataContext(); CAGRI c = (from x in db.CAGRIs where x.CagriID == ID select x).SingleOrDefault(); USER u = (from x in db.USERs where x.UserID == Convert.ToInt32(Session["user"]) select x).SingleOrDefault(); worksheet

C# create/modify/read .xlsx files

不羁岁月 提交于 2019-11-26 17:52:08
I am looking for a way to create, modify, read .xlsx files in C# without installing Excel or creating files on the server before giving to the user to download. I found NPOI http://npoi.codeplex.com/ which looks great but supports .xls not .xlsx I found ExcelPackage http://excelpackage.codeplex.com/ which looks great but has the additional overhead of creating the file on the server before it can be sent to the user. Does anyone know of a way around this? I found EPPlus http://epplus.codeplex.com but I am not not certain if this requires creation of a file on the server before it can be sent

C# create/modify/read .xlsx files

十年热恋 提交于 2019-11-26 05:38:53
问题 I am looking for a way to create, modify, read .xlsx files in C# without installing Excel or creating files on the server before giving to the user to download. I found NPOI http://npoi.codeplex.com/ which looks great but supports .xls not .xlsx I found ExcelPackage http://excelpackage.codeplex.com/ which looks great but has the additional overhead of creating the file on the server before it can be sent to the user. Does anyone know of a way around this? I found EPPlus http://epplus.codeplex