Santosh Kokatnur
Santosh Kokatnur

Reputation: 364

Exporting Treeview data to excel sheet using C#

I am using Visual Studio 2010. I have a form which has a treeview control which generate values from an xml file. When I select a particular treeview node, I need to export the selected node data and its child nodes to an excel sheet as rows and columns.

Could any one guide me how can I proceed with this?

Appreciate your immediate response.

Thanks

Upvotes: 0

Views: 2394

Answers (1)

Bayeni
Bayeni

Reputation: 1046

You need to loop through the children of the select node then add to exel workbook

this code show how to get to the children of the select node

foreach(TreeNode node in yourTreeview.SelectedNode.Nodes)
{
      // write code to export data to excel.
}

You can read for exporting data to excel How can I export data to an Excel file

Upvotes: 2

Related Questions