Excel数据到TreeView C# [英] Excel Data to TreeView C#
本文介绍了Excel数据到TreeView C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在寻找一个Windows窗体,其中包含我在excel中的数据的树视图。我有窗体,我只是想弄清楚如何将excel数据导出到该数据树中。任何链接?
I am looking to create a windows form that contains a tree view of data that I have in excel. I have the windows form I am just trying to figure out how to export the excel data into that data tree. Any links?
推荐答案
如果您导入 Microsoft.Office.Interop.Excel
程序集,您可以访问Excel文件,并轻松使用每个属性和方法。
示例:
If you import Microsoft.Office.Interop.Excel
assembly you can access Excel files and use every property and method easily.
Example:
using Excel = Microsoft.Office.Interop.Excel;
public static object GetCellValue(
string filename, string sheet, int row, int column)
{
Excel.Application excel = new Excel.Application();
Excel.Workbook wb = excel.Open(filename);
Excel.Worksheet sh = wb.Sheets[sheet];
object ret = sh.Cells[row, column].Value2;
wb.Close();
excel.Quit();
}
这篇关于Excel数据到TreeView C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文