excel-interop

Excel won't open/launch VSTO AddIn when running in debug mode of Visual Studio 2010

北城余情 提交于 2019-11-30 07:07:35
I had previously installed the VS11 beta, and had some issues with my Visual Studio 2010 instance, which you can see here how they were resolved: Excel AddIn Click Once deployment issue . Now I have a code base which compiles/builds a vsto, which installs fine and runs fine in Excel 2010. However, when I remove the installed version from Excel, and try to run it directly through Visual Studio 2010, the AddIn does not get loaded into Excel when running in debug configuration mode, in release configuration mode it works fine. Any ideas on why this might be occurring? I've tried re-enabling it

How to Save/Overwrite existing Excel file with Excel Interop - C#

我怕爱的太早我们不能终老 提交于 2019-11-30 06:17:42
Is there a way to save changes to an excel spreadsheet through the excel interop (in this case I am adding a worksheet to it) without having it prompt the user if they want to overwrite the existing file with the changes. I do not want the user to even see the spreadsheet open in my application so having a message box popping up asking them if they want to overwrite the file seems very out of place and possibly confusing to the user. I am using the workbook.SaveAs(fileloaction) method. Here is where I am initializing the COM reference objects for the excel interop. private Excel.Application

how to detect merged cells in c# using MS interop excel

纵然是瞬间 提交于 2019-11-30 05:16:24
问题 I want to detect merged cells either in a row/entire sheet(preferable).Here is my code Microsoft.Office.Interop.Excel.Application xl = new Microsoft.Office.Interop.Excel.Application(); Microsoft.Office.Interop.Excel.Workbook workbook = xl.Workbooks.Open(source); //Microsoft.Office.Interop.Excel.Worksheet ws = (Microsoft.Office.Interop.Excel.Worksheet)workbook.Sheets[sheetNumber]; Microsoft.Office.Interop.Excel.Worksheet ws = (Microsoft.Office.Interop.Excel.Worksheet)workbook.Worksheets

Create UDF using VSTO and no VBA

旧城冷巷雨未停 提交于 2019-11-30 04:06:45
Similar to this question (but in my case not VSTO SE), however, I just want to confirm that it is not possible to create a UDF using pure VSTO in Visual Studio 2005 and Excel 2003 - so, to absolutely clear, my question is: Is it possible to create a Excel 2003 UDF using Visual Studio 2005 and a VSTO solution without using any VBA or other tricks? I'm aware of ManagedXLL, ExcelDNA, Excel4Net etc but don't want to consider those for the moment. Thanks Concerning whether there is a way around COM or VBA I don't think that it is possible (at least not without any very dirty tricks). The reason is

C# and Excel Interop issue, Saving the excel file not smooth

ⅰ亾dé卋堺 提交于 2019-11-30 02:47:15
问题 I could Open and Write to the excel file, but when I try to save the file by passing a path to it, the save operation prompts with the Save dialog. I was expecting it to quitely Save the file at the specified path The code is as below: excelApp.Save(exportToDirectory); excelApp.Quit(); where, exportToDirectory is: "C:\files\strings.xlsx". PS: I have already checked with the excel version and similar issue. Thanks 回答1: You need to use Workbook.SaveAs instead of Application.Save : Excel

Is Office 2003 interop supported on Windows server 2008 ..?

南楼画角 提交于 2019-11-29 23:32:04
问题 I am getting below error while trying to run an interop dependent program on Windows server 2008 its running fine on Win Server 2003 and XP: System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC at Microsoft.Office.Interop.Excel.WorkbookClass.SaveAs(.......) According to Microsoft, Windows Server 2008 is not in list of suppoerted OS. http://www.microsoft.com/downloads/en/details.aspx?familyid=3c9a983a-ac14-4125-8ba0-d36d67e0f4ad&displaylang=en System

Microsoft.Office.Interop.Excel or EPPlus for read a huge (or not) Excel file

北城余情 提交于 2019-11-29 16:12:45
I wrote a code to read a column from a Excel file. I use Microsoft.Office.Interop.Excel on this, first read the entire Range and then write in System.Array after that I do some operations with the System.Array values and finally I convert it to List because I fill a ListBox element. This is the code (only relevant parts): private List<string> bd = new List<string>(); private static System.Array objRowAValues; private List<string> bl = new List<string>(); private static System.Array objRowBValues; private List<string> cm = new List<string>(); private static System.Array objRowCValues; private

How do I insert/retrieve Excel files to varbinary(max) column in SQL Server 2008?

左心房为你撑大大i 提交于 2019-11-29 14:29:52
问题 I'm trying to save Excel files into the database, I do not want to use filestream as it is required to have a server for that. So how do I insert/update/select into the table that has a column of type varbinary(max) ? 回答1: If you want to do it in straight ADO.NET, and your Excel files aren't too big so that they can fit into memory at once, you could use these two methods: // store Excel sheet (or any file for that matter) into a SQL Server table public void StoreExcelToDatabase(string

Copy format from one row to another using c#

▼魔方 西西 提交于 2019-11-29 14:09:13
This question is quite similar to the one asked here . But the answer given suggests copying the format along with the data. I have a excel sheet (.xlsx) that I generate using SSIS. Now I have set the formatting in first row, which I want to copy to all the rows that are already filled in the worksheet. How can I do that using C#? I am using Excel interop. You can use PasteSpecial with xlPasteFormats . Excel.Range R1 = (Excel.Range)oSheet.Cells[11, 11]; R1.Copy(Type.Missing); Excel.Range R2 = (Excel.Range)oSheet.Cells[15, 15]; R2.PasteSpecial(Excel.XlPasteType.xlPasteFormats, Excel

Excel interop works on machine with Office 2007 but fails on machine with Office 2010

爷,独闯天下 提交于 2019-11-29 13:39:20
问题 I have a C# WPF (.NET 4.0) application that uses Excel interop to read data from an Excel file. When I run this app on my development machine, which has Excel 2007, it works fine. When I run it on another machine that has Excel 2010 installed on it, it fails with the following error message: System.Runtime.InteropServices.COMException (0x80040154): Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154 Class