开发者

Excel Data to TreeView C#

开发者 https://www.devze.com 2023-04-08 01:09 出处:网络
I am looking to create a windows form that contains a tree view of data that I have in excel. I have the wi开发者_JAVA技巧ndows form I am just trying to figure out how to export the excel data into th

I am looking to create a windows form that contains a tree view of data that I have in excel. I have the wi开发者_JAVA技巧ndows form I am just trying to figure out how to export the excel data into that data tree. Any links?


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();
}
0

精彩评论

暂无评论...
验证码 换一张
取 消