Nov 16, 2012 at 5:01 PM
Edited Nov 16, 2012 at 5:02 PM
Because you are using C#, as opposed to Java, the language the original poster was using, you have another option available to you. You can use the Excel object model to create a new NodeXL workbook from the NodeXLGraph.xltx template file that gets
installed with NodeXL, then populate the Vertex 1 and Vertex 2 columns on the Edges worksheet in the new NodeXL workbook.
There are many resources available that explain how to use the Excel object model to manipulate Excel workbooks. Here is just one example:
And here is the Microsoft documentation for the object model:
One important point is that you won't be using Application.Workbooks.Add(), without an argument, to create a NodeXL workbook. Application.Workbooks.Add() creates a plain, empty Excel workbook, which isn't what you want. Instead you should use
the version of the Add() method that takes a template path:
String nodeXLTemplatePath = "SomeFolder\NodeXLGraph.xltx";
Workbook newNodeXLWorkbook = Application.Workbooks.Add(nodeXLTemplatePath);
That creates a NodeXL workbook from the NodeXL template file.
You'll find NodeGraph.xltx file in NodeXL's program folder. The program folder's location varies, but on English 64-bit computers it's at "C:\Program Files (x86)\Social Media Research Foundation\NodeXL Excel Template".
Note that you must have NodeXL installed on the computer on which you are running your own custom C# program, or this technique will not work. If you want your program to be able to run on any computer, you will have to revert to one of the solutions
I offered earlier in this discussion.