读写EXCEL,操作网页DLL

推荐一个很好的开源项目,用于C#读写EXCEL的,在http://npoi.codeplex.com/中下载

例子(读取EXCEL到TABLE):

 using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;      
#region "得到数据的Datatable"
        DataTable Get_ExcelData(Stream fileContent)
        {
            HSSFWorkbook workbook = new HSSFWorkbook(fileContent);
            Sheet sheet = workbook.GetSheetAt(0);

            DataTable table = new DataTable();

            Row headerRow = sheet.GetRow(0);
            int cellCount = headerRow.LastCellNum;

            for (int i = headerRow.FirstCellNum; i < cellCount; i++)
            {
                var objCell = headerRow.GetCell(i);
                if (objCell != null)
                {
                    DataColumn column = new DataColumn(objCell.StringCellValue);
                    table.Columns.Add(column);
                }
                else
                    break;
            }

            int rowCount = sheet.LastRowNum;

            for (int i = (sheet.FirstRowNum + 1); i <= sheet.LastRowNum; i++)
            {
                Row row = sheet.GetRow(i);
                DataRow dataRow = table.NewRow();

                for (int j = row.FirstCellNum; j < table.Columns.Count; j++)
                {
                    if (row.GetCell(j) != null)
                        dataRow[j] = row.GetCell(j).ToString();
                }

                table.Rows.Add(dataRow);
            }

            workbook = null;
            sheet = null;

            return table;
        }
        #endregion

另外一个开源项目是用于C#操作HTML,下载地址:http://htmlagilitypack.codeplex.com/

具体操作方法:http://blog.csdn.net/malimalihun/article/details/6683434

原文地址:https://www.cnblogs.com/Journey31/p/3107778.html