本篇文章给大家谈谈java报表导出excel模板,以及java导出excel poi对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。
今天给各位分享java报表导出excel模板的知识,其中也会对java导出excel poi进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
本文目录一览:
java导出excel模板列填写时如何不去0
1、报表中的0.XXX导出Excel后0丢失
java报表导出excel模板,变成
java报表导出excel模板了.XXX,如0.5变成.5;
2、报表数据集中数据有存在空和0的数据,在报表显示的时候要求空值不显示,0值显示0,当前都显示为0;
3、横向和纵向分组后,要求没有数据记录的单元格显示为空;
4、整数只显示整数,小数保留一位小数。
问题分析
1、由于导出的Excel单元格类型为”自定义”,该格式下的首0会自动截去,这是正常现象,当然我们可以通过设置显示格式来解决,稍后我们看具体实现;
2、目前报表分组后对于空值和0值的显示结果是相同的,即都为0,这点我们可以通过表达式判断来解决,稍后看具体实现;
3、对于横向纵向分组交叉后在数据集中没有记录的单元格,要显示为空,我们也可以通过表达式判断来解决。
java中怎么把报表导出到excel
导入数据库
@RequestMapping("/uploadOrderFile")
@ResponseBody
public Object uploadOrderFile(HttpServletRequest request, HttpServletResponse response,@RequestParam(value = "file") MultipartFile[] files) throws ServletException, IOException, ParseException{
Workbook rwb=null;
if(files!=null files.length0){
try {
// String filePath = request.getSession().getServletContext().getRealPath("/") + "\\uploadOrderFile\\" + files.getOriginalFilename();
// System.out.println("----------"+filePath);
rwb = Workbook.getWorkbook(files[0].getInputStream());
Sheet rs=rwb.getSheet(0);//默认0是第一张表,或者rwb.getSheet(Sheet1)Excel要导入的表名
int clos=rs.getColumns();//得到所有的列
int rows=rs.getRows();//得到所有的行
//存放Excel表抬头名称以及对应的列
Map<Integer,Object map=new HashMap<Integer, Object();
//实体类集合存放每次循环获得的值
List<Medicine medicineList=new ArrayList<Medicine();
for (int i = 0; i < rows; i++) {
//创建实体类
Medicine medicine=new Medicine();
if(i==0){//遍历第一行获取抬头跟对应的列
for (int j = 0; j <clos; j++) {//取得每个抬头名称对应的列
if(rs.getCell(j, i).getContents().equals("品名")){
map.put(j,"品名");
}else if(rs.getCell(j, i).getContents().equals("商品编号")){
map.put(j,"商品编号");
}else if(rs.getCell(j, i).getContents().equals("生产日期")){
map.put(j,"生产日期");
}else if(rs.getCell(j, i).getContents().equals("产地")){
map.put(j,"产地");
}else if(rs.getCell(j, i).getContents().equals("生产厂家")){
map.put(j,"生产厂家");
}else if(rs.getCell(j, i).getContents().equals("批号")){
map.put(j,"批号");
}
}
}else{
//循环遍历map 》》》存的Excel表的抬头名称以及对应的列
for (int j = 0; j < clos; j++) {
if(map.get(j)==null){//如果=null 进入下一个循环
continue;
}
if(map.get(j).equals("品名")){
//如果为空结束当前循环,进入下一个循环
if(rs.getCell(j, i).getContents()==null||rs.getCell(j, i).getContents().equals("")){
continue;
}
medicine.setMedicineName(rs.getCell(j, i).getContents());
}else if(map.get(j).equals("商品编号")map.get(j)!=null){
//如果为空结束当前循环,进入下一个循环
if(rs.getCell(j, i).getContents()==null||rs.getCell(j, i).getContents().equals("")){
continue;
}
medicine.setMedicineCode(rs.getCell(j, i).getContents());
}else if(map.get(j).equals("生产日期")map.get(j)!=null){
medicine.setCreateTime(rs.getCell(j, i).getContents());
if(rs.getCell(j, i).getContents()!=null !rs.getCell(j, i).getContents().equals("")){
//如果生产日期存在 则+三年给到期日期赋值
//CommonUtil.getMedicineEffectiveTime为封装好的类
medicine.setEffectTime(CommonUtil.getMedicineEffectiveTime(rs.getCell(j, i).getContents(),3));
}
}else if(map.get(j).equals("产地")map.get(j)!=null){
medicine.setAddress(rs.getCell(j, i).getContents());
}else if(map.get(j).equals("生产厂家")map.get(j)!=null){
medicine.setProducingArea(rs.getCell(j, i).getContents());
}else if(map.get(j).equals("批号")map.get(j)!=null){
medicine.setBatchNumber(rs.getCell(j, i).getContents());
}
}
medicineList.add(medicine);//获得的值放入集合中
}
}
//新增用到的list
List<Medicine addList=new ArrayList<Medicine();
//修改用到的list
List<Medicine updateList=new ArrayList<Medicine();
//导入数据
for(int i=0;i<medicineList.size();i++){
//判断商品编号是否存在
if(medicineService.selectMedicineCode(medicineList.get(i).getMedicineCode()).size()0){
//如果存在则修改
updateList.add(medicineList.get(i));
}else{
addList.add(medicineList.get(i));
}
}
int update=0;
int add=0;
if(updateList!=nullupdateList.size()0){
update=medicineService.updateMedicine(updateList);
}
if(addList!=nulladdList.size()0){
add= medicineService.addMedicine(addList);
}
if(update0||add0){
return new ResponseModel().attr(ResponseModel.KEY_DATA,"数据导入成功!");
}else{
return new ResponseModel().attr(ResponseModel.KEY_ERROR,"数据导入失败!");
}
} catch (biffException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{
return new ResponseModel().attr(ResponseModel.KEY_ERROR,"没有需要导入的数据!");
}
return null;
}
导出
package beans.excel;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Calendar;
import java.util.Date;
import jxl.Workbook;
import jxl.format.Colour;
import jxl.format.UnderlineStyle;
import jxl.write.Boolean;
import jxl.write.DateFormats;
import jxl.write.DateTime;
import jxl.write.Label;
import jxl.write.Number;
import jxl.write.WritableCellFormat;
import jxl.write.WritableFont;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
import jxl.write.WriteException;
public class MutiStyleExcelWrite {
public void createExcel(OutputStream os) throws WriteException,IOException {
//创建工作薄
WritableWorkbook workbook = Workbook.createWorkbook(os);
//创建新的一页
WritableSheet sheet = workbook.createSheet("First Sheet", 0);
//构造表头
sheet.mergeCells(0, 0, 4, 0);//添加合并单元格,第一个参数是起始列,第二个参数是起始行,第三个参数是终止列,第四个参数是终止行
WritableFont bold = new WritableFont(WritableFont.ARIAL,10,WritableFont.BOLD);//设置字体种类和黑体显示,字体为Arial,字号大小为10,采用黑体显示
WritableCellFormat titleFormate = new WritableCellFormat(bold);//生成一个单元格样式控制对象
titleFormate.setAlignment(jxl.format.Alignment.CENTRE);//单元格中的内容水平方向居中
titleFormate.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);//单元格的内容垂直方向居中
Label title = new Label(0,0,"JExcelApi支持数据类型详细说明",titleFormate);
sheet.setRowView(0, 600, false);//设置第一行的高度
sheet.addCell(title);
//创建要显示的具体内容
WritableFont color = new WritableFont(WritableFont.ARIAL);//选择字体
color.setColour(Colour.GOLD);//设置字体颜色为金黄色
WritableCellFormat colorFormat = new WritableCellFormat(color);
Label formate = new Label(0,1,"数据格式",colorFormat);
sheet.addCell(formate);
Label floats = new Label(1,1,"浮点型");
sheet.addCell(floats);
Label integers = new Label(2,1,"整型");
sheet.addCell(integers);
Label booleans = new Label(3,1,"布尔型");
sheet.addCell(booleans);
Label dates = new Label(4,1,"日期格式");
sheet.addCell(dates);
Label example = new Label(0,2,"数据示例",colorFormat);
sheet.addCell(example);
//浮点数据
//设置下划线
WritableFont underline= new WritableFont(WritableFont.ARIAL,WritableFont.DEFAULT_POINT_SIZE,WritableFont.NO_BOLD,false,UnderlineStyle.SINGLE);
WritableCellFormat greyBackground = new WritableCellFormat(underline);
greyBackground.setBackground(Colour.GRAY_25);//设置背景颜色为灰色
Number number = new Number(1,2,3.1415926535,greyBackground);
sheet.addCell(number);
//整形数据
WritableFont boldNumber = new WritableFont(WritableFont.ARIAL,10,WritableFont.BOLD);//黑体
WritableCellFormat boldNumberFormate = new WritableCellFormat(boldNumber);
Number ints = new Number(2,2,15042699,boldNumberFormate);
sheet.addCell(ints);
//布尔型数据
Boolean bools = new Boolean(3,2,true);
sheet.addCell(bools);
//日期型数据
//设置黑体和下划线
WritableFont boldDate = new WritableFont(WritableFont.ARIAL,WritableFont.DEFAULT_POINT_SIZE,WritableFont.BOLD,false,UnderlineStyle.SINGLE);
WritableCellFormat boldDateFormate = new WritableCellFormat(boldDate,DateFormats.FORMAT1);
Calendar c = Calendar.getInstance();
Date date = c.getTime();
DateTime dt = new DateTime(4,2,date,boldDateFormate);
sheet.addCell(dt);
//把创建的内容写入到输出流中,并关闭输出流
workbook.write();
workbook.close();
os.close();
}
}
java怎么导出excel表格
通过这个例子,演示以下如何用java生成excel文件:
import org.apache.poi.hssf.usermodel.*;
import java.io.FileOutputStream;
import java.io.IOException;
publicclass CreateCells
{
publicstaticvoid main(String[] args)
throws IOException
{
HSSFWorkbook wb = new HSSFWorkbook();//建立新HSSFWorkbook对象
HSSFSheet sheet = wb.createSheet("new sheet");//建立新的sheet对象
// Create a row and put some cells in it. Rows are 0 based.
HSSFRow row = sheet.createRow((short)0);//建立新行
// Create a cell and put a value in it.
HSSFCell cell = row.createCell((short)0);//建立新cell
cell.setCellValue(1);//设置cell的整数类型的值
// Or do it on one line.
row.createCell((short)1).setCellValue(1.2);//设置cell浮点类型的值
row.createCell((short)2).setCellValue("test");//设置cell字符类型的值
row.createCell((short)3).setCellValue(true);//设置cell布尔类型的值
HSSFCellStyle cellStyle = wb.createCellStyle();//建立新的cell样式
cellStyle.setDataFormat(HSSFDataFormat.getFormat("m/d/yy h:mm"));//设置cell样式为定制的日期格式
HSSFCell dCell =row.createCell((short)4);
dCell.setCellValue(new Date());//设置cell为日期类型的值
dCell.setCellStyle(cellStyle); //设置该cell日期的显示格式
HSSFCell csCell =row.createCell((short)5);
csCell.setEncoding(HSSFCell.ENCODING_UTF_16);//设置cell编码解决中文高位字节截断
csCell.setCellValue("中文测试_Chinese Words Test");//设置中西文结合字符串
row.createCell((short)6).setCellType(HSSFCell.CELL_TYPE_ERROR);//建立错误cell
// Write the output to a file
FileOutputStream fileOut = new FileOutputStream("workbook.xls");
wb.write(fileOut);
fileOut.close();
}
}
java导出excel
java导出Excel
java 代码 /* * Generated by MyEclipse Struts * Template path: templates/java/JavaClass.vtl */ package com.axon.fable.sams.view.action; import java.io.IOException; import java.io.OutputStream; import java.util.List; import javax.serv ...
java导出Excel例举方式
方法一:导出Excel数据的插件jexcelapi
程序实例如下:
public void exportClassroom(OutputStream os) throws PaikeException {
try {
WritableWorkbook wbook = Workbook.createWorkbook(os); //建立excel文件
WritableSheet wsheet = wbook.createSheet("教室信息表", 0); //工作表名称
//设置Excel字体
WritableFont wfont = new WritableFont(WritableFont.ARIAL, 16,
WritableFont.BOLD, false,
jxl.format.UnderlineStyle.NO_UNDERLINE,
jxl.format.Colour.BLACK);
WritableCellFormat titleFormat = new WritableCellFormat(wfont);
String[] title = { "教室名", "容 量", "类 型", "其他说明" };
//设置Excel表头
for (int i = 0; i < title.length; i++) {
Label excelTitle = new Label(i, 0, title[i], titleFormat);
wsheet.addCell(excelTitle);
}
int c = 1; //用于循环时Excel的行号
ClassroomService cs = new ClassroomService();
List list = cs.findAllClassroom(); //这个是从数据库中取得要导出的数据
Iterator it = list.iterator();
while (it.hasNext()) {
ClassroomDTO crdto = (ClassroomDTO) it.next();
Label content1 = new Label(0, c, crdto.getRoomname());
Label content2 = new Label(1, c, crdto.getCapicity().toString());
Label content3 = new Label(2, c, crdto.getRoomTypeId()
.toString());
Label content4 = new Label(3, c, crdto.getRemark());
wsheet.addCell(content1);
wsheet.addCell(content2);
wsheet.addCell(content3);
wsheet.addCell(content4);
c++;
}
wbook.write(); //写入文件
wbook.close();
os.close();
} catch (Exception e) {
throw new PaikeException("导出文件出错");
}
}
方法二:直接用Java代码实现导出Excel报表
/*
* Generated by MyEclipse Struts
* Template path: templates/java/JavaClass.vtl
*/
package com.axon.fable.sams.view.action;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import jxl.Workbook;
import jxl.write.WriteException;
import jxl.write.biff.RowsExceededException;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import com.axon.fable.empold
erpackage.out.OutJavaScript;
import com.axon.fable.empolderpackage.page.Pager;
import com.axon.fable.empolderpackage.string.MyPublic;
import com.axon.fable.sams.common.BaseAction;
import com.axon.fable.sams.exception.AppBusinessException;
import com.axon.fable.sams.exception.AppSystemException;
/**
* MyEclipse Struts
* Creation date: 06-28-2007
*
* XDoclet definition:
* @struts.action path="/axon" name="axonForm" input="/samspage/zm/axon.jsp" parameter="method" scope="request" validate="true"
* @struts.action-forward name="success" path="/samspage/zm/content.jsp"
*/
public class StshipoperationAction extends BaseAction {
/*
* Generated Methods
*/
private static Session session=null;
private static Transaction ts=null;
private static Query queryC=null;
private static Query queryR=null;
private static Query query=null;
private static List list=null;
private static Integer startRow;
private static Integer ncurrentPage;
private static Integer cell;
private static String property;
private static String sql;
private static String type;
private static String condition ;//是否导出当前页
private static String currentPage;
private static String from ;
private static String pactdata;
private static String voyagename;
private static String voyageno;
private static String dwt ;
private static String hirefrom ;
private static String deliveryposion ;
private static String redeliveryposion ;
private static String sheepowner ;
private static String addr;
private static String addcomm;
private static String rent;
private static String fileName ;
private static OutputStream os;
@Override
public ActionForward findAll(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
return null;
}
@Override
public ActionForward findById(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
return null;
}
@Override
public ActionForward save(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
return null;
}
public static String strNull(Object nullStr,String newStr,Integer cell){
if(nullStr==null||nullStr.equals("")){return newStr;}else{cell+=1;return nullStr+"";}
}
public static String getStr(String str,Integer cell){
if(str==null||str.trim().equals("")){return "";}else{cell+=1;return ","+str;}
}
public static String getExcelTile(String title){
if(title==null)
return "";
if(title.equals("modela.stsid"))
return "编号";
if(title.equals("modelc.pactdata"))
return "合同日期";
if(title.equals("modela.voyagename"))
return "航名";
if(title.equals("modela.voyageno"))
return "航次";
if(title.equals("modelc.dwt"))
return "DWT";
if(title.equals("modelc.hirefrom"))
return "受载期";
if(title.equals("modela.deliveryposion"))
return "交船地点";
if(title.equals("modela.redeliveryposion"))
return "还船地点";
if(title.equals("modelc.sheepowner"))
return "联系人";
if(title.equals("modelc.addr"))
return "经纪人拥金";
if(title.equals("modelc.addcomm"))
return "ADD COMM";
if(title.equals("modelc.rent"))
return "租金";
return "";
}
public ActionForward exporVoyagesInfoToExcel(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
list=null;
startRow=0;
ncurrentPage=1;
cell=0;
type =request.getParameter("type");
condition =request.getParameter("condition");//是否导出当前页
currentPage =request.getParameter("currentPage");
from =request.getParameter("from");
pactdata = request.getParameter("modelc.pactdata");
voyagename = request.getParameter("modela.voyagename");
voyageno = request.getParameter("modela.voyageno");
dwt = request.getParameter("modelc.dwt");
hirefrom = request.getParameter("modelc.hirefrom");
deliveryposion = request.getParameter("modela.deliveryposion");
redeliveryposion = request.getParameter("modela.redeliveryposion");
sheepowner = request.getParameter("modelc.sheepowner");
addr = request.getParameter("modelc.addr");
addcomm = request.getParameter("modelc.addcomm");
rent = request.getParameter("modelc.rent");
if(type!=nulltype.trim().equals("1")){
type ="已还船舶--费用未结清";
}else{
type ="已还船舶--费用已结清";
}
property =getStr(pactdata,cell)+getStr(voyagename,cell)+getStr(voyageno,cell)+getStr(dwt,cell)+getStr(hirefrom,cell)
+getStr(deliveryposion,cell)+getStr(redeliveryposion,cell)+getStr(sheepowner,cell)+getStr(addr,cell)+getStr(addcomm,cell)
+getStr(rent,cell);
property = property.substring(1);
String split[] = property.split(",");
// System.out.println("-----------------------------property:"+property);
if(currentPage!=null!currentPage.trim().equals("")){
ncurrentPage =Integer.parseInt(currentPage);
}else{
OutJavaScript.outString(response, "Sorry! Failed to get information of pager.");
return null;
}
try {
session =getServiceLocator().getBaseHibernateDAO().getSession();
sql ="select count(*) "+from;
query =session.createQuery(sql);
list = query.list();
for (int i = 0; i < list.size(); i++) {
totalSize =(Integer)list.get(i);
if(totalSize!=0){
pager =new Pager(ncurrentPage,totalSize);
}
}
query =getServiceLocator().getBaseHibernateDAO().getSession().createQuery("select " +property+from);
if(condition!=nullcondition.trim().equals("1")){//分页数据
startRow = (ncurrentPage - 1)*pager.getPageSize();
query.setFirstResult(startRow);
query.setMaxResults(pager.getPageSize());
// System.out.println("---------------------------------------------------query:"+query);
}
list = query.list();
fileName = "shipInfo";
os = response.getOutputStream();
response.reset();
response.setHeader("Content-disposition",
"attachment; filename=" +fileName + ".xls");
response.setContentType("application/msexcel");
jxl.write.WritableWorkbook wbook = Workbook.createWorkbook(os);
jxl.write.WritableSheet wsheet = wbook.createSheet("the first sheet", 0);
for (int i = 0; i < split.length; i++) {
jxl.write.Label wlabel0;
wlabel0 = new jxl.write.Label(i, 0, getExcelTile(split[i]));
wsheet.addCell(wlabel0);
}
jxl.write.Label wlabel1;
for(int i=0;i<list.size();i++) {
if(split.length==1){
Object strval = (Object) list.get(i);
String javaScript=""+MyPublic.toHtmlStr(strval==null?"":strval.toString().trim())+"";
wlabel1 = new jxl.write.Label(0, i+1,strval==null?"":strval.toString().trim() );
wsheet.addCell(wlabel1);
}else{
Object[] strval = (Object[]) list.get(i);
for(int j=0;j<strval.length;j++) {
String javaScript=""+MyPublic.toHtmlStr(strval[j]==null?"":strval[j].toString().trim())+"";
//System.out.println("===================script:"+javaScript);
wlabel1 = new jxl.write.Label(j, i+1,strval[j]==null?"":strval[j].toString().trim() );
wsheet.addCell(wlabel1);
}
}
}
wbook.write();
response.flushBuffer();
wbook.close();
os.close();
} catch (IOException e) {
// TODO Auto-generated catch block
OutJavaScript.outString(response, "Sorry! Export Excel exception.");
e.printStackTrace();
} catch (HibernateException e1) {
// TODO Auto-generated catch block
OutJavaScript.outString(response, "Sorry! Database exception.");
e1.printStackTrace();
} catch (AppSystemException e1) {
// TODO Auto-generated catch block
OutJavaScript.outString(response, "Sorry! System exception.");
e1.printStackTrace();
} catch (AppBusinessException e1) {
// TODO Auto-generated catch block
OutJavaScript.outString(response, "Sorry! Database exception.");
e1.printStackTrace();
} catch (RowsExceededException e) {
// TODO Auto-generated catch block
OutJavaScript.outString(response, "Sorry! Export Excel exception.");
e.printStackTrace();
} catch (WriteException e) {
// TODO Auto-generated catch block
OutJavaScript.outString(response, "Sorry! Export Excel exception.");
e.printStackTrace();
}
return null;
}
@Override
public ActionForward update(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
return null;
}
}
还有其他很多种 字数限制 无法一一举例方式
如何导出生成excel文件 java
在编程中经常需要使用到表格(报表)的处理主要以Excel表格为主。下面给出用java写入数据到excel表格方法
java报表导出excel模板:
1.添加jar文件
java导入导出Excel文件要引入jxl.jar包
java报表导出excel模板,最关键的是这套API是纯Java的,并不依赖Windows系统,即使运行在Linux下,它同样能够正确的处理Excel文件。***:http://www.andykhan.com/jexcelapi/
2.jxl对Excel表格的认识
可以参见http://www.cnblogs.com/xudong-bupt/archive/2013/03/19/2969997.html
3.java代码根据程序中的数据生成上述图片所示的t.xls文件
?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import java.io.File;
import jxl.*;
import jxl.write.Label;
import jxl.write.WritableSheet;
import jxl.write.WritableWorkbook;
public class Writer_excel{
public static void main(String[] args) {
//标题行
String title[]={"角色","编号","功能名称","功能描述"};
//内容
String context[][]={{"UC11","设置课程","创建课程"},
{"UC12","设置学生名单","给出与课程关联的学生名单"},
{"UC21","查看学生名单",""},
{"UC22","查看小组信息","显示助教所负责的小组列表信息"}
};
//操作执行
try {
//t.xls为要新建的文件名
WritableWorkbook book= Workbook.createWorkbook(new File("t.xls"));
//生成名为“第一页”的工作表,参数0表示这是第一页
WritableSheet sheet=book.createSheet("第一页",0);
//写入内容
for(int i=0;i<4;i++) //title
sheet.addCell(new Label(i,0,title[i]));
for(int i=0;i<4;i++) //context
{
for(int j=0;j<3;j++)
{
sheet.addCell(new Label(j+1,i+1,context[i][j]));
}
}
sheet.addCell(new Label(0,1,"教师"));
sheet.addCell(new Label(0,3,"助教"));
/*合并单元格.合并既可以是横向的,也可以是纵向的
*WritableSheet.mergeCells(int m,int n,int p,int q); 表示由(m,n)到(p,q)的单元格组成的矩形区域合并
* */
sheet.mergeCells(0,1,0,2);
sheet.mergeCells(0,3,0,4);
//写入数据
book.write();
//关闭文件
book.close();
}
catch(Exception e) { }
}
关于java报表导出excel模板和java导出excel poi的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。
java报表导出excel模板的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于java导出excel poi、java报表导出excel模板的信息别忘了在本站进行查找喔。