Tagged Questions
288
votes
25answers
103k views
How to properly clean up Excel interop objects
I'm using the Excel interop in C# (ApplicationClass) and have placed the following code in my finally clause:
while (System.Runtime.InteropServices.Marshal.ReleaseComObject(excelSheet) != 0) { }
...
22
votes
3answers
30k views
Write Array to Excel Range
I'm currently trying to write data from an array of objects to a range in Excel using the following code, where objData is just an array of strings:
private object m = System.Type.Missing;
object[] ...
18
votes
4answers
22k views
A Simple C# DLL - how do I call it from Excel, Access, VBA, VB6?
I have a simple class library written in c#.
using System;
namespace TestDll
{
public class Test
{
public string HelloWorld
{
get
{
...
19
votes
8answers
10k views
Resources for learning c# Excel interop [closed]
What are some resources that will help get me up and running quickly with the Excel interop in C#?
35
votes
5answers
11k views
Excel interop: _Worksheet or Worksheet?
I'm currently writing about dynamic typing, and I'm giving an example of Excel interop. I've hardly done any Office interop before, and it shows. The MSDN Office Interop tutorial for C# 4 uses the ...
26
votes
5answers
9k views
Excel Interop - Efficiency and performance
I was wondering what I could do to improve the performance of Excel automation, as it can be quite slow if you have a lot going on in the worksheet...
Here's a few I found myself:
...
10
votes
4answers
10k views
.Net Excel Interop Deleting a worksheet
I'm trying to delete a worksheet from a excel document from a .Net c# 3.5 application with the interop Excel class (for excel 2003).
I try many things like :
Worksheet worksheet = ...
14
votes
7answers
64k views
C# how to add Excel Worksheet programatically Office XP / 2003
I am just starting to fiddle with Excel via C# to be able to automate the creation, and addition to an Excel file.
I can open the file and update the data and move through the existing worksheets. ...
10
votes
3answers
11k views
C# and Excel interop
Hey guys.
One of my users is having an issue when trying to open an Excel file through my C# app. Everything works ok when I run it from my machine and it works for other users. I am no Excel ...
4
votes
1answer
6k views
How to load an Excel Addin using Interop
I have an addin which I want to invoke through Excel interop from a C# winforms application.
I can't get the addin etc. to load unless I uninstall and resinstall it each time (this is apparantly ...
5
votes
2answers
5k views
Safely disposing Excel interop objects in C#?
i am working on a winforms c# visual studio 2008 application. the app talks to excel files and i am using Microsoft.Office.Interop.Excel; to do this.
i would like to know how can i make sure that the ...
6
votes
6answers
8k views
How can I write to an Excel spreadsheet using Linq?
I'm writing an app where I need to retrieve some rows from a DB and dump them into an Excel spreadsheet. I'm using Linq to retrieve these rows.
Is it possible to dump these rows directly into their ...
2
votes
4answers
5k views
Why am I getting an Out of Memory Error doing ASP .NET Excel Interop?
This was working..and I moved the disposal code to the finally block, and now it fails every time.
I have a test spreadsheet with 4 records, 6 columns long. Here is the code I'm using to bring it in. ...
2
votes
4answers
3k views
How do I read the values of Excel dropdowns or checkboxes from c# or vb.net?
I'm using Microsoft.Office.Interop.Excel to read the values of cells of a worksheet, but I'm unable to find information that shows how to read dropdowns, checkboxes and option buttons.
Thanks!
1
vote
1answer
2k views
What is the correct `XlFileFormat` enumeration for Excel 97-2003
In regards to Excel VBA Interop, what is the correct XlFileFormat enumeration for saving an Excel 97-2003 spreadsheet?
The official MSDN documentation is here but I can't figure out from reading this ...