Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveX javascript excel group rows for hierarchy

Status
Not open for further replies.

kaf0021

Programmer
Feb 5, 2008
1
US
I am trying to export a grid to excel in javascript. I have iterated through all rows and exported them correctly. I am having trouble implementing the hierachical nature in excel. Is there a way to group the rows through javascript for the excel sheet?? My code is below and the commented part is where I need to group the rows.

for(var i = 0; i< rowlength; i++)
{
row = rows.getRow(i);

if (!row.getHidden())
{
if (row.GroupByRow)
{
XlSheet.cells(y,1).value = row.MaskedValue;
var test = XlSheet.rows(y);
y++;

for(var j = 0; j < row.ChildRowsCount; j++)
{
x=1;
var childrow = row.getChildRow(j);
if (!childrow.getHidden())
{
var _band = childrow.Band;
var _childcolumns = _band.Columns;
var child_length = _childcolumns.length;
for (var k = 1; k < child_length; k++)
{
if (!(k == 4 || k == 8 || k == 9 || k == 10))
{
if (!childrow.getHidden())
{
cell = childrow.getCell(k);
the_value = cell.getValue();
XlSheet.cells(y,x).value = the_value;
x++;
}
}
}
}
y++;
}
// group rows under corresponding company, category
// something like ?? ---> XlSheet.GroupRows(XlSheet.rows(1), XlSheet.rows(x-1));
}
}

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top