closedxml

How can I add symbols to a cell using closedxml?

守給你的承諾、 提交于 2019-12-23 04:59:10
问题 I am inserting data into a dummy excel. I need to append symbols before texts into some cell. Please let me know how can i achieve this using ClosedXML. 回答1: In ClosedXML, you can set this value with this code: ws.Cell(1, 1).Value = "❶ Symbol"; To enter the ❶, you can use the Windows program Character Map to select and copy the appropriate character. 来源: https://stackoverflow.com/questions/39489347/how-can-i-add-symbols-to-a-cell-using-closedxml

Reading Excel data and cell formatting in C#

痞子三分冷 提交于 2019-12-23 01:20:06
问题 I am looking for a library that allows me to read an Excel document in C#, but I am needing to be able to read the cell formatting as well as the data in the spreadsheet. I found this useful question that lists a lot of different alternatives for reading Excel documents, but a lot of the solutions offered here only allow the content of the spreadsheet to be read, not the cell properties (eg font, background colour, etc). For my particular problem, though, I am needing to read a document that

How can I embed some VBA code into a spreadsheet created using ClosedXML?

自作多情 提交于 2019-12-22 04:13:18
问题 I am using ClosedXML to generate spreadsheets from C# (asp.net-mvc) and it works great. I have one additional requirement so I wanted to get some feedback on how I could achieve this. I want to save as a macro enabled workbook and when I just give it a "xlsm" extension it doesn't seem to open (versus a xlsx). Here is my code: public ActionResult ExportExcel() { MemoryStream stream = nModel.GenerateSS(); return File(stream, @"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

ClosedXML Outline

不羁岁月 提交于 2019-12-19 10:53:17
问题 I am trying to create a Group in the exported Excel Workbook using OpenXML. My source data table looks like this: Row State Product Sales 1 NY A 100 2 NY A 200 3 NY B 300 4 CA A 100 5 CA A 200 6 CA B 300 I would like to create an outline by State and then Product with a subtotal on each group I tried ws.Outline.SummaryVLocation = XLOutlineSummaryVLocation.Top; ws.Rows(1, 3).Group(); // Create an outline (level 2) for rows 1-4 ws.Rows(4, 6).Group(); But it's not giving me what I want, and I

ClosedXML Outline

若如初见. 提交于 2019-12-19 10:53:12
问题 I am trying to create a Group in the exported Excel Workbook using OpenXML. My source data table looks like this: Row State Product Sales 1 NY A 100 2 NY A 200 3 NY B 300 4 CA A 100 5 CA A 200 6 CA B 300 I would like to create an outline by State and then Product with a subtotal on each group I tried ws.Outline.SummaryVLocation = XLOutlineSummaryVLocation.Top; ws.Rows(1, 3).Group(); // Create an outline (level 2) for rows 1-4 ws.Rows(4, 6).Group(); But it's not giving me what I want, and I

export Gridview to Excel using ClosedXML without warning: the file you are trying to open is in a different format

只愿长相守 提交于 2019-12-19 09:18:20
问题 I am working on a ASP.NET 4.5 Webform and I have a Gridview (that has custom TemplateField and gets data from a sqlDataSource) I have this event to export the gridview contents to an excel sheet, and it does its jobs well except the created file is giving out an warning when user open it (which I understand because the file that got created is not an actual excel file): "the file you are trying to open is in a different format than specified by the file extension" protected void btnExport

Download an excel file in JQuery-AJAX request from ASP.NET MVC

不羁岁月 提交于 2019-12-19 04:19:26
问题 In my ASP.NET MVC project, I generated a excel file using ClosedXML. It works well in non-ajax call. Here is my controller action method // Prepare the response Response.Clear(); Response.ContentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; Response.AddHeader("content-disposition", "attachment;filename=\"" + reportHeader + ".xlsx\""); // Flush the workbook to the Response.OutputStream using (MemoryStream memoryStream = new MemoryStream()) { MyWorkBook.SaveAs

How can I enable the “Sharing” options on Excel workbooks?

跟風遠走 提交于 2019-12-14 03:59:54
问题 Is it possible to enable "Sharing" on excel documents through OpenXML or ClosedXML? Or any other library if it can help... I believe this is usually performed when you save the document (at least that's how it works in VBA), but I can't find how to specify saving arguments in C#. I'd like to avoid using InterOp since I might batch this process on multiple files through a network. EDIT: According to some old pages from 2009, there are limitations where OpenXML cannot operate protected files.

How can I concatenate several cells with text? [closed]

邮差的信 提交于 2019-12-13 03:26:41
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 5 months ago . I use closedXml and I want to concatenate cells which located in one row. In column E/F/G is what I have. And in column J is that I want to see: In addition, I want to save bold/italic format Can anyone help me? 回答1: A little more complicated than I expected it to be but still