资源简介
Spring+Mybatis+Druid+POI示例整合demo
代码片段和文件信息
package com.mengdee.manager.controller;
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellstyle;
import org.apache.poi.hssf.usermodel.HSSFFont;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.FillPatternType;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import org.apache.poi.ss.usermodel.VerticalAlignment;
import org.apache.poi.ss.util.CellRangeAddress;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import com.mengdee.manager.domain.User;
import com.mengdee.manager.service.UserService;
@Controller
@RequestMapping(“/user“)
public class UserController {
@Autowired
private UserService userService;
@RequestMapping(“/list“)
public String getUserList(){
List userList = userService.getUserList();
for (User user : userList) {
System.out.println(user);
}
return “index“;
}
@SuppressWarnings(“resource“)
@RequestMapping(“/export“)
public void exportExcel(HttpServletResponse response HttpSession session String name) throws Exception {
String[] tableHeaders = {“id“ “姓名“ “年龄“};
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet(“Sheet1“);
HSSFCellstyle cellstyle = workbook.createCellstyle();
cellstyle.setAlignment(HorizontalAlignment.CENTER);
cellstyle.setVerticalAlignment(VerticalAlignment.CENTER);
cellstyle.setFillPattern(FillPatternType.DIAMONDS);
cellstyle.setFillForegroundColor(HSSFColor.BLUE.index);
cellstyle.setFillBackgroundColor(HSSFColor.LIGHT_YELLOW.index);
cellstyle.setBottomBorderColor(HSSFColor.DARK_RED.index);
Font font = workbook.createFont();
font.setColor(HSSFColor.RED.index);
font.setBold(true);
font.setItalic(true);
font.setUnderline(HSSFFont.U_SINGLE);
cellstyle.setFont(font);
// 将第一行的三个单元格给合并
sheet.addMergedRegion(new CellRangeAddress(0 0 0 2));
HSSFRow row = sheet.createRow(0);
HSSFCell beginCell = row.createCell(0);
beginCell.setCellValue(“通讯录“);
beginCell.setCellstyle(cellstyle);
row = sheet.createRow(1);
// 创建表头
for (int i = 0; i < tableHeaders.length
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-05-31 09:30 Spring-Mybatis-Druid\
文件 1308 2017-06-05 14:28 Spring-Mybatis-Druid\.classpath
文件 1229 2017-05-31 10:06 Spring-Mybatis-Druid\.project
目录 0 2017-05-31 10:06 Spring-Mybatis-Druid\.settings\
文件 639 2017-05-31 09:30 Spring-Mybatis-Druid\.settings\.jsdtscope
文件 212 2017-06-05 14:16 Spring-Mybatis-Druid\.settings\org.eclipse.core.resources.prefs
文件 430 2017-05-31 09:30 Spring-Mybatis-Druid\.settings\org.eclipse.jdt.core.prefs
文件 90 2017-05-31 09:30 Spring-Mybatis-Druid\.settings\org.eclipse.m2e.core.prefs
文件 701 2017-05-31 10:06 Spring-Mybatis-Druid\.settings\org.eclipse.wst.common.component
文件 252 2017-05-31 09:30 Spring-Mybatis-Druid\.settings\org.eclipse.wst.common.project.facet.core.xm
文件 49 2017-05-31 09:30 Spring-Mybatis-Druid\.settings\org.eclipse.wst.jsdt.ui.superType.container
文件 6 2017-05-31 09:30 Spring-Mybatis-Druid\.settings\org.eclipse.wst.jsdt.ui.superType.name
文件 602 2017-05-31 10:03 Spring-Mybatis-Druid\.settings\org.eclipse.wst.validation.prefs
文件 232 2017-05-31 10:03 Spring-Mybatis-Druid\.settings\org.eclipse.wst.xsl.core.prefs
文件 6962 2017-06-05 15:31 Spring-Mybatis-Druid\pom.xm
目录 0 2017-05-31 09:40 Spring-Mybatis-Druid\src\
目录 0 2017-05-31 09:40 Spring-Mybatis-Druid\src\main\
目录 0 2017-06-03 08:53 Spring-Mybatis-Druid\src\main\java\
目录 0 2017-05-31 09:45 Spring-Mybatis-Druid\src\main\java\com\
目录 0 2017-05-31 09:45 Spring-Mybatis-Druid\src\main\java\com\mengdee\
目录 0 2017-06-03 08:53 Spring-Mybatis-Druid\src\main\java\com\mengdee\manager\
目录 0 2017-05-31 13:48 Spring-Mybatis-Druid\src\main\java\com\mengdee\manager\controller\
文件 4916 2017-06-05 19:37 Spring-Mybatis-Druid\src\main\java\com\mengdee\manager\controller\UserController.java
目录 0 2017-05-31 14:18 Spring-Mybatis-Druid\src\main\java\com\mengdee\manager\dao\
目录 0 2017-05-31 15:12 Spring-Mybatis-Druid\src\main\java\com\mengdee\manager\dao\user\
文件 395 2017-05-31 15:18 Spring-Mybatis-Druid\src\main\java\com\mengdee\manager\dao\user\ba
文件 329 2017-06-02 16:58 Spring-Mybatis-Druid\src\main\java\com\mengdee\manager\dao\user\UserDao.java
目录 0 2017-05-31 10:08 Spring-Mybatis-Druid\src\main\java\com\mengdee\manager\dao\user\impl\
文件 1307 2017-06-02 17:12 Spring-Mybatis-Druid\src\main\java\com\mengdee\manager\dao\user\impl\UserDaoImpl.java
目录 0 2017-06-02 13:38 Spring-Mybatis-Druid\src\main\java\com\mengdee\manager\dao\user\mapper\
文件 414 2017-06-02 13:38 Spring-Mybatis-Druid\src\main\java\com\mengdee\manager\dao\user\mapper\UserEntityMapper.java
............此处省略91个文件信息
- 上一篇:spring+ehcache整合Demo
- 下一篇:mapx40.ocx
相关资源
- 股票价格跳过程为复合Poisson过程的期
- Pointofix 1.80 教鞭工具最新中文版
- dragPoint.vue
-
OfficeOpenxm
lCrypto - 武汉市医院poi电子地图
- SharePointServer2016企业版Enterprise序列号
- ESET_Endpoint_Antivirus_99_user_02.07.2022.rar
- point to circle.zip
- 算法 Point 是否在多边形内
- NPOI的引用
- 使用FME进行网络POI数据抓取
- 使用NPOI操作制作word
- poi实现world文档动态插入表格
- 声明一个类Point,然后利用它声明一个
- FarPoint.Win.Spread.rar
- J2T-Reward Points:magento 最实用的分销积分
- 全国地铁坐标和名称,来源于百度附
- poi excel 模板读取 复制表 复制行且
- POI导入Excel并返回校验后的错误文件原
- POI使用Excel模板文件循环输出行并导出
- POI使用word模板文件循环输出行并导出
- Pointofix.rar
- 全国POI数据
- easypoi 模板导出
- pointCloud
- Checkpoint运维手册
- POI操作手册
- 2016年城市POI数据.rar
- Microsoft.Office.Interop.PowerPoint.rar
- 高博修改的orbslam2带点云程序修改后的
评论
共有 条评论