epplus

Inconsistent appearance between manual and coded versions of solid databar and databar minimum value

拟墨画扇 提交于 2019-12-19 09:53:44
问题 I am trying to create solid databars in EPPlus 4.0.4, and am running into two problems. First, I haven't been able to figure out how to create a solid fill color. Second, at least for small values, the bars aren't showing up the way I expect them to. The screenshot below illustrates both issues. In both cases, the desired outcome is that of the databar I've added manually in Excel: This is the code I'm currently using: var bars = doc.ConditionalFormatting.AddDatabar(range, Color.FromArgb(99

Converting XLSX file using to a CSV file

时光怂恿深爱的人放手 提交于 2019-12-19 08:03:15
问题 I need to convert an XLSX file to another CSV file. I've done a lot of research on how to do this process, but I did not find anything that suited me. I found this Github Gist only Convert an Epplus ExcelPackage to a CSV file That returns an Array of binary. But apparently it does not work any more. I'm trying to load Array using LoadFromCollection FileInfo novoArquivoCSV = new FileInfo(fbd.SelectedPath); var fileInfoCSV = new FileInfo(novoArquivo + "\\" + nameFile.ToString() + ".csv"); using

EPPlus, Find and set the value for a Named Range

﹥>﹥吖頭↗ 提交于 2019-12-19 07:36:42
问题 I've been pulling my hair out trying to set the value of a named range (in this case, a single named cell) using the ExcelPackage (3.0.1) library, it should be a simple as this: ExcelNamedRange er = xlPackage.Workbook.Names["Customer"]; er.Value = "Foo Bar"; I'm obviously doing it wrong - has anyone got an example I can follow Thanks 回答1: I looked for ExcelPackage documentation to see what type Names[] collection returns and found that documentatios will come soon, or at least that is what

Is there a way to get 'named' cells using EPPlus?

谁都会走 提交于 2019-12-19 05:34:41
问题 I have an Excel file that I am populating programmatically with EPPlus. I have tried the following: // provides access to named ranges, does not appear to work with single cells worksheet.Names["namedCell1"].Value = "abc123"; // provides access to cells by address worksheet.Cells["namedCell1"].Value = "abc123"; The following does work - so I know I am at least close. worksheet.Cells["A1"].Value = "abc123"; 回答1: Actually, its a bit misleading. The Named Ranges are stored at the workBOOK level

Slow loading of .CSV files using EPPLUS

时间秒杀一切 提交于 2019-12-19 04:18:34
问题 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

EPPlus save two million rows with 200+ columns datatable to multiple excel files

隐身守侯 提交于 2019-12-19 04:09:29
问题 I have function that saves all records from SQL table to excel worksheet using EPPlus. If I export small amount of data everything works fine, but with 200+ columns and 500 000+ rows I get OutOfMemory exception. I'd like to modify my code in a way to be able to save 50 000 records per file. Here is my code that works for small data: private Task SaveAsync(string tableName) { return Task.Run(() => { try { using (var conn = new SqlConnection(_connectionString)) { using (var cmd = new SqlCommand

Unreadable content in Excel file generated with EPPlus

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-18 18:54:22
问题 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

How convert stream excel file to datatable C#?

*爱你&永不变心* 提交于 2019-12-18 12:29:21
问题 I use Epplus to reading xlsx files from stream. It has a bug , it cant read some columns in my workbook.How can read xlsx files from stream to datatable without epplus ? my older code: public static DataSet ReadExcelFile(Stream stream) { try { //2. Reading from a OpenXml Excel file (2007 format; *.xlsx) IExcelDataReader excelReader = ExcelReaderFactory.CreateOpenXmlReader(stream); //... DataSet result = excelReader.AsDataSet(); return result; } catch (Exception x) { throw x; } } I didnt

EPPlus - How to use a template

假装没事ソ 提交于 2019-12-18 10:49:15
问题 I have recently discovered EPPlus (http://epplus.codeplex.com/). I have an excel .xlsx file in my project with all the styled column headers. I read on their site that you can use templates. Does anyone know how or can provide code sample of how to use my template.xlsx file with EPPlus? I would like to be able to simply load my data into the rows without messing with the headings. 回答1: The solution I ended up going with: using System.IO; using System.Reflection; using OfficeOpenXml; //Create

Create advanced filter

风流意气都作罢 提交于 2019-12-18 09:38:11
问题 I am trying to create an advanced filter in Excel from C# to copy unique data from one sheet to another, at least I get it in Excel and if I use Interop like this : Excel.Range rang = sheet2.get_Range("A2"); Excel.Range oRng = sheet.get_Range("I2", "I" + (lst.Count + 1)); oRng.AdvancedFilter(Excel.XlFilterAction.xlFilterCopy, CriteriaRange: Type.Missing, CopyToRange: rang, Unique: true); Works fine but I'm doing all my application with EPPlus and it will be better if I can do the same without