To interface with Excel in C#, you can use the Microsoft Office Interop library, which allows you to automate Excel using COM technology.
Here are the basic steps to get started:
Add a reference to the Microsoft.Office.Interop.Excel
assembly in your project.
Create a new instance of the Application
class:
main.cs78 chars6 lines
main.cs69 chars2 lines
main.cs58 chars2 lines
main.cs132 chars6 lines
main.cs35 chars3 lines
It's important to note that when automating Excel, you should always release the COM objects you use when you're done with them, to avoid memory leaks. Here's an example:
main.cs223 chars9 lines
gistlibby LogSnag