- 浏览: 39104 次
- 性别:
- 来自: 北京
最新评论
excel
- 博客分类:
- java 后台
HSSFSheet sheet = workbook.createSheet("sheetName"); //创建sheet
sheet.setVerticallyCenter(true);
//下面样式可作为导出左右分栏的表格模板
sheet.setColumnWidth((short) 0, (short) 2600);// 设置列宽
sheet.setColumnWidth((short) 1, (short) 2400);
sheet.setColumnWidth((short) 2, (short) 2300);
sheet.setColumnWidth((short) 3, (short) 1600);
sheet.setColumnWidth((short) 4, (short) 1800);
sheet.setColumnWidth((short) 5, (short) 1000);// 空列设置小一些
sheet.setColumnWidth((short) 6, (short) 2600);// 设置列宽
sheet.setColumnWidth((short) 7, (short) 2400);
sheet.setColumnWidth((short) 8, (short) 2300);
sheet.setColumnWidth((short) 9, (short) 1600);
sheet.setColumnWidth((short) 10, (short) 1800);
HSSFCellStyle cellstyle = (HSSFCellStyle) workbook.createCellStyle();// 设置表头样式
cellstyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);// 设置居中
HSSFCellStyle headerStyle = (HSSFCellStyle) workbook .createCellStyle();// 创建标题样式
headerStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); //设置垂直居中
headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); //设置水平居中
HSSFFont headerFont = (HSSFFont) workbook.createFont(); //创建字体样式
headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); // 字体加粗
headerFont.setFontName("Times New Roman"); //设置字体类型
headerFont.setFontHeightInPoints((short)8); //设置字体大小
headerStyle.setFont(headerFont); //为标题样式设置字体样式
HSSFCellStyle headerStyle1 = (HSSFCellStyle) workbook .createCellStyle();// 创建标题样式1
headerStyle1.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
headerStyle1.setAlignment(HSSFCellStyle.ALIGN_CENTER);
HSSFFont headerFont1 = (HSSFFont) workbook.createFont();
headerFont1.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);// 字体加粗
headerFont1.setFontName("Times New Roman");
headerFont1.setFontHeightInPoints((short)8);
headerStyle1.setFont(headerFont1);
HSSFCellStyle headerStyle2 = (HSSFCellStyle) workbook .createCellStyle();// 创建标题样式2
headerStyle2.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
headerStyle2.setAlignment(HSSFCellStyle.ALIGN_CENTER);
HSSFFont headerFont2 = (HSSFFont) workbook.createFont();
headerFont2.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);// 字体加粗
headerFont2.setFontName("Times New Roman");
headerFont2.setFontHeightInPoints((short)8);
headerStyle2.setFont(headerFont2);
headerStyle2.setBorderBottom(HSSFCellStyle.BORDER_THIN); // 下边框
headerStyle2.setBorderLeft(HSSFCellStyle.BORDER_THIN);// 左边框
headerStyle2.setBorderTop(HSSFCellStyle.BORDER_THIN);// 上边框
headerStyle2.setBorderRight(HSSFCellStyle.BORDER_THIN);// 右边框
HSSFCellStyle cell_Style = (HSSFCellStyle) workbook .createCellStyle();// 设置字体样式
cell_Style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
cell_Style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);// 垂直对齐居中
cell_Style.setWrapText(true); // 设置为自动换行
HSSFFont cell_Font = (HSSFFont) workbook.createFont();
cell_Font.setFontName("宋体");
cell_Font.setFontHeightInPoints((short)8);
cell_Style.setFont(cell_Font);
cell_Style.setBorderBottom(HSSFCellStyle.BORDER_THIN); // 下边框
cell_Style.setBorderLeft(HSSFCellStyle.BORDER_THIN);// 左边框
cell_Style.setBorderTop(HSSFCellStyle.BORDER_THIN);// 上边框
cell_Style.setBorderRight(HSSFCellStyle.BORDER_THIN);// 右边框
HSSFRow row = sheet.createRow((short)1); //创建行
HSSFCell cell = row.createCell((short)1); //创建列
cell.setCellStyle(headerStyle2); //单元格引用样式
sheet.setVerticallyCenter(true);
//下面样式可作为导出左右分栏的表格模板
sheet.setColumnWidth((short) 0, (short) 2600);// 设置列宽
sheet.setColumnWidth((short) 1, (short) 2400);
sheet.setColumnWidth((short) 2, (short) 2300);
sheet.setColumnWidth((short) 3, (short) 1600);
sheet.setColumnWidth((short) 4, (short) 1800);
sheet.setColumnWidth((short) 5, (short) 1000);// 空列设置小一些
sheet.setColumnWidth((short) 6, (short) 2600);// 设置列宽
sheet.setColumnWidth((short) 7, (short) 2400);
sheet.setColumnWidth((short) 8, (short) 2300);
sheet.setColumnWidth((short) 9, (short) 1600);
sheet.setColumnWidth((short) 10, (short) 1800);
HSSFCellStyle cellstyle = (HSSFCellStyle) workbook.createCellStyle();// 设置表头样式
cellstyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);// 设置居中
HSSFCellStyle headerStyle = (HSSFCellStyle) workbook .createCellStyle();// 创建标题样式
headerStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); //设置垂直居中
headerStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); //设置水平居中
HSSFFont headerFont = (HSSFFont) workbook.createFont(); //创建字体样式
headerFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); // 字体加粗
headerFont.setFontName("Times New Roman"); //设置字体类型
headerFont.setFontHeightInPoints((short)8); //设置字体大小
headerStyle.setFont(headerFont); //为标题样式设置字体样式
HSSFCellStyle headerStyle1 = (HSSFCellStyle) workbook .createCellStyle();// 创建标题样式1
headerStyle1.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
headerStyle1.setAlignment(HSSFCellStyle.ALIGN_CENTER);
HSSFFont headerFont1 = (HSSFFont) workbook.createFont();
headerFont1.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);// 字体加粗
headerFont1.setFontName("Times New Roman");
headerFont1.setFontHeightInPoints((short)8);
headerStyle1.setFont(headerFont1);
HSSFCellStyle headerStyle2 = (HSSFCellStyle) workbook .createCellStyle();// 创建标题样式2
headerStyle2.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);
headerStyle2.setAlignment(HSSFCellStyle.ALIGN_CENTER);
HSSFFont headerFont2 = (HSSFFont) workbook.createFont();
headerFont2.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);// 字体加粗
headerFont2.setFontName("Times New Roman");
headerFont2.setFontHeightInPoints((short)8);
headerStyle2.setFont(headerFont2);
headerStyle2.setBorderBottom(HSSFCellStyle.BORDER_THIN); // 下边框
headerStyle2.setBorderLeft(HSSFCellStyle.BORDER_THIN);// 左边框
headerStyle2.setBorderTop(HSSFCellStyle.BORDER_THIN);// 上边框
headerStyle2.setBorderRight(HSSFCellStyle.BORDER_THIN);// 右边框
HSSFCellStyle cell_Style = (HSSFCellStyle) workbook .createCellStyle();// 设置字体样式
cell_Style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
cell_Style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);// 垂直对齐居中
cell_Style.setWrapText(true); // 设置为自动换行
HSSFFont cell_Font = (HSSFFont) workbook.createFont();
cell_Font.setFontName("宋体");
cell_Font.setFontHeightInPoints((short)8);
cell_Style.setFont(cell_Font);
cell_Style.setBorderBottom(HSSFCellStyle.BORDER_THIN); // 下边框
cell_Style.setBorderLeft(HSSFCellStyle.BORDER_THIN);// 左边框
cell_Style.setBorderTop(HSSFCellStyle.BORDER_THIN);// 上边框
cell_Style.setBorderRight(HSSFCellStyle.BORDER_THIN);// 右边框
HSSFRow row = sheet.createRow((short)1); //创建行
HSSFCell cell = row.createCell((short)1); //创建列
cell.setCellStyle(headerStyle2); //单元格引用样式
发表评论
-
linux 下载并安装Memcache服务器端
2015-07-25 15:50 684下载并安装Memcache服务器端 服务器端主要是安装memc ... -
spring的jar功能说明及个jar包之间的依赖关系
2015-07-24 14:39 350spring.jar是包含有完整发布的单个jar包,sprin ... -
sping
2015-07-07 09:45 540一、简单的用ApplicationContext做测试的话,获 ... -
大型互联网站解决高并发的常见策略
2015-04-10 14:13 654一个运营的系统在正式 ... -
调用存储过程
2012-08-23 09:36 844public void queryProce( final i ... -
在线打开word
2012-06-11 12:59 1309在线打开word . 2010-05-10 17:16 184 ... -
Lucene_3.0_原理与代码分析.
2011-12-09 17:54 677Lucene_3.0_原理与代码分析 -
池链接
2011-11-03 17:34 7471. 线程池是啥子 一说 ... -
JAVA中的IO流.txt
2011-11-03 17:32 932JAVA中的IO流是非常重要的知识点,用于文件内容的写入、读取 ... -
quanxian
2011-05-20 16:18 532quanxian -
Restrictions
2011-05-20 11:23 786Restrictions dev.firnow.com ... -
权限设计
2011-05-20 11:21 658权限设计权限设计 -
struts 跳转 action
2011-05-20 11:20 711<result name="showList& ... -
java
2011-05-11 23:04 531大点javaeye -
md5 加密
2011-05-06 15:56 647md5 加密 -
java 导出 excel
2011-05-04 21:49 998java导出Excel例举方式 方法一:导出Excel数据 ... -
java 读取 Excel
2011-05-02 15:44 645private void initMachine() thro ...
相关推荐
springboot 导出excel 导入excel 生成excel 内容有点多 springboot 导出excel 导入excel 生成excel 内容有点多 springboot 导出excel 导入excel 生成excel 内容有点多 springboot 导出excel 导入excel 生成excel ...
使用UNI-Excel،,您可以创建、编辑和读取Excel文件. 换句话说,您可以将用户评分保存在Excel文件中,并在将来阅读这些信息。 在这个问题上有很多种方法,但每一种方法都有失败的地方。 有些方法无法创建Excel文件,...
excel教材excel教材excel教材excel教材excel教材excel教材excel教材excel教材excel教材
C# 读取加密的Excel 文件; 有源码,VS2010开发。 采用的是微软的Microsoft.Office.Interop.Excel, V14.0,来读取加密后的Excle文件。 不是采用第三方控件NPOI读取加密的Excel文件。 开始研究NPOI读取加密的Excel文件...
txt 转换成excel (2.13版) 0更新(2.18版):http://download.csdn.net/source/2883662 0更新(2.16版):http://download.csdn.net/source/2136915 1快速将txt格式的数据文件转换为excel文件 2后缀名不一定是txt...
Thinkphp5整合excel导入导出Thinkphp5整合excel导入导出Thinkphp5整合excel导入导出Thinkphp5整合excel导入导出Thinkphp5整合excel导入导出Thinkphp5整合excel导入导出Thinkphp5整合excel导入导出Thinkphp5整合excel...
C#的,winform的,这是我自己写的一个c#操作excel的例子,其中包括数据操作,字体,格式,单元格等操作,还有一个生成柱状图的方法,所有的方法都在ExcelHelper.cs类里,点击Form1窗体里的按钮可以看到各种操作的...
各种甘特图Excel模板,项目管理,工作进度,培训进度,计划安排等,不用您自己去制作表格,一批模板供您选择,极大地提高您的工作效率 各种甘特图Excel模板,项目管理,工作进度,培训进度,计划安排等,不用您自己...
工作或学习中可能需要实现基于VC读\写Excel文件的功能,本人最近也遇到了该问题。中间虽经波折,但是最终还是找到了解决问题的办法。 在此跟大家分享,希望对跟我同样迷茫过的同学们有所帮助。 1、程序功能 1...
Written by award-winning educator Wayne Winston, this hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables—and how to effectively build...
Excel源代码,导入导出各种工具类 <groupId>org.apache.poi <artifactId>poi <groupId>org.apache.poi <artifactId>poi-scratchpad 代码实例: String path = ""; byte[] bytes; vo.setCurrentPage(0); vo....
压缩文件中包括一个包含宏代码的Excel文件Sheet Macros.xls以及其他四个测试文件工作表 1~4。 宏的功能为(1)选中Excel表格中的某些行或列,运行某个Macro,自动根据选中的cells创建新的worksheets,worksheets的...
C#使用DataGridView绑定Excel,然后让用户选择Excel文件的工作表,然后点击DataGridView显示按钮就能绑定选定的工作表。 写这个主要是为了答疑CSDN论坛上一些朋友的疑问,他们想绑定Excel文件,而有不知道工作表的...
包含:创建Excel文件、打开Excel文件、创建表、设置是否显示 “是否保存对文件的修改”的对话框、设置指定列的列宽、设置自动适应列宽、设置当前活动表、首行冻结、首行颜色、在指定的行和列显示文本、合并单元格、...
Professor Excel Tools Premium(Excel教授)是专为微软Excel和国产WPS Office中的表格软件量身定做的一款专家级excel插件工具箱,内置多达125个超级实用的Excel函数极大的扩展强化了Excel表格的功能,强大的复制...
java操纵excel的jar包
Java编程调用PageOffice实现从空白的excel文件动态生成excel表格,设置公式并填充数据。 集成PageOffice不但能够实现在线编辑、保存真正的Office文档,而且还可以轻松实现Word、Excel文档的动态数据填充、格式控制和...
Dose for Excel 是一款增强型excel插件工具箱软件,包含Excel表格比较、自动备份、空间修剪等超过100个全新且实用的功能,全面兼容Excel 2019/2016/2013/2010/2007/Office 365等主流版本的Excel,可谓是excel最牛...
网络上能够找到的Excel导出文件为Excel9,是Office2000的,版本较老。现从Excel2003中导出新的头文件:Excel11.h,Excel11.cpp
绝对原创,这是我在项目中解决大数据Excel导入时内存溢出问题而编写的Excel行级解析器。同时支持Excel-2003和Excel-2007,excel-2003解析采用poi的eventusermodel模式实现,2007采用xmlreader实现,经项目验证,...