epplus

How to set Pivot table Report Layout to tabular in EPPlus?

房东的猫 提交于 2019-12-01 05:01:23
Looking at the samples that come with EPPlus I have managed to create the pivot table, but I am unable to set the correct report layout for it. I want it to be 'tabular', not 'outline' or whatever. To me it looks like EPPlus doesn't support this now, but perhaps I'm missing something? This turned out to be way easier than I thought... By setting 'everything' to 'false' it the table rendered as Tabular. So basically: pivotTable.Compact = false; pivotTable.CompactData = false; pivotTable.Indent = 0; pivotTable.RowGrandTotals = false; pivotTable.UseAutoFormatting = true; pivotTable

How to set Pivot table Report Layout to tabular in EPPlus?

感情迁移 提交于 2019-12-01 03:23:31
问题 Looking at the samples that come with EPPlus I have managed to create the pivot table, but I am unable to set the correct report layout for it. I want it to be 'tabular', not 'outline' or whatever. To me it looks like EPPlus doesn't support this now, but perhaps I'm missing something? 回答1: This turned out to be way easier than I thought... By setting 'everything' to 'false' it the table rendered as Tabular. So basically: pivotTable.Compact = false; pivotTable.CompactData = false; pivotTable

Huge memory Allocation when using EPPlus Excel Library

孤街醉人 提交于 2019-12-01 03:13:02
问题 Context I have been using EPPLUS as my tool to automate excel report generation, using C# as the client language of the library. Problem: After trying to write a really big report (response of a SQL Query), with pivot tables, charts and so forth, i end up having a Out of Memory Exception . TroubleShooting In order to troubleshoot, i decided to open an existing report that has 138MB, and use the GC object to try to take a peek on what's happening with my memory, and here are the results.

Make column or cells readonly with EPPlus

丶灬走出姿态 提交于 2019-12-01 02:27:36
Is there a way to make a column or group of cells locked or read only using EPPlus? I've tried the code below both separate and together however neither seems to have the desired effect. Either the entire worksheet is locked (if I include the IsProtected statement) or nothing at all. ws.Protection.IsProtected = true; ws.Column(10).Style.Locked = true; EDIT Here is entire block of code from my controller FileInfo newFile = new FileInfo("C:\\Users\\" + User.Identity.Name + "\\Desktop" + @"\\ZipCodes.xlsx"); ExcelPackage pck = new ExcelPackage(newFile); var ws = pck.Workbook.Worksheets.Add("Query

Slow loading of .CSV files using EPPLUS

断了今生、忘了曾经 提交于 2019-11-30 23:52:05
I have loads of .csv files I need to convert to .xslx after applying some formatting. A file containing approx 20 000 rows and 7 columns takes 12 minutes to convert. If the file contains more than 100 000 it runs for > 1 hour. This is unfortunately not acceptable for me. Code snippet: var format = new ExcelTextFormat(); format.Delimiter = ';'; format.Encoding = new UTF7Encoding(); format.Culture = new CultureInfo(System.Threading.Thread.CurrentThread.CurrentCulture.ToString()); format.Culture.DateTimeFormat.ShortDatePattern = "dd.mm.yyyy"; using (ExcelPackage package = new ExcelPackage(new

Shaman.EPPlus + ASP.NET Core MVC - Part already exist exception

夙愿已清 提交于 2019-11-30 21:44:15
I am using Shaman.EPPlus , a version of EPPlus that should be compatible with ASP.NET Core MVC. I am trying to export a collection of object as xlxs file. The code looks like this: foreach(var client in clientsToExport) { clientList.Add(new object[] { "FirstName", client.FirstName }); } MemoryStream stream = new MemoryStream(); using (ExcelPackage pck = new ExcelPackage(stream)) { ExcelWorksheet ws = pck.Workbook.Worksheets.Add("Clients"); ws.Cells["A1"].LoadFromArrays(clientList); pck.Save(); Response.Clear(); Response.Headers.Add("content-disposition", "attachment; filename=Clients.xlsx");

Modify excel cell

℡╲_俬逩灬. 提交于 2019-11-30 20:15:26
Good morning, I would like to edit some cells from already existing excell file. I tried use EPPlus and normal OpenXml classes. However I failed. In both situation program won't crash but always return old (not modified) excel. Please, what am I doing wrong? Trial 1 - EPPlus: MemoryStream memoryStream = new MemoryStream(); using (var fs = new FileStream(@"Path\Test.xlsx", FileMode.Open, FileAccess.Read)) { byte[] buffer = new byte[1024]; int bytesRead = 0; while ((bytesRead = fs.Read(buffer, 0, buffer.Length)) > 0) { memoryStream.Write(buffer, 0, bytesRead); } } using (ExcelPackage

How to group rows/columns in EPPlus

我们两清 提交于 2019-11-30 18:48:17
Is there a way to achieve this in EPPlus? Only thing I could find on the internet is grouping specific data for example: AAA ---> AAA 5 occurrences AAA BBB 2 occurences BBB BBB AAA AAA AAA but not visually like in the screenshots Looks like you want to do Row and Columns outlines that are collapsed. This should demonstrate how to do that: [TestMethod] public void Row_Col_Grouping_Test() { //http://stackoverflow.com/questions/32760210/how-to-group-rows-columns-in-epplus //Throw in some data var datatable = new DataTable("tblData"); datatable.Columns.AddRange(new[] { new DataColumn("Header",

Unreadable content in Excel file generated with EPPlus

隐身守侯 提交于 2019-11-30 17:27:23
I'm having a little problem when I generate an Excel file from a template, using the EPPlus library. The file has a first spreadsheet that contains data that is used for populating pivot tables in the following sheets. When I open the generated file, I get the following error message : "Excel found unreadable content in 'sampleFromTemplate.xlsx'. Do you want to recover the contents of this workbook ? I you trust the source of this workbook, click Yes." I obviously click yes, then get a summary of repairs done to the file, and a link to an xml formatted log file containing this : <?xml version=

Epplus number of drop down items limitation in excel file

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 14:42:33
Consider this code: var dropDown = sheet.DataValidations.AddListValidation(cells[2, colIndex, maxCol, colIndex].Address); foreach (var bb in brokerBranchs) { dropDown.Formula.Values.Add(bb.Title); } With 29 of dropDown items everything is ok and created excel file works fine but as the number of items exceeds 29, opening created file shows following error: Opening corrupted result file discards all drop down items associated with all columns. What is possible solution to this problem? Any help will be appreciated. you must add new sheet to add drop down item insert to this sheet ExcelWorksheet