sheet
2013-12-04 16:44
337 查看
DataTable dt = bbbll.GetListPageStoreProcedure(1, 10000, "[user],wallet,user2", strwhere, "level_Id desc", selectdate, out Counts);
HSSFWorkbook workbook = new HSSFWorkbook();//创建工作表
HSSFSheet sheet= workbook.CreateSheet("第一页");//
HSSFRow rowhead = sheet.CreateRow(0);
rowhead.CreateCell(0).SetCellValue("时间");
rowhead.CreateCell(1).SetCellValue("会员姓名");
rowhead.CreateCell(2).SetCellValue("注册会员");
rowhead.CreateCell(3).SetCellValue("会员等级");
//rowhead.CreateCell(4).SetCellValue("经手人");
rowhead.CreateCell(4).SetCellValue("直推人");
rowhead.CreateCell(5).SetCellValue("安置人");
rowhead.CreateCell(6).SetCellValue("领导奖");
rowhead.CreateCell(7).SetCellValue("直推奖");
rowhead.CreateCell(8).SetCellValue("碰值奖");
for (int rowindex = 1; rowindex <= dt.Rows.Count; rowindex++)
{
HSSFRow row = sheet.CreateRow(rowindex);
for (int cellindex = 0; cellindex < 9; cellindex++)
{
row.CreateCell(cellindex).SetCellValue(dt.Rows[rowindex-1][cellindex].ToString());
}
}
//创建一个文档流对象
using (FileStream fs = new FileStream(@"d:\奖金资料.xls", FileMode.Create))
{
workbook.Write(fs); //将内存的文档对象写入到文档流中
}
MessageBox.Show(this, "下载成功放在d盘目录下");
HSSFWorkbook workbook = new HSSFWorkbook();//创建工作表
HSSFSheet sheet= workbook.CreateSheet("第一页");//
HSSFRow rowhead = sheet.CreateRow(0);
rowhead.CreateCell(0).SetCellValue("时间");
rowhead.CreateCell(1).SetCellValue("会员姓名");
rowhead.CreateCell(2).SetCellValue("注册会员");
rowhead.CreateCell(3).SetCellValue("会员等级");
//rowhead.CreateCell(4).SetCellValue("经手人");
rowhead.CreateCell(4).SetCellValue("直推人");
rowhead.CreateCell(5).SetCellValue("安置人");
rowhead.CreateCell(6).SetCellValue("领导奖");
rowhead.CreateCell(7).SetCellValue("直推奖");
rowhead.CreateCell(8).SetCellValue("碰值奖");
for (int rowindex = 1; rowindex <= dt.Rows.Count; rowindex++)
{
HSSFRow row = sheet.CreateRow(rowindex);
for (int cellindex = 0; cellindex < 9; cellindex++)
{
row.CreateCell(cellindex).SetCellValue(dt.Rows[rowindex-1][cellindex].ToString());
}
}
//创建一个文档流对象
using (FileStream fs = new FileStream(@"d:\奖金资料.xls", FileMode.Create))
{
workbook.Write(fs); //将内存的文档对象写入到文档流中
}
MessageBox.Show(this, "下载成功放在d盘目录下");
相关文章推荐
- BZOJ 2752 高速公路(road)(线段树)
- linux下磁盘报警脚本
- RadioButton总结
- Android TextView使用HTML处理字体样式、显示图片等
- linux下mysql的root密码忘记解决方
- SequenceInputStream----合并流
- Oracle rpad函数和lpad函数
- c#和JS数据加密
- Yii中的CCheckBoxColumn在widget中的用法
- 纯css的防止图片撑破页面的代码(图片自动缩放)
- HDU 4747 Mex(线段树)
- 使用Xcode和Instruments调试解决iOS内存泄露
- shell 往awk 中传值
- Android 圆形 ImageView
- AndroidAnnotations——Enhance custom classes 优化自定义类
- 排序是我曾经的朋友
- 【CCS仿真】用matlab把CCS保存的32位16进制的数据转换为十进制的数
- wpf 自定义窗口,最大化时不覆盖任务栏
- CyberArticle(网文快捕)上传文件提示‘许可不足’
- 花名册