npoi设置数据有效性
npoi设置数据有效性
public void SetDataValidate(ISheet sheet, int firstCol, int lastCol)
{
CellRangeAddressList regions = new CellRangeAddressList(1, 65535, firstCol, lastCol);
DVConstraint constraint = DVConstraint.CreateDateConstraint(
(int)ComparisonOperator.Between, "1900-01-01", "2999-12-31", "yyyy-MM-dd");
HSSFDataValidation dataValidate = new HSSFDataValidation(regions, constraint);
dataValidate.EmptyCellAllowed = false;
dataValidate.CreateErrorBox("错误提示", "请输入日期'yyyy年MM月dd日'"); sheet.AddValidationData(dataValidate);
}
npoi设置数据有效性的更多相关文章
- poi操作excel设置数据有效性
private void setDataValidationList(short firstRow,short endRow,short firstCol, short endCol,String d ...
- NPOI设置单元格背景色
NPOI设置单元格背景色在网上有好多例子都是设置为NPOI内置的颜色值 但是想用rgb值来设置背景色,即:通过HSSFPalette类获取颜色值时会抛出异常:Could not Find free c ...
- NPOI设置Excel保护
有时,我们可能需要某些单元格只读,如在做模板时,模板中的数据是不能随意让别人改的.在Excel中,可以通过“审阅->保护工作表”来完成,如下图: 那么,在NPOI中有没有办法通过编码的方式达到 ...
- Excel设置数据有效性实现单元格下拉菜单的3种方法(转)
http://blog.csdn.net/cdefu/article/details/4129136 一.直接输入: 1.选择要设置的单元格,譬如A1单元格: 2.选择菜单栏的“数据”→“有效性”→出 ...
- NPOI设置单元格格式
转自:http://www.cr173.com/html/18143_2.html //创建一个常用的xls文件 private void button3_Click(object sender, E ...
- NPOI设置Excel单元格字体、边框、对齐、背景色
代码: ICellStyle cellStyle = workbook.CreateCellStyle(); cellStyle.BorderBottom = BorderStyle.Thin; ce ...
- NPOI 设置导出的excel内容样式
导出excel时,有时要根据需要加上一些样式,以上几种样式是我在项目中用到的 一.给单元格加背景色只需两步:一是创建单元格背景景色对象:二是给单元格绑定样式 //创建单元格背景颜色对象 HSSFPal ...
- npoi 设置单元格格式
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- NPOI设置水平、垂直居中
C#语法: string fs = "@report.xls";//文件路径 FileStream excelPath = File.Open(@fs, FileMode.Open ...
随机推荐
- react native 中es6语法解析
react native是直接使用es6来编写代码,许多新语法能提高我们的工作效率 解构赋值 var { StyleSheet, Text, View } = React; 这句代码是ES6 中新增的 ...
- 118/119. Pascal's Triangle/II
原文题目: 118. Pascal's Triangle 119. Pascal's Triangle II 读题: 杨辉三角问题 '''118''' class Solution(object): ...
- replace()方法解析
search(),match(),用于查找指定字符串返回首次出现的索引值与指定的字符串.这篇我们讲找到指定字符串之后将其替换掉.直接贴: var str="Visit Microsoft!& ...
- linux下json工具jq
1.查看json文件 [root@VM-1-10-11 f46c19f56252a74a46fd30026001e62cc5ecadd04bc9a80c47f6fd5f9dc0586b]# pwd / ...
- C# 监测每个方法的执行次数和占用时间(测试2)
在Nuget引用 Castle.DynamicProxy 和 Newtonsoft.Json 这个 原文:http://www.cnblogs.com/RicCC/archive/2010/03/15 ...
- python基础学习Day10 函数形参的动态参数、*args **kwargs 命名空间 global 与 nonlocal
一.函数形参的动态参数 原因:为了拓展,对于实参数量不固定,故需要万能参数,即动态参数, *args **kwargs # def sum1(*args): # 在函数定义时,在*位置参数,聚合. ...
- 解决iframe在iphone不兼容的问题
<div class="scroll-wrapper"> <iframe src="地址"></iframe> </d ...
- wget 报错 OpenSSL: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failur
解决办法 换成 curl -O -L xxxxxxxx
- response.sendfile() fails with Error: Forbidden
[response.sendfile() fails with Error: Forbidden] 参考:https://github.com/expressjs/express/issues/146 ...
- 【python】安装pymongo时出错
在python2.7的环境下,使用pip install pymongo安装模块报以下错误: Could not install packages due to an EnvironmentError ...