epplus

Export Gridview to Excel with EPPLus

↘锁芯ラ 提交于 2019-12-11 14:18:49
问题 I am trying to export data from datatable to Excel file using EPPlus, but nothing seems to work. This is the code- using (ExcelPackage xp = new ExcelPackage()) { ExcelWorksheet ws = xp.Workbook.Worksheets.Add(dt.TableName); int rowstart = 2; int colstart = 2; int rowend = rowstart; int colend = colstart + dt.Columns.Count; ws.Cells[rowstart, colstart, rowend, colend].Merge = true; ws.Cells[rowstart, colstart, rowend, colend].Value = dt.TableName; ws.Cells[rowstart, colstart, rowend, colend]

How to use EPPlus read an Excel 2010 file that has workbook protection?

不打扰是莪最后的温柔 提交于 2019-12-11 14:15:54
问题 When I use the code below to read an Excel 2010 file that has password protection enabled for the workbook: using (FileStream file = new FileStream(fileName, FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite)) { ExcelPackage ep = new ExcelPackage(); try { ep = new ExcelPackage(file); } catch (Exception ex) { string strErr = ex.message; } } ...I get an exception. Any example code to read a Excel 2010 file that has password protection, using EPPlus? 回答1: Faced with the same problem. In

Is there a way to set gridline options for Excel graphs using C# / EPPlus

折月煮酒 提交于 2019-12-11 12:56:19
问题 I am trying to create an excel Graph using EPPlus and C#. I can successfully create the following Graph: However, I would like the program to create both major and minor gridlines in both directions at runtime; so that the graph looks like this: I know I can adjust these settings in Excel, but I would like to be able to set the default gridlines with my code. I cannot find a setting in EPPlus that will handle this (If there is one, please make me aware of it). I am trying to figure out how to

EPPlus: How do I have 2 ExcelPackage.SaveAs?

为君一笑 提交于 2019-12-11 11:56:09
问题 I am using EPPlus for my export to Excel function. I need to have 2 SaveAs, 1st SaveAs which is a save dialogue to allow user Open/Save/SaveAs and my 2nd SaveAs to allow the Excel file to be saved directly into the specified folder in the server as a backup copy. Thus my issue here is that my 2nd SaveAs does not work (no error popup during debug, no files generated either for 2nd SaveAs). Please advice. Thanks! ExcelPackage package = new ExcelPackage(); ..... code for loading data table .....

Create a dropdownlist of checkboxes using EPPlus

泪湿孤枕 提交于 2019-12-11 08:56:43
问题 I am using EPPlus (http://epplus.codeplex.com/) to create Excel files in my ASP.NET application. I was wondering if anyone knows if it's possible to create a dropdownlist with checkboxes in one cell. I've checked the documentation, but found nothing so far. I've also tried Googling it but haven't found anything in the right direction yet. This question on their forum is actually a pretty good demonstration of what I'm looking for, but it hasn't received any answers: http://epplus.codeplex.com

Writing Excel using EPPLUS not workable after deployed

筅森魡賤 提交于 2019-12-11 07:03:54
问题 I'm using EPPlus to generate excel (.xlsx) in my mvc3 web application. It works fine with my localhost. However, after i deployed to the server, the excel file return as an Excel Binary Workbook. Can anyone help me? Here is how i generate my excel (.xlsx): ExcelPackage pck = new ExcelPackage(); ExcelWorksheet ew = pck.Workbook.Worksheets.Add("template" + templateVM.Year); List<YieldsTemplate> list = mgr.GetTemplates(templateVM.Year); ew.Cells["A1"].LoadFromCollection(list, true); ew.Cells["A

Epplus row height issue

旧城冷巷雨未停 提交于 2019-12-11 06:44:04
问题 I have an excel file with over 1000 rows. Each row contains some data and 2 images. The images are attached as OfficeOpenXml.Drawing.eEditAs.OneCell After populating the Excel I run this, to set the row height. int prodTableStart = 3; int prodTableEnd = 1025; while (prodTableStart <= prodTableEnd) { ws.Row(prodTableStart).Height = 112d; // works, but mega slow prodTableStart++; } I tried to speed up with something like this: ws.Cells["A" + prodTableStart + ":L" + prodTableEnd].Rows but that

WebApi using EF EPPlus returning gibberish in exce

爱⌒轻易说出口 提交于 2019-12-11 06:14:04
问题 I am trying to use EPPlus in my EF WebApi to return data in a excel workbook. The call to webserver gets made successfully, but when my browser opens the excel doc... all the content is gibberish. This is my webapi private xxxV003Context db = new xxxV003Context(); [HttpGet] public HttpResponseMessage Get() { HttpResponseMessage response; response = Request.CreateResponse(HttpStatusCode.OK); MediaTypeHeaderValue mediaType = new MediaTypeHeaderValue("application/octet-stream"); /

Is it possible to sign a Excel VBA project including timestamp?

亡梦爱人 提交于 2019-12-11 05:09:54
问题 I sign VBA code in Excel files automatically with digital signature, which works well using X509Certificate2 and EPPlus. Now I want to include a timestamp, any idea where i could set this? If I sign the code manually in VBA Editor - Tools - Digital Signature, the code is well signed with timestamp (and countersignature). So it remains valid when the cert of the signing person has expired. But when signing with EPPlus is doesn't. In ExcelVBASignature.cs it looks as this function would be

Setting Excel worksheet protection with EPPlus

a 夏天 提交于 2019-12-11 05:06:42
问题 I'm trying to set worksheet permissions for an XLSM file using EPPlus but it seems I can only set the default protection level, individual protections are not being set. For the record, I'm trying to accomplish programmatically method 1 in this article. Here's the code I'm using: using (var p = new ExcelPackage("output.xlsm")) { var ws = p.Workbook.Worksheets["MySheet"]; // Set some cell values here // Filtering, sorting, protection ws.Cells[7, 1, 10, 5].AutoFilter = true; ws.View.FreezePanes