- 浏览: 16875 次
- 性别:
- 来自: 广州
最新评论
Use Jar:
poi-3.14-20160307.jar
poi-ooxml-3.14-20160307.jar
poi-ooxml-schemas-3.14-20160307.jar
mlbeans-2.6.0.jar
poi-3.14-20160307.jar
poi-ooxml-3.14-20160307.jar
poi-ooxml-schemas-3.14-20160307.jar
mlbeans-2.6.0.jar
try { XSSFWorkbook workbook = new XSSFWorkbook(); XSSFSheet sheet = workbook.createSheet("sheet1"); XSSFRow row = sheet.createRow(0); XSSFFont font = workbook.createFont(); font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD); // Set font into style XSSFCellStyle style = workbook.createCellStyle(); style.setFont(font); XSSFCell cellNo = row.createCell(0); cellNo.setCellValue("No"); cellNo.setCellStyle(style); XSSFCell cellSeq = row.createCell(1); cellSeq.setCellValue("Seq"); cellSeq.setCellStyle(style); XSSFCell cellDocId = row.createCell(2); cellDocId.setCellValue("DocId"); cellDocId.setCellStyle(style); XSSFCell cellBrand = row.createCell(3); cellBrand.setCellValue("Brand"); cellBrand.setCellStyle(style); XSSFCell cellPubName = row.createCell(4); cellPubName.setCellValue("Pub Name"); cellPubName.setCellStyle(style); XSSFCell cellDateTime = row.createCell(5); cellDateTime.setCellValue("Date Time"); cellDateTime.setCellStyle(style); XSSFCell cellHeadline = row.createCell(6); cellHeadline.setCellValue("Headline"); cellHeadline.setCellStyle(style); XSSFCell cellContent = row.createCell(7); cellContent.setCellValue("Content"); cellContent.setCellStyle(style); XSSFCell cellLink = row.createCell(8); cellLink.setCellValue("链接"); cellLink.setCellStyle(style); XSSFCell cellAuthor = row.createCell(9); cellAuthor.setCellValue("消费者"); cellAuthor.setCellStyle(style); XSSFCell cellUrl = row.createCell(10); cellUrl.setCellValue("消费者Url"); cellUrl.setCellStyle(style); XSSFCell cellRegion = row.createCell(11); cellRegion.setCellValue("省份"); cellRegion.setCellStyle(style); XSSFCell cellCity = row.createCell(12); cellCity.setCellValue("城市"); cellCity.setCellStyle(style); int count = 1; for(LorealReportBean dongfong : dongfongList){ row = sheet.createRow(count); cellNo = row.createCell(0); cellNo.setCellValue(count); cellSeq = row.createCell(1); cellSeq.setCellValue(dongfong.getSeq()); cellDocId = row.createCell(2); cellDocId.setCellValue(dongfong.getDocId()); cellBrand = row.createCell(3); cellBrand.setCellValue(dongfong.getBrand()); cellPubName = row.createCell(4); cellPubName.setCellValue(dongfong.getPubname()); cellDateTime = row.createCell(5); cellDateTime.setCellValue(dongfong.getPubDate()); cellHeadline = row.createCell(6); cellHeadline.setCellValue(dongfong.getHeadline()); cellContent = row.createCell(7); cellContent.setCellValue(dongfong.getContent()); cellLink = row.createCell(8); cellLink.setCellValue(dongfong.getLink()); cellAuthor = row.createCell(9); cellAuthor.setCellValue(dongfong.getAuthor()); cellUrl = row.createCell(10); cellUrl.setCellValue(dongfong.getUrl()); cellRegion = row.createCell(11); cellRegion.setCellValue(dongfong.getRegion()); cellCity = row.createCell(12); cellCity.setCellValue(dongfong.getCity()); count ++; } FileOutputStream fileOutputStream = new FileOutputStream("C:/tmp/dongfong.xlsx"); workbook.write(fileOutputStream); fileOutputStream.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); }
发表评论
-
Maven install problem: Unexpected end of ZLIB input stream。
2018-03-08 12:58 596Maven install problem: Unexpect ... -
Call a java class from
2018-03-07 15:40 222中華人民共和國 -
Image Process
2017-10-31 09:08 161<div class="iteye-blog- ... -
mysql 存入 blob类型数据
2016-09-30 14:25 938String content = new String(bl ... -
java send email
2016-08-08 00:47 277static int port = 25; //smt ... -
phantomjs & casperjs install in l Fedora
2016-08-06 22:33 287phantomjs install in Fedora: ... -
Json String to Bean
2016-08-03 18:10 259<div class="iteye-blog- ... -
Java Read Html
2016-07-28 14:37 326Need Jar: jsoup-1.8.1.jar ... -
HttpClient Call Website
2016-07-28 14:14 342Need Jar: htmlunit-2.17-OSGi.j ... -
show process in mysql
2016-07-22 11:55 296SELECT * FROM INFORMATION_SCHEM ... -
Java to Excel
2016-07-15 16:14 268Java to Excel https://poi.apach ... -
HttpClient
2016-06-22 10:17 255Remark: set userAgent package ... -
Hibernate3 dynamicUpdate
2016-06-22 10:07 259@org.hibernate.annotations.Ent ... -
解決多線程派任務問題
2016-01-08 18:06 367解決多線程派任務問題: 使用: 每次只update 一條 ... -
daysBetween
2015-12-23 09:27 230public int daysBetween(Strin ... -
IntelliJ Idea – How to enable zoom of text by CTRL + Mouse wheel
2015-11-22 17:53 473IntelliJ Idea – How to ... -
List do sorting
2015-11-20 09:51 282Collections.sort(newList,new ... -
select multi tables join ---Hibernate
2015-10-29 14:05 601String hql = "from A a,B ... -
css 控制第二行字段縮進
2015-09-22 11:55 1155<div style="margin-left ... -
Hibernate: lazy load.
2015-08-05 12:27 371About lazy load, before you to ...
相关推荐
java excel中表格导成png图片,整理供大家参考
java实现将xls或者xlsx文件转成csv文件
This is the home page of Java Excel API - open source Java API which allows Java developers to read Excel spreadsheets and to generate Excel spreadsheets dynamically. In addition, it contains a ...
java jxl 通过excel模板创建新文件并将数据导入excel,实现按行、列插入数据
使用java版excel操作api实现excel读取并转转为html,转换后的文件包含边框线、背景色、字体、字号、列宽等样式处理。
这款EXCEL转换HTML利用PIO万能转换,来源与CSDN网上资源,我只是吧所有JAR包和程序源码放在一起便于快速开发测试使用。本人测试整理好用。
java上传并读取excel工具类 涉及到MultiFile转FIle 以及多个sheet页
该技术从国外某网站上整合而来,仅供参考,勉强可以,但仍需完善
java 实现wordpptexcel转换成html 都是经过测试的可放心使用
Java读取Word中的表格(Excel),并导出文件为Excel
Apache POI是一个开源的Java读写Excel、WORD等微软OLE2组件文档的项目。目前POI已经有了Ruby版本。 结构: •HSSF - 提供读写Microsoft Excel XLS格式档案的功能。 •XSSF - 提供读写Microsoft Excel OOXML XLSX...
解析2007及以上使用XSSFWorkbook, 如果解析类与excel版本不对应,抛出相应的异常,例如HSSFWorkbook解析2007: org.apache.poi.poifs.filesystem.OfficeXmlFileException: The supplied data appears to be in the...
java实现在线预览,将word,excel转换成html
use the .jxl to print simple Excel from database
java word(doc docx excel) to pdf, maven代码 主要是aspose 这个jar公共仓库下载不到 需要去aspose的私有仓库下载 地址:https://repository.aspose.com/repo
用java实现将excel中的数据导入数据库中,我所做的是一个题库
玛文< dependency> < groupId>com.github.ckpoint</ groupId> < artifactId>toexcel</ artifactId> < version>1.0.3</ version></ dependency>2.梯度 compile group : ' com.github.ckpoint ' , name : ' toexcel '...
java OpenOffice wordExcel转换PDF.zip 带jar包
java POI完整示例,POI将word转HTML,数据库倒出数据到Excel等
How to read excel file in JAVA