Tag: .net

how to auto adjust excel when dynamically generate from the c# code

When i click the download button, the excel will download based on the existing input. But it is not showing the content correctly. it has collapsed. I want to do this in a auto adjust rows and column when i download this.. My code here: using (MemoryStream mem = new MemoryStream()) { SpreadsheetDocument spreadSheet = […]

Download file after ajax post call in .NET

My objective is to download an excel file after an ajax POST call. So far I have this endpoint which generates the excel file I want: [HttpPost] public ActionResult ExportReportList(ReportFilterViewModel filter, RequestedPageInfo pageInfo) { IEnumerable<RtbReport> rtbs = null; // get collection of page view entities to supply to the exporter rtbs = RtbReportRepository.GetReport(filter).ToList(); // put […]

How do I match an entire string with a regex?

I need a regex that will only find matches where the entire string matches my query. For instance if I do a search for movies with the name “Red October” I only want to match on that exact title (case insensitive) but not match titles like “The Hunt For Red October”. Not quite sure I […]

ClosedXML: Access existing pivot table

I created a workbook, added data to a sheet and from that data created a pivot table on another sheet. I would like to be able to open said table on another occasion later in the code, but I can’t figure out how to do this. Using this: IXLPivotTable pivot = pivotSheet.PivotTables.PivotTable(“temp”); or IXLPivotTable pivot […]

C# – How to save a single Excel WorkSheet in the current WorkBook?

I have seen some other existing questions about saving a single worksheet but the are regarding saving a worksheet in a new workbook (by copying it to the new workbook and then saving it. What I need is to save just one specific worksheet within the existing workbook, is to not possible? Thank you!

Form has different style when shown from MMC snap-in

I’m displaying a dialog in an MMC snap-in. When the dialog is called from the result pane it has the Windows theme. However when the dialog is called from the snap-in scope pane context menu it has a different style. The snap-in is written in C++ and the dialog is a C# form. The C++ […]

(C++/CLI) Simplified Chinese to Traditional Chinese while reading Excel or CSV form

I have a CSV form that contains Chinese characters in GB2312(simplified Chinese). Also, I am using Win7 in simplified Chinese mode/format while making the application in Visual Studio 2015. I am making a simple application to read the data from that CSV form, and display some of the data(string) in a textBox in winform(C++/CLI). However, […]

NPOI can't open slightly corrupt xls

My client has software that exports an xls file to a folder. I have created a .NET Windows Service that grabs files in that folder and sends them to an SFTP site they share with their customer. They have an issue where UPC codes above a certain length are automatically configured by excel to appear […]

Excel Interop COMException HRESULT: 0x800A03EC when accessing hidden cell

I’m having issues accessing a named cell in Excel from C# using Excel Interop when the cell is hidden and I access it like so: bool SomeBoolean = WorkSheet.Range[“MyRangeName”].Value; The Range property implicitly calls get_range when I’m accessing it, which is what’s throwing the exception according to the stack trace. The code used to call […]

Embedding Excel component in WPF application

I need to develop a WPF application with Excel like capabilities. Here are the pre-requisites: – Cells lock – Apply colours, backgroup – Hide columns or rows – Use formulas – Manage font size, columns with… (large sheet to display) – Lock headers (always visible on scroll) – Export as xls file What component do […]

MS Excel Spreadsheet is the best Office Software, Excel VBA and Excel Formulas make Spreadsheet work faster.