Opening an excel spreadsheet in C#
Posted on 2004-04-27
Hello everyone. I am new to C#, and have kind of a dumb but interesting question. I have a C# program that I am trying to do two things with at this point. One is I want to provide the ability to load and open a spreadsheet in excel from C#. Currently the code to do this is as follows:
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.WaitForExit(); //waits until program is relinquished
The issue here is that the filename, denoted by the filename property of my open file dialog control, already take into account the \\ in the path selected, but when I try starting the process, I am receiving errors about cannot find the specified file, and it breaks up the filepath into sections. How can I correct this code.
Along with showing spreadsheets, I need to also load a spreadsheet into a listview or similar control. I am just looking for examples of this. I will offer a lot of points as this is a two part question in one. Hopefully this is legal. Thanks in advance.