java - Dynamically creating rows in Excel sheet with Apache POI -


i'm writing program read large xml file , create excel file it. attributes of each node column headers in excel file. created dom object , got nodelist. need iterate through , each node, need add row in excel sheet node's attributes values column values. so, when iterating, need create rows dynamically. how can it? dont see functionality add created rows in apache poi, far have seen define new rows everytime. i'm unable since has more 5000 entries. want is:

    node node = null;     hssfrow datarow = null;     (int = 0; < nodelist.getlength(); i++) {         node = nodelist.item(i);         datarow = spreadsheet.createrow(i);         //set values data row here, , add it.         //so in loop, next time same variable assigned spreadsheet.createrow(1) etc.     }  

i understand createrow invoked spreadsheet, add row it. in loop, same variable assigned other rows too, think 1 row. please advice me on this.

try following

   node node = null;     hssfrow datarow = null;     (int = 0; < nodelist.getlength(); i++) {         // on each loop value of node item         node = nodelist.item(i);         //for every new node list create row          datarow = spreadsheet.createrow(i);         //finally set node value columns of newly created row     }  

hope helps !!


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -