NodeXL not taking programatically entered excel data

Oct 17, 2012 at 4:10 PM


I have a blank template NodeXL template, which I am populating using a program. Now, the issue is that NodeXL is taking the first entry only from that populated data. I am not able to understand what is wrong with it. When I copy the same data to the same excel sheet, the graph works fine, showing all the vertices. 

What can be the possible issue here? Is the NodeXL Template loosing it's schema when I write the information? 


Oct 17, 2012 at 6:56 PM
Edited Oct 17, 2012 at 6:56 PM

We store the graph data in Excel tables, which are called ListObjects in the Excel API.  Are you writing to the worksheet object instead of the table object?  Your data may be ending up in the worksheet but not in the table.  When NodeXL reads the table, it sounds like it is finding only one row of data in the table, even though you can see more data in the worksheet.

The NodeXL worksheets have colored table rows, so you can tell where the table ends and the rest of the worksheet begins.

To write to a NodeXL table from VBA, do something like this:

    Sheets("Edges").ListObjects("Edges").ListRows(1).Range.Cells(1, 1) = "Hello"

(Actually, you probably want to be more robust and look up the column names, so that you are writing to the column named "Vertex 1" instead of using hard-coded column indexes.)

-- Tony

Oct 17, 2012 at 7:01 PM

Oh, and you'll want to use ListRows.Add() to add each row.  My sample code is too basic, so to speak.

-- Tony

Oct 17, 2012 at 8:00 PM

so, does that mean that I have to preserve the cell format along with any calculation matrix that might be working in the background? I am actually using Java for writing, but I get the direction which you are telling. this issue is becoming very annoying now, will have to see what I can try. 

I am using apache POI library for writing into the XLSX file. from your steps, should I conclude that we have to use some standard function to fill up the values, rather than setting the values as such? 

Oct 17, 2012 at 10:13 PM
Edited Oct 17, 2012 at 10:14 PM

The first thing I would do is determine whether my diagnosis is correct:  Is your edge data ending up outside the Edges table, where NodeXL won't find it?  You can determine that by looking at the Edges worksheet after you programmatically fill it.  The table rows have colored backgrounds.  Alternatively, you can go to Formulas, Name Manager in the ribbon and see what the range is for the "Edges" name.

I don't know what you mean by cell format or calculation matrix, and I am not familiar with the Apache POI library.  I can only tell you that whatever programming technique you use, your edge data has to end up in the Edges table.  If you were using the Excel API, you would do it with code similar to what I provided earlier.

-- Tony

Oct 18, 2012 at 7:29 AM

Thanks for the help. I was able to fix the issue. It was some erroneous code statement which was causing the issue to the cell data. it is working perfectly now.