C# 读写excel 用于导入数据库 批量导入导出excel

给大家介绍一款控件,Aspose.Cells.dll,相当强大,几乎就是excel,支持excel2003,excel2007等格式文件。excel2010以上,没有经过测试,估计也是可以。

Aspose.Cells.LoadOptions opt = null;
                    if (ext == "XLS")
                    {
                        opt = new Aspose.Cells.LoadOptions(Aspose.Cells.LoadFormat.Excel97To2003);
                    }
                    else if (ext == "XLSX")
                    {
                        opt = new Aspose.Cells.LoadOptions(Aspose.Cells.LoadFormat.Xlsx);
                    }
                    else
                    {
                        opt = new Aspose.Cells.LoadOptions(Aspose.Cells.LoadFormat.Excel97To2003);
                    }
                    ImportExcelName = uploadFolder + ImportExcelName;
                    Aspose.Cells.Workbook wb = null;
                    //读取EXCEL文件
                    try
                    {
                        wb = new Aspose.Cells.Workbook(ImportExcelName, opt);
                    }
                    catch
                    {
                        resultDict.Add("IsSuccess", false);
                        resultDict.Add("_msg", "不是标准的Excel,请确认!");
                        return resultDict;
                    }

偕行软件欢迎您光临我们的博客

我们致力于打造国内第一个支持直接在线演示的人力资源管理系统!

我们的官网:http://www.udchn.com

我们的空白开发框架:http://60.211.233.210:8088

我们的集团式人力资源管理系统:http://60.211.233.210:8081

原文地址:https://www.cnblogs.com/udsoft/p/3290308.html