epplus

Microsoft.Office.Interop.Excel or EPPlus for read a huge (or not) Excel file

送分小仙女□ 提交于 2019-12-18 09:14:49
问题 I wrote a code to read a column from a Excel file. I use Microsoft.Office.Interop.Excel on this, first read the entire Range and then write in System.Array after that I do some operations with the System.Array values and finally I convert it to List because I fill a ListBox element. This is the code (only relevant parts): private List<string> bd = new List<string>(); private static System.Array objRowAValues; private List<string> bl = new List<string>(); private static System.Array

EPPlus ColumnStacked chart data point colors

旧巷老猫 提交于 2019-12-18 09:04:30
问题 I am able to generate Column Stacked chart using EPPlus. There is is requirement to change the color of datapoint. I found the solution of at enter link description here but it only changes the color of first datapoint of the series. Can I get help to change the color of other datapoints as well. Here is the concept that I am looking for enter image description here Here is the function that helps to change datapoint first color public void SetDataPointStyle(OfficeOpenXml.Drawing.Chart

Importing excel file with all the conditional formatting rules to epplus

 ̄綄美尐妖づ 提交于 2019-12-18 09:03:56
问题 I have an excel file which contains lots of data along with icon sets and data bars based on the values in the cell. It looks like this: I want to import this excel sheet along with the conditional formatting. Is there any library for this?? I went through this http://www.sitecorecleveland.com/resources/blogs-posts/easy_excel_interaction_pt6 but it only imports data not format. If that's not possible is there code in epplus to have these iconsets in excel sheet. I can have arrows, traffic

Format condition by expression EPPlus

依然范特西╮ 提交于 2019-12-18 07:46:31
问题 I am creating excel using EPPlus with conditional formatting. I am using C# code to do conditional formatting but its not working. Please check my below code and let me know where I am wrong: ExcelPackage pck = new ExcelPackage(); var ws = pck.Workbook.Worksheets.Add("Sample1"); var _formatRangeAddress = new ExcelAddress("H16:K31,H33:K44,H46:K57,H59:K69,H71:K73"); string _statement = "=AND(COUNTA(H16:H16)<2,COUNTA(H16:K16)>0)"; var _cond4 = ws.ConditionalFormatting.AddExpression(

Convert XLSM to XLSX

ε祈祈猫儿з 提交于 2019-12-18 06:57:30
问题 I'm using the EPPLUS library to read data from Excel to create another file. Unfortunately it does not support the .XLSM extension file. Is there a nice way to convert .XLSM files to .XLSX file for the purpose of reading the file with EPPLUS? (using EPPLUS for reading would be nice because all my code is already written using it :) ) 回答1: In order to do this you will need to use the Open XML SDK 2.0. Below is a snippet of code that worked for me when I tried it: byte[] byteArray = File

Unit testing classes that use EPPlus

我与影子孤独终老i 提交于 2019-12-18 06:48:29
问题 I am having issues unit testing classes that use EPPlus. In my mind, I have two options. I can mock & inject the HttpPostedFileBase into a method, or I can mock & inject the EPPlus ExcelPackage class. Mocking the HttpPostedFileBase, at least doing a true mock, seems limited. I can mock the basic properties on the file (MIME type, filename, etc), but to mock its InputStream in a way that allows the tests to actually interact with it, seems extremely difficult. The only solution I can come up

Open ExcelPackage Object with Excel application without saving it on local file path

时光毁灭记忆、已成空白 提交于 2019-12-17 20:59:24
问题 I have a text file with some information and I convert it to ExcelPackage Object using EPPlus, now I want to know if there is a way to open this object with excel without saving it to a local file? if is not possible can I use a temp directory to save it into a file, and then open it? 回答1: If you are talking about a windows app, you could just use something like System.IO.Path.GetTempPath() . You can get more info from here: How to get temporary folder for current user So, something like this

Weird behavior when setting a row's height on EPPlus

∥☆過路亽.° 提交于 2019-12-17 20:18:53
问题 I am building an Excel file with EEPlus under MVC-5 C# application. Everything goes as planned until I set a height on a row (so an image can fit). I load de images and set the height on column 20, like so: Image cfPhoto = null; Bitmap cfBm = null; ExcelPicture pictureCf = null; var photoInitialColumn = 0; i++; completedFormPhotos.ForEach(delegate(CompletedFormPhoto cfP) { cfPhoto = Image.FromFile(HostingEnvironment.MapPath("~/Content/Images/FormPhotos/" + cfP.Id + ".jpg")); cfBm = new Bitmap

Save as using EPPlus?

微笑、不失礼 提交于 2019-12-17 16:15:50
问题 Does any one know how to use the package.Saveas function? package.SaveAs(tempFolderPathAlt + saveas + ".xlsx"); At the moment this is underlined in red with the following error: The best overloaded method match for 'OfficeOpenXml.ExcelPackage.SaveAs(System.IO.Stream)' has some invalid arguments At the moment i'm saving the file in the following way. FileStream aFile = new FileStream(tempFolderPathAlt + saveas + ".xls", FileMode.Create); byte[] byData = package.GetAsByteArray(); aFile.Seek(0,

Format excel column to decimal doing export from c#

大兔子大兔子 提交于 2019-12-17 02:53:03
问题 Hi I am exporting database to excel with below method as Response.ClearContent(); Response.Buffer = true; Response.AddHeader("content-disposition", "attachment; filename=" + FileName); Response.ContentType = "application/vnd.ms-excel"; EnableViewState = false; Response.Write("<style> TABLE { border:dotted 1px #999; } TH { border:dotted 1px #D5D5D5; text-align:center } TD { border:dotted 1px #D5D5D5; } </style>"); Response.Write("<table>"); Response.Write("<tr>"); Response.Write("<th>Actual