资源简介
NPOI 根据模版导出Excel
编写一次后台方法后
可以使用N套模版进行任意数据的导出。

代码片段和文件信息
/* ====================================================================
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License Version 2.0
(the “License“); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing software
distributed under the License is distributed on an “AS IS“ BASIS
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==================================================================== */
/* ================================================================
* Author: Tony Qu
* Author‘s email: tonyqus (at) gmail.com
* NPOI HomePage: http://www.codeplex.com/npoi
* Contributors:
*
* ==============================================================*/
using System;
using System.Text;
using System.IO;
using NPOI.HSSF.UserModel;
using NPOI.HPSF;
using NPOI.POIFS.FileSystem;
using System.Collections.Generic;
using System.Diagnostics;
namespace GenerateXlsFromXlsTemplate
{
class Program
{
static HSSFWorkbook hssfworkbook;
static void Main(string[] args)
{
Stopwatch sw = new Stopwatch();
sw.Start();
InitializeWorkbook();
HSSFSheet sheet1 = hssfworkbook.GetSheet(“诸城版“);
#region 模拟数据
List dateList = new List();
#region 日期列表
dateList.Add(“2011-12-14“);
dateList.Add(“2011-12-15“);
dateList.Add(“2011-12-16“);
dateList.Add(“2011-12-17“);
dateList.Add(“2011-12-18“);
dateList.Add(“2011-12-19“);
dateList.Add(“2011-12-20“);
dateList.Add(“2011-12-21“);
dateList.Add(“2011-12-22“);
dateList.Add(“2011-12-23“);
dateList.Add(“2011-12-24“);
dateList.Add(“2011-12-25“);
dateList.Add(“2011-12-26“);
dateList.Add(“2011-12-27“);
dateList.Add(“2011-12-28“);
dateList.Add(“2011-12-29“);
dateList.Add(“2011-12-30“);
dateList.Add(“2011-12-31“);
#endregion
List companyList = new List();
#region 分公司列表
companyList.Add(“headquarter“);
companyList.Add(“gaoxin“);
companyList.Add(“kuiwen“);
companyList.Add(“weicheng“);
companyList.Add(“shouguang“);
companyList.Add(“lechang“);
companyList.Add(“linqu
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 11264 2011-12-14 09:42 GenerateXlsFromXlsTemplate\bin\Debug\GenerateXlsFromXlsTemplate.exe
文件 19968 2011-12-14 09:42 GenerateXlsFromXlsTemplate\bin\Debug\GenerateXlsFromXlsTemplate.pdb
文件 11608 2011-12-14 09:42 GenerateXlsFromXlsTemplate\bin\Debug\GenerateXlsFromXlsTemplate.vshost.exe
文件 490 2010-03-17 22:39 GenerateXlsFromXlsTemplate\bin\Debug\GenerateXlsFromXlsTemplate.vshost.exe.manifest
文件 192512 2009-05-13 08:56 GenerateXlsFromXlsTemplate\bin\Debug\ICSharpCode.SharpZipLib.dll
文件 91648 2009-05-18 13:15 GenerateXlsFromXlsTemplate\bin\Debug\NPOI.DDF.dll
文件 9728 2009-05-13 09:00 GenerateXlsFromXlsTemplate\bin\Debug\NPOI.dll
文件 53248 2009-05-13 09:00 GenerateXlsFromXlsTemplate\bin\Debug\NPOI.HPSF.dll
文件 921600 2009-05-30 13:04 GenerateXlsFromXlsTemplate\bin\Debug\NPOI.HSSF.dll
文件 48640 2009-05-13 09:00 GenerateXlsFromXlsTemplate\bin\Debug\NPOI.POIFS.dll
文件 33792 2009-05-13 09:00 GenerateXlsFromXlsTemplate\bin\Debug\NPOI.Util.dll
文件 680448 2011-12-13 18:18 GenerateXlsFromXlsTemplate\bin\Debug\template\导出模板.xls
文件 1073152 2011-12-13 18:19 GenerateXlsFromXlsTemplate\bin\Debug\test.xls
文件 5195 2011-12-14 09:30 GenerateXlsFromXlsTemplate\GenerateXlsFromXlsTemplate.csproj
文件 452 2011-04-27 09:09 GenerateXlsFromXlsTemplate\GenerateXlsFromXlsTemplate.csproj.user
文件 142 2011-05-09 21:47 GenerateXlsFromXlsTemplate\GenerateXlsFromXlsTemplate.csproj.vs10x
文件 257 2009-05-13 09:02 GenerateXlsFromXlsTemplate\GenerateXlsFromXlsTemplate.csproj.vspscc
文件 941 2011-12-14 09:21 GenerateXlsFromXlsTemplate\GenerateXlsFromXlsTemplate.sln
..A..H. 15872 2011-12-14 09:32 GenerateXlsFromXlsTemplate\GenerateXlsFromXlsTemplate.suo
文件 5812 2011-12-14 09:42 GenerateXlsFromXlsTemplate\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 3713 2011-12-14 09:42 GenerateXlsFromXlsTemplate\obj\Debug\GenerateXlsFromXlsTemplate.csproj.FileListAbsolute.txt
文件 11264 2011-12-14 09:42 GenerateXlsFromXlsTemplate\obj\Debug\GenerateXlsFromXlsTemplate.exe
文件 19968 2011-12-14 09:42 GenerateXlsFromXlsTemplate\obj\Debug\GenerateXlsFromXlsTemplate.pdb
文件 42369 2011-12-14 09:41 GenerateXlsFromXlsTemplate\obj\Debug\ResolveAssemblyReference.cache
文件 17479 2011-12-14 09:46 GenerateXlsFromXlsTemplate\Program.cs
文件 1464 2009-05-13 07:54 GenerateXlsFromXlsTemplate\Properties\AssemblyInfo.cs
文件 680448 2011-12-14 09:55 GenerateXlsFromXlsTemplate\template\template.xls
目录 0 2011-12-14 09:44 GenerateXlsFromXlsTemplate\bin\Debug\template
目录 0 2011-04-27 09:08 GenerateXlsFromXlsTemplate\obj\Debug\TempPE
目录 0 2011-12-14 09:41 GenerateXlsFromXlsTemplate\bin\Debug
............此处省略10个文件信息
- 上一篇:NACA系列翼型数据库
- 下一篇:Procmon软件
相关资源
- 先进先出库存管理excel表格.rar
- [免费]强大的OFFICE经验(Word Excel)
- ICD10 excel
-
分别适用于.NET fr
amework 2.0和4.0的E - K码和经纬度转换excel表格
- Php 导出数据为EXCEL程序
- 项目周报格式(excel格式报表)
- 一个基于MFC的GridCtrl,提供类似Excel的
- EXCEL横转竖(列转行)宏
- Excel高效办公实例
- 湖南省计算机等级二级考试excel题集锦
- EXCEL文件转换成固定的格式的文本格式
- 从EXCEL中取数据在Teechart7显示应用示例
- excel VBA 800(全)
- 易语言Excel多表对应处理源码
- 易语言EXCEL另存为CSV文件源码
- EXCEL函数手册.chm格式
- Excel修复精灵中文免费版2009
- DataNumen Excel Repair Excel文件修复工具
- vue实现导出Excel的两个js文件-Blob+Exp
- Blob.js+Export2Excel.js
- LibXL for Windows 3.8.3 最新版Excel操作库带
- EXCEL 甘特图模板
- 项目开发计划与跟踪汇总表模板
- 中文版excel2007 图表宝典(光盘附件)
- 嵌入式工程师周报 项目管理 甘特图
- Ubuntu下操作Excel,qt代码
- Labwindows/CVI下Excel打开、读写操作
- 易语言导入EXCEL到EDB数据库源码
- 汉字转拼音或首字母小工具 Excel方便
评论
共有 条评论