epplus

Hiding subtotals in pivot table in epplus

点点圈 提交于 2020-01-23 01:13:05
问题 I'm using EPPLUS to generate my pivot table (see this SO post). I have the following code //group by fields foreach (string row in _GroupByColumns) { ExcelPivotTableField field = pivotTable.Fields[row]; //field formating field.Sort = eSortType.Ascending; field.Outline = false; field.Compact = false; field.ShowAll = false; field.SubtotalTop = false; //doesn't work, subtotals still there when excel is opened //doesn't work, will result in "unreadable content" error when Excel is opened //field

Auto column width in EPPlus

 ̄綄美尐妖づ 提交于 2020-01-22 04:11:06
问题 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 of these methods are working Are there any ways to make it work? Note: Some of my texts use Unicode. 回答1: Use AutoFitColumns , but you have to specify the cells, i assume the entire worksheet: VB.NET Worksheet.Cells(Worksheet.Dimension.Address)

How to find datetime values in an Epplus ExcelWorksheet

淺唱寂寞╮ 提交于 2020-01-21 07:30:31
问题 I have a working ExcelPackage function in an MVC 5 application where I can successfully output a strongly-typed model to a new Excel file. I have a case where a specific column is nullable DateTime with four possible values: null date only time only date and time I have extracted a function that does the job of identifying any DateTime values in the Worksheet. Although the DateTime values are consistently identified and formatted correctly, I can't help but think there might be a better way

Very slow operation of Epplus Save(), SaveAs(), etc. methods when debugging

落花浮王杯 提交于 2020-01-15 08:13:11
问题 Environment - Windows 10, Visual Studio 2017, netcore2.0, Debug build. When saving an Excel file using Epplus 4.1.1 while debugging, the save operation takes a much longer amount of time than I would expect. Here's some timing when ran with Debug -> Start Debugging Saving 100 rows in 2065ms. Saving 200 rows in 2050ms. Saving 400 rows in 4003ms. Saving 800 rows in 11360ms. Saving 1600 rows in 18377ms. Saving 3200 rows in 34139ms. And the same when ran with Debug -> Start Without Debugging

How to write to excel many times using one object of EPPLUS in C#

笑着哭i 提交于 2020-01-14 19:09:30
问题 Refer to some EPPLUS sample code, there are just creating one epplus object for one activity. ex using (ExcelPackage package = new ExcelPackage(newFile)) {... // activity } it means that after activity is finished, object is disposed automatically. and for the next, object will be created again for doing activity again. And i want to create just one EPPLUS object for many times of activity, i want to create one EPPLUS object can be used many times, not using "using" statement. this is my code

Error when trying to read an .xls file using EPPlus

六月ゝ 毕业季﹏ 提交于 2020-01-11 08:16:48
问题 The following code is working fine for .xlsx, but it's not working for .xls. I got this error message Can not open the package. Package is an OLE compound document. If this is an encrypted package, please supply the password Code string filepath = txtBrowse.Text; FileStream stream = System.IO.File.Open(filepath, FileMode.Open, FileAccess.ReadWrite); //1. Reading from a binary Excel file ('97-2003 format; *.xls) IExcelDataReader excelReader = ExcelReaderFactory.CreateBinaryReader(stream);

How to add values to a spreadsheet from a dictionary?

帅比萌擦擦* 提交于 2020-01-11 05:43:52
问题 I have a template spreadsheet document that has two columns, Server Name and IP Address. How can I populate the spreadsheet so that each dictionary key goes in its own cell in the Server column and the corresponding value goes in the cell next to it in the IP column? I am using the EPPlus library but couldn't find anything on the topic. Below is what I found and tried, but its for lists using (ExcelPackage package = new ExcelPackage(_fileInfo)) { ExcelWorksheet worksheet = package.Workbook

Replacing Invalid XML characters from an excel file and writing it back to disk causes file is corrupted error on opening in MS Excel

梦想与她 提交于 2020-01-10 06:12:06
问题 A little background on problem: We have an ASP.NET MVC5 Application where we use FlexMonster to show the data in grid. The data source is a stored procedure that brings all the data into the UI grid, and once user clicks on export button, it exports the report to Excel. However, in some cases export to excel is failing. Some of the data has some invalid characters, and it is not possible/feasible to fix the source as suggested here My approach so far: EPPlus library fails on initializing the

Export datatable to excel using EPPlus with additional data

人走茶凉 提交于 2020-01-06 20:26:20
问题 I have a requirement where i have to generate the excel as below image i am using EPPlus dll and i am able to export only datatable to excel directly with below c# code. using (var package = new ExcelPackage(Template)) { ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("Product_Reports"); worksheet.Cells["A1"].LoadFromDataTable(dt, true, TableStyles.Medium1); worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns(); ... remainig code How to i add the heading "Product Statistics

Export datatable to excel using EPPlus with additional data

做~自己de王妃 提交于 2020-01-06 20:26:16
问题 I have a requirement where i have to generate the excel as below image i am using EPPlus dll and i am able to export only datatable to excel directly with below c# code. using (var package = new ExcelPackage(Template)) { ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("Product_Reports"); worksheet.Cells["A1"].LoadFromDataTable(dt, true, TableStyles.Medium1); worksheet.Cells[worksheet.Dimension.Address].AutoFitColumns(); ... remainig code How to i add the heading "Product Statistics