NPOI设置单元格背景色在网上有好多例子都是设置为NPOI内置的颜色值 但是想用rgb值来设置背景色,即:通过HSSFPalette类获取颜色值时会抛出异常:Could not Find free color index 比如:http://www.cnblogs.com/yxhblog/p/6225018.html 最后找到 这个实现后才知道需要额外设置一步 http://www.cnblogs.com/huxiaolin/p/4813518.html 简化后代码如下: private voi
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using NPOI.HSSF.UserModel; using NPOI.SS.Formula.Eval; using NPOI.SS.Formula.Functions; using NPOI.SS.UserModel; using NPOI.XSSF.UserM
1.日期格式的坑 var cell = row.GetCell(i);//获取某一个单元格 var value = ""; if (cell != null) { if (cell.CellType == CellType.Numeric)//当单元格格式是数值或者日期的时候,CellType==Numeric { value = cell.ToString();//如果是数值还好,如果是日期类型的话,直接获取的值是不正确的 if (DateUtil.IsCellDateFormatt
C#操作Excel方法有很多,以前用的需要电脑安装office才能用,但因为版权问题公司不允许安装office.所以改用NPOI进行Excel操作,基本上一些简单的Excel操作都没有问题,读写合并单元格等都能实现. NPOI 库下载地址 命名空间: using NPOI; using NPOI.XSSF.UserModel; using NPOI.SS.UserModel; using NPOI.HSSF.UserModel; using NPOI.HSSF.Util; 简单的保存数据: pu
我们可以从一个表中复制所有的列插入到另一个已存在的表中: INSERT INTO table2SELECT * FROM table1; 或者我们可以只复制希望的列插入到另一个已存在的表中: INSERT INTO table2(column_name(s))SELECT column_name(s)FROM table1; 1.bin bin目录用来保存项目生成后程序集,它有Debug和Release两个版本,分别对应的文件夹为bin/Debug和bin/Release,