epplus

How to get range in EPPlus

喜欢而已 提交于 2019-12-14 00:55:17
问题 Does anyone know how to execute the following in EPPlus. The following is the way when using VSTO. I'm trying to get some specific ranges from a worksheet. sheet.get_Range("7:9,12:12,14:14", Type.Missing) 回答1: You can use this ExcelPackage pck = new ExcelPackage() var ws = pck.Workbook.Worksheets.Add("Sheet1"); ExcelRange cells = ws.Cells[1, 1, 1, 10];//get 10 cells in row 1 回答2: I am not fully familiar with `get_Range' but based on the documention it works just like the cells object of

Embed object in Excel programmatically

别说谁变了你拦得住时间么 提交于 2019-12-14 00:33:35
问题 I've tried several libraries, including EPPlus, NPOI and they can insert images, but i couldn't find how to insert objects( pdf's, text files, images ) as files . Is there any way or library to do that in .NET? Thanks! 回答1: Using this code I was able to embed a PDF file, a txt file , and a png file into Excel using C#. public static class ExcelReaderFunctions { public static void ExcelInsertOLE(string path) { Microsoft.Office.Interop.Excel.Application excel = new Application(); excel

EPPlus chart(pie,barchart) selected(B2,B36,B38) .. etc excel cells

半腔热情 提交于 2019-12-13 17:24:27
问题 I have similar to the link below problem. EPPlus chart from list of single excel cells. How? I tried the code but it shows it twice in the chart. For example: This code show excel chart -> select data-> horizontal(category) axis labels tab you show 100,100,300,600 write. What is the reason for this? The chart is written twice the first data I did not find a solution to the problem. 回答1: I think you just discovered a bug with EPPlus. Shame on me for not noticing that with that post you

invoke formula in excel via epplus

筅森魡賤 提交于 2019-12-13 11:59:12
问题 I have an excel sheet in ASP.NET MVC4 C# project and I am able to read from excel sheet successfully using EPPlus. Now, I want to be able to pass in 2 numbers into cell C:2 and C:3 and be able to invoke formula in C:4 which is =SUM(C2:C3). So from C# I want to pass in 4 and 6 and invoke the formula and be able to get the result back from C:4 which is 40 (SUM of 10 and 30). How do I accomplish that in C#. In the following code, I get back zero for d.Average d.Average = Convert.ToDouble

Why am I getting, “Cannot implicitly convert type 'void' to 'object'” with this code (EPPlus)?

守給你的承諾、 提交于 2019-12-13 07:54:52
问题 I was using this code to populate a cell in a spreadsheet using EPPlus: using (var footerMonth1Cell = prodUsageWorksheet.Cells[columnFooterRow, MONTH1_COL]) { footerMonth1Cell.Value = monthsTruncatedYears[0]; footerMonth1Cell.Style.Font.Size = DATA_FONT_SIZE; footerMonth1Cell.Style.HorizontalAlignment = ExcelHorizontalAlignment.Right; } It was working fine, I thought, but a user complained that it was producing "green triangles" in the cells. "monthsTruncatedYears" is a generic list of string

Copy worksheet in Epplus Values only

那年仲夏 提交于 2019-12-13 07:34:50
问题 I am using Epplus to copy a worksheet from a wokbook and paste it in another workbook.I can able to copy the worksheet sucesssfully,by using the below code. ExcelPackage masterPackage = new ExcelPackage(new FileInfo(@"C:\\Users\\350154\\Desktop\\vb workouts\\testsample.xlsx")); ExcelPackage pckg = new ExcelPackage(new FileInfo("C:\\Users\\350154\\Desktop\\vb workouts\\as.xlsx")); string workSheetName = pckg.Workbook.Worksheets[1].Name; ExcelWorksheet pck = pckg.Workbook.Worksheets[1]; pck

EPPlus Formula Evaluation

别等时光非礼了梦想. 提交于 2019-12-13 06:50:59
问题 When using EPPlus, I am trying to insert the result of a formula into a cell ie: Worksheet.Cells["A4"].Value = 3 Worksheet.Cells["A5"].Value = 4 Worksheet.Cells["A6"].Formula = "=SUM(A3:A4)" Worksheet.Cells["A6"].Calculate() In the worksheet i will see the formula in the Formula bar, but what I would like is to evaluate the formula in EPPlus and insert the value into the cell. So when clicking into the cell all i see is 7 and not =SUM(A3:A4) The reason for this, is because I have large

EPPlus converting csv and missing the comma from a double

帅比萌擦擦* 提交于 2019-12-13 02:37:19
问题 I'm trying to convert a CSV file to xlsx file using the following code: string csvFileName = path; string nomeArquivo = Path.Combine(serverpath, RandomString(10) + ".xlsx"); string worksheetsName = "b2w"; bool firstRowIsHeader = false; var format = new ExcelTextFormat(); format.Delimiter = ';'; format.EOL = "\n"; // DEFAULT IS "\r\n"; // format.TextQualifier = '"'; using (ExcelPackage package = new ExcelPackage(new FileInfo(nomeArquivo))) { ExcelWorksheet worksheet = package.Workbook

c# epplus error Removed Part: Drawing shape

狂风中的少年 提交于 2019-12-13 02:35:31
问题 I just started using the epplus library after attempting to use oledb and then tried interop. Below is what i'm working on public void editExcel_VariablesEEP() { try { FileInfo newFile = new FileInfo(excelQuotePath); ExcelPackage pck = new ExcelPackage(newFile); var energyCalculation = pck.Workbook.Worksheets[4]; var ROI = pck.Workbook.Worksheets[3]; var NPV = pck.Workbook.Worksheets[2]; var Summary = pck.Workbook.Worksheets[1]; energyCalculation.Cells["B5"].Value = Convert.ToDecimal

Use 'LoadfromCollection' with a list containing another list inside

本秂侑毒 提交于 2019-12-12 17:24:28
问题 My problem is that I have a list that contains a few strings and inside this list another list of decimals, something like this: public class excelInventario { public excelInventario() { cols = new List<decimal>); } public string codigo { get; set; } public string nombre { get; set;} . public List<decimal> cols { get; set; } //Lista de columnas public decimal suma { get; set; } public decimal stock { get; set; } public decimal diferencia { get; set; } public decimal precio { get; set; } } and