epplus

EPPLUS is duplicating strings on insert

风格不统一 提交于 2019-12-12 04:58:34
问题 I am trying to insert text into RichText, when the index of the inserted string is at the end of an element the next element gets duplicated! Here is an example: worksheet.Cells[rownum + 100, column].RichText.Add("first "); worksheet.Cells[rownum + 100, column].RichText.Add(" second"); worksheet.Cells[rownum + 100, column].RichText.Text = worksheet.Cells[rownum + 100, column].RichText.Text.Insert(6, "Inserted"); Result: "first Insertedsecondsecond" Is this normal behavior? because I am

Set conditional background color of cell based on text using EPPLus in C#.net

随声附和 提交于 2019-12-12 04:27:12
问题 I am using Epplus For Export to Excel. i want to set the background color of column 1 and 2 based on column 1 value. if any cell in column 2 cells contain 1 then the background color of col1 and col2 is of Green. if it contains 2 then the background Color must be light yellow. Like below Image. Now I am able to set only 2nd column background color. if i set the range then it set the background color based on the Last condition and color the entire column as yellow. Please help me out. 回答1:

How to retrieve column names from a excel sheet?

偶尔善良 提交于 2019-12-12 04:03:22
问题 Using EPPlus I'm writing data to multiple sheets. If a sheet is not created I'm adding a sheet else I'm retrieving the used rows and adding data from that row and saving it FileInfo newFile = new FileInfo("Excel.xlsx"); using (ExcelPackage xlPackage = new ExcelPackage(newFile)) { var ws = xlPackage.Workbook.Worksheets.FirstOrDefault(x => x.Name == language.Culture); if (ws == null) { worksheet = xlPackage.Workbook.Worksheets.Add(language.Culture); //writing data } else { worksheet = xlPackage

“The type or namespace name 'OfficeOpenXml' could not be found” error

佐手、 提交于 2019-12-12 03:38:41
问题 We are using EPPlus to generate Excel documents. Code builds successful in my local system but it is failing when we build through TeamCity and getting below error - error CS0246: The type or namespace name 'OfficeOpenXml' could not be found (are you missing a using directive or an assembly reference?) I have tried Google to find the solution but all in vain. My Project target framework is 4.5.2 and I have also added System.Core and WindowsBase. I have also added namespace "using

Is it possible to launch a .xlsm file from an asp .net page?

与世无争的帅哥 提交于 2019-12-12 03:30:31
问题 I need to launch a .xlsm file from within an asp .net (VB) page. I tried a bunch of things, including EPPlus, but nothing seems to work. Any thoughts? 回答1: OK! So, after two days of banging my head on the keyboard, this is what worked, I added code to the OnClientClick event as follows which launched the freaking .xlsm file! OnClientClick="javascript: MyObject = new ActiveXObject('WScript.Shell'); MyObject.Run('file:///C:/MacroEnabledFile.xlsm')" 来源: https://stackoverflow.com/questions

How to get a shape/picture coordinates in pixels in an excel file (xlsx) using EPPlus

岁酱吖の 提交于 2019-12-12 03:26:28
问题 Has anyone succeeded in obtaining the x and y coordinate in pixels of a shape or a picture in a sheet in an excel 2010 file using epplus? 回答1: I finally found a solution using internal xml data, it seems that excel is using a unit for measure called EMU which is equal to 1/9525 pixel . the solution is below public static Rectangle GetDimensions(string shapeName, ExcelWorksheet sheet) { const int EMU = 9525; var shapeBaseNodexPath = string.Format("//*[@name='{0}']", shapeName); //get node that

EPPlus throws DataValidations exception “Requested value 'date' was not found.” when trying to save xlsm

不问归期 提交于 2019-12-12 03:18:46
问题 I'm attempting to make changes to a customer-supplied .xlsm file (a C# application will fill with data from a web-form and submit to a CMS) using EPPlus. But on package.Save(name) -- or packagae.SaveAs(name) -- an exception is thrown by the DataValidations collection: 2011-11-28 14:17:51,380 [9] ERROR app.ExcelConverter - System.ArgumentException: Requested value 'date' was not found. at System.Enum.EnumResult.SetFailure(ParseFailureKind failure, String failureMessageID, Object

Why the browser can't show an EPPlus spreadsheet?

。_饼干妹妹 提交于 2019-12-12 02:45:57
问题 I'm trying a lot of options with complete unsuccess. My need is create a spreadsheed in the server and the user gets it in the browser in a asp.net MVC 5 environment. In the server the code is: [HttpPost] public ActionResult ExportToExcel([ModelBinder(typeof(DevExpressEditorsBinder))] Reports data) { ExcelPackage pck = new ExcelPackage(); var ws = pck.Workbook.Worksheets.Add("Sample1"); ws.Cells["A1"].Value = "Sample 1"; ws.Cells["A1"].Style.Font.Bold = true; var shape = ws.Drawings.AddShape(

EPPLUS multiple columns configuration and conditional formatting in Excel C#

蓝咒 提交于 2019-12-12 01:54:34
问题 In my tool, user can choose one configuration (through combobox->multiple datatable) and the respective table will reflect in the excel sheet as per below.Columns (data in rows will differ) that will remain the same for all configuration are Product Name, Serial Name and Length 1 and Total Length. Different configuration will have added columns such as Length 2, Length 3,Length 4 (user will add the data in these rows)etc. I want to add conditional formatting formula in Total Length column

Excel treating date column as general when exporting to Excel using C#

ぃ、小莉子 提交于 2019-12-11 19:39:09
问题 I am using EPPlus library to export a report in Excel. One of the columns is of date type but after exporting to Excel, when I open that file, it treats that column as "General" unless I right click on it and set its type to "Date". Following is my code: private void ExportToExcel(DataTable dataTable) { //Althought the column type is already date in dataTable but even if I use following line Excel doesn't treat it as Date dataTable.Columns["Created On"].DataType = typeof(DateTime); foreach