在使用前首先声明一点,EPPlus.core已被弃用,使用EPPLus。
![2789632-15f34e0e8bf48c99.png](https://i-blog.csdnimg.cn/blog_migrate/0eaf831cd7b3c67e4f2facee6a5dd0b1.png)
1. 下载EPPLus 4.5.3.2
![2789632-4a90e75ba5e2c20c.png](https://i-blog.csdnimg.cn/blog_migrate/4bf6c90fd2b55c8212e942adf918cff8.png)
2. 创建.xlsx文件
class Program
{
static void Main(string[] args)
{
var path = @"D:\Test\Test.xlsx";
FileInfo fileInfo = new FileInfo(path);
using (var package = new ExcelPackage(fileInfo))
{
var sheet = package.Workbook.Worksheets.Add("TestSheet");
sheet.Cells[1, 1].Value = "Hello World";
package.Save();
}
}
}
对比空项目,看看EPPLus引入了哪些东西:
![2789632-d1345b959ac8b621.png](https://i-blog.csdnimg.cn/blog_migrate/6bce78ab27008776a9310a43ab42d001.png)
引用
![2789632-fe8926ad08ec5608.png](https://i-blog.csdnimg.cn/blog_migrate/5a9b330b221dac8df7209273caf22074.png)