poi(excle)

1---------导出excel到 用户浏览器 (方法)
  HttpServletResponse response = null;//创建一个HttpServletResponse对象
        OutputStream out = null;//创建一个输出流对象try {
            response = ServletActionContext.getResponse();//初始化HttpServletResponse对象
            out = response.getOutputStream();//
          
    String headerStr ="student学生";
    headerStr =new String(headerStr.getBytes("gb2312"), "ISO8859-1");//headerString为中文时转码
    response.setHeader("Content-disposition","attachment; filename="+    headerStr+".xls");//filename是下载的xls的名,建议最好用英文
            response.setContentType("application/msexcel;charset=UTF-8");//设置类型
            response.setHeader("Pragma","No-cache");//设置头
            response.setHeader("Cache-Control","no-cache");//设置头
            response.setDateHeader("Expires", 0);//设置日期头           
            workbook.write(out);
            out.flush();
            workbook.write(out);








1.输出excle
      下载到用户浏览器的方法:
        // path 是写死的 应该动态获取
        // 在输出流  把文件放入
public  static void ioExpExcel(HSSFWorkbook excel,String path){
            OutputStream out = null;
            try{
            out = new FileOutputStream(path);
            excel.write(out);
            out.close();
            } catch (FileNotFoundException e) {
            e.printStackTrace();
            } catch (IOException e) {
            // TODOAuto-generated catch block
            e.printStackTrace();
            }
            System.out.println("数据已经写入excel");


        }
2 读取excle文件
    如果是动态的上传的文件,excel
              这样数获取到了上传来的文件,然后把文件方法到
             流中// 例如 File excel = new file();
              FileInputStream file = new FileInputStream(excel);
   public static void main(String[] args) throws IOException {
              //读取文件 为了看着清晰,暂时抛出异常
                
             FileInputStream file = new FileInputStream("F://one.xls");
             // 创建获取一个excle 文件
             HSSFWorkbook excle = new HSSFWorkbook(file);
             //根据下标获取sheet
             HSSFSheet sheet = excle.getSheetAt(0);
             //获取sheet表中的最后一个行号
             int rowNum = sheet.getLastRowNum();
             //循环行号
             for (int rowIndex = 0; rowIndex <= rowNum; rowIndex++) {
                     //根据行号 获取每一行
                    HSSFRow row = sheet.getRow(rowIndex);
                    // 根据行获取最后一列号
                    int cellNum = row.getLastCellNum();
                    for (int cellIndex = 0 ; cellIndex < cellNum ; cellIndex++) {
                             // 获取列(单元格的内容)
                            HSSFCell cell = row.getCell(cellIndex);
                            System.out.print(cell+"\t");
                    }
                    System.out.println("");
            }
        }






poi
介绍
Apache POI是Apache软件基金会的开放源码函式库,POI提供API给Java程序对Microsoft Office格式档案读和写的功是。
工具包
poi-3.8-20120326.jar
api(方法大全)
http://blog.sina.com.cn/s/blog_91c0fdb50101kfd4.html
http://www.cnblogs.com/hongten/p/java_poi_excel_xls_xlsx.html 时间插件
POI EXCEL文档结构类
HSSFWorkbook excel文档对象
HSSFSheet excel的sheet
HSSFRow excel的行
HSSFCell excel的单元格
HSSFFont excel字体
HSSFName 名称
HSSFDataFormat 日期格式
HSSFHeader sheet头 --
HSSFFooter sheet尾 --
HSSFCellStyle cell样式
HSSFDateUtil 日期
HSSFPrintSetup 打印 --
HSSFErrorConstants 错误信息表 --
基本:
HSSFWorkbook wb = new HSSFWorkbook(); //创建一个webBook,对应一个Excel文件
HSSFSheet sheet=wb.createSheet("sheet"); //在webBook中创建一个sheet,对应Excel中的sheet
sheet.setColumnWidth(0, 10000);
//列的宽度 第一个参数为我们修改的下标 第二个为长度
HSSFRow row=sheet.createRow(0); //创建1行
HSSFCell cell = row.createCell(0); //创建第1行的列:(即创建第一个单元格)
cell.setCellValue("李光辉"); //设置单元格的值
//合并单元格
// 创建两行单元格
HSSFRow row1=sheet.createRow(5);
row1.createCell(5).setCellValue("合并单元格");;
sheet.addMergedRegion(new CellRangeAddress(5,8 ,1,3));
//起始行号,终止行号,起始列号 ,终止列号
合并单元格后的效果
注意 合并的区域不需要创建 若要从合并区域内填充数据的话 需要创建左上角单元格所在的位
置创建CELL 然后set数值,
合并单元格区域内若其他CELL 有值的话 只会保存 左上角的值
Style:
所需设置的样式: 1.设置边框
2.字体 大小 颜色
3..背景颜色
4.内容居中
5.日期格式
HSSFCellStyle style=wb.createCellStyle(); //创建样式
//设置边框
style.setBorderBottom((short) 2);
style.setBorderTop((short) 2);
style.setBorderLeft((short) 2);
style.setBorderRight((short) 2);
//设置字体
HSSFFont font = wb.createFont(); // 单元格字体
font.setFontName("仿宋");
font.setColor(HSSFColor.RED.index); //设置文字颜色
font.setFontHeightInPoints((short) 11);
style.setFont(font);
//设置背景色
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND); //填充背景颜色
// setFillPattern是设置单元格填充样式,SOLID_FOREGROUND纯色使用前景颜色填充,接
着设置前景颜色 (setFillForegroundColor)就可以给单元格着色了。
style.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index);
cell.setCellStyle(style);
//内容居中
style.setAlignment(HSSFCellStyle.ALIGN_CENTER); //水平居中
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); //垂直居中
============CELL转换文字格式======================
//日期类型的cell样式 yyyy-m-d h:mm:ss AM/PM (还有其他格式 大同小异 可以自己练习)
// 浮点类型的cell样式
HSSFCellStyle doubleStyle = workbook.createCellStyle();
doubleStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("0.00"));
HSSFCell cellDouble = row.createCell(1);
cellDouble.setCellValue(1.2);
cellDouble.setCellStyle(doubleStyle);
//字符串类型的cell样式
HSSFCellStyle stringStyle = workbook.createCellStyle();
stringStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat(""));
HSSFCell cellString= row.createCell(2);
cellString.setCellValue("test");
cellString.setCellStyle(stringStyle);
//添加cell布尔类型的值
row.createCell(3).setCellValue(true);
//增加超链接
HSSFCell cell6 = row.createCell(5);
cell6.setCellType(HSSFCell.CELL_TYPE_FORMULA); //HSSFCell.CELL_TYPE_FORMULA 是execl
中获得结果的公式
cell6.setCellFormula("HYPERLINK(\"" + "Http://www.google.ca"+ "\",\"" +
"Google Canada"+ "\")"); //增加超链接的格式
HSSFCellStyle linkStyle = wb.createCellStyle();
HSSFFont cellFont= wb.createFont();
cellFont.setUnderline((byte) 1);
cellFont.setColor(HSSFColor.BLUE.index);
linkStyle.setFont(cellFont);
cell6.setCellStyle(linkStyle);
各种获取
//获取指定行,索引从0开始
hssfRow=hssfSheet.getRow(1);
//获取指定列,索引从0开始
hssfCell=hssfRow.getCell((short)6);
//获取总行数
//int rowNum=hssfSheet.getLastRowNum();
//获取一个excel表格中的总记录数
int rowNum=storagesList.size();
//获取总列数
int columnNum=hssfRow.getPhysicalNumberOfCells();
==================================================================
//导入
Main方法中运行
FileInputStream readFile
readFile = new FileInputStream("D:\\aa1.xls");
//创建操作Excel的HSSFWorkbook对象
HSSFWorkbook wb = null;
wb = new HSSFWorkbook(readFile);
//获得文件表(sheet)的名称
HSSFSheet st = wb.getSheet("student");
//获得实际的行数
int rowCount = st.getPhysicalNumberOfRows();
System.out.println(rowCount);
//循环输入文件中读的内容
HSSFSheet sheet=null;
//获得excel中有几个sheet
for (int i = 0; i < wb.getNumberOfSheets(); i++) {
sheet=wb.getSheetAt(i);
//获取每个sheet中有多少行
for (int j = 0; j < sheet.getPhysicalNumberOfRows(); j++) {
HSSFRow row=sheet.getRow(j);
//获取列数
for (int k = 0; k < row.getLastCellNum(); k++) {
System.out.print(row.getCell(k)+"\t");
}
System.out.println();
}
}
readFile.close();
//导出文件
MAIN 方法中运行
expExcel() 静态方法
|
|

public static void expExcel(){
File file = new File("d://aa1.xls");
//判断是否创建文件
if(!file.exists()){
try {
file.createNewFile();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
//下面是添加数据
List<Stu> stuList=new ArrayList<>();
stuList.add(new Stu(1,"小红",1,new Date(), 13)); //顺序是按有参构造函数来添加
stuList.add(new Stu(2,"听风",2,new Date(), 15));
stuList.add(new Stu(3,"燕子",2,new Date(), 22));
//把list集合中的信息写入xlsx文件中
//调用输出方法 把数据写入excel
writeExcel(stuList,file);
}
===========输出方法=================
public static void writeExcel(List<Stu> stuList, File file) {
//创建操作Excel的HSSFWorkbook对象
HSSFWorkbook wb= new HSSFWorkbook();
//创建HSSFSheet对象
HSSFSheet sheet = wb.createSheet("student");
sheet.setColumnWidth(3, 20*500);
//创建样式
HSSFCellStyle style=wb.createCellStyle();
//合并单元格
HSSFRow row3 = sheet.createRow(1);
HSSFRow row4 = sheet.createRow(2);
HSSFCell cell66 = row3.createCell(1);
cell66.setCellValue("学生表");
/** row3.createCell(2);
row3.createCell(3);
row3.createCell(4);
row4.createCell(1);
row4.createCell(2);
row4.createCell(3);
row4.createCell(4); */
sheet.addMergedRegion(new CellRangeAddress(1,2 ,1,4));
//创建字体样式
HSSFFont font = wb.createFont();
font.setFontName("仿宋");
font.setColor(HSSFColor.RED.index);//设置文字颜色
font.setFontHeightInPoints((short) 20);
style.setFont(font);
cell66.setCellStyle(style);
//创建背景色
style.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
style.setFillForegroundColor(HSSFColor.LIGHT_YELLOW.index);
//居中
style.setAlignment(HSSFCellStyle.ALIGN_CENTER);//水平居中
style.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);//垂直居中
//创建第一行标题信息的HSSFRow对象
HSSFRow firstRow = sheet.createRow(3);
//创建5个单元格
HSSFCell cells[] = new HSSFCell[5];
//标题头
String[] titles = new String[]{"id","姓名","性别","生日","年龄","连接"};
//创建标题数据,并通过HSSFCell对象的setCellValue()方法对每个单元格进行赋值
for (int i = 0; i < 6; i++) {
cells[0] = firstRow.createCell(i);
cells[0].setCellValue(titles[i]);
}
//excel中写入数据
for (int i = 0; i < stuList.size(); i++) {
HSSFRow row = sheet.createRow(i + 4);
Stu stu = stuList.get(i);
HSSFCell cell1 = row.createCell(0);
cell1.setCellValue(stu.getStuId());
HSSFCell cell2 = row.createCell(1);
cell2.setCellValue(stu.getStuName());
HSSFCell cell3 = row.createCell(2);
cell3.setCellValue(stu.getStuSex());
HSSFCell cell4 = row.createCell(3);
cell4.setCellValue(stu.getStuBir());
HSSFCell cell5 = row.createCell(4);
cell5.setCellValue(stu.getStuAge());
HSSFCellStyle dateStyle = wb.createCellStyle();
dateStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("m/d/yy h:mm"));
cell4.setCellStyle(dateStyle);
HSSFCellStyle Number = wb.createCellStyle();
HSSFCellStyle cellStyle = wb.createCellStyle();
cellStyle.setDataFormat(HSSFDataFormat.getBuiltinFormat("0"));
cell1.setCellStyle(cellStyle);
cell3.setCellStyle(cellStyle);
HSSFCell cell6 = row.createCell(5);
cell6.setCellType(HSSFCell.CELL_TYPE_FORMULA);
cell6.setCellFormula("HYPERLINK(\"" + "Http://www.baidu.com"+ "\",\"" + "百度"+ "\")");
HSSFCellStyle linkStyle = wb.createCellStyle();
HSSFFont cellFont= wb.createFont();
cellFont.setUnderline((byte) 1);
cellFont.setColor(HSSFColor.BLUE.index);
linkStyle.setFont(cellFont);
cell6.setCellStyle(linkStyle);
}
//io
OutputStream out = null;
try {
out = new FileOutputStream(file);
wb.write(out);
out.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.println("数据已经写入excel");
}












//  导入导出,代码(用main方法)


public class PoiServlet {


    @SuppressWarnings("rawtypes")
    public static void main(String[] args) {
        //创建一个workbook
        HSSFWorkbook wb = new HSSFWorkbook();
        //创建初始化sheet表
        HSSFSheet sheet = wb.createSheet("第一个表");
        //sheet.setColumnWidth(0, 10000); //第一个参数代表列id(从0开始),第2个参数代表宽度值
        HSSFRow row = sheet.createRow(0);
        HSSFCell cell = row.createCell(0);
        cell.setCellValue("账户名");
        HSSFCell cell1 = row.createCell(1);
        cell1.setCellValue("性别");


        HSSFCellStyle cellStyle = wb.createCellStyle(); 
        cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); // 居中
        cellStyle.setFillForegroundColor((short) 14);// 设置背景色
        cellStyle.setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);
        HSSFFont font = wb.createFont();
        font.setFontName("楷体");//字体
        font.setFontHeightInPoints((short) 12);//大小
        cellStyle.setFont(font);
        cellStyle.setFont(font);
        cellStyle.setFont(font);
        cell.setCellStyle(cellStyle);
        cell1.setCellStyle(cellStyle);
        //-----------------------------------
        List<Map> list = selectList("and tuf.usersex=1");
        for(int i=0;i<list.size();i++){
                HSSFRow row1 = sheet.createRow(i+1);
                HSSFCell cell2 = row1.createCell(0);
                cell2.setCellValue(list.get(i).get("username").toString());
                HSSFCell cell3 = row1.createCell(1);
                cell3.setCellValue("男");
        }
        System.out.println("ok");
        //-------------------------------------
        HSSFSheet sheet2 = wb.createSheet("第二个表");
        //sheet.setColumnWidth(0, 10000); //第一个参数代表列id(从0开始),第2个参数代表宽度值
        HSSFRow row2 = sheet2.createRow(0);
        HSSFCell cell4 = row2.createCell(0);
        cell4.setCellValue("账户名");
        HSSFCell cell5 = row2.createCell(1);
        cell5.setCellValue("职业");
        HSSFCell cell9 = row2.createCell(2);
        cell9.setCellValue("年龄");
        //-----------------------------------
        List<Map> list2 = selectList("and tuf.useribo=1 and tuf.userage > 30");
        for(int i=0;i<list2.size();i++){
                HSSFRow row3 = sheet2.createRow(i+1);
                HSSFCell cell6 = row3.createCell(0);
                cell6.setCellValue(list2.get(i).get("username").toString());
                HSSFCell cell7 = row3.createCell(1);
                cell7.setCellValue("java");
                HSSFCell cell8 = row3.createCell(2);
                cell8.setCellValue(list2.get(i).get("userage").toString());
        }
        System.err.println("ok");
        //-------------------------------------


        HSSFSheet sheet3 = wb.createSheet("第三个表");
        //sheet.setColumnWidth(0, 10000); //第一个参数代表列id(从0开始),第2个参数代表宽度值
        HSSFRow row4 = sheet3.createRow(0);
        HSSFCell cell8 = row4.createCell(0);
        cell8.setCellValue("账户名");
        HSSFCell cell19 = row4.createCell(1);
        cell19.setCellValue("状态");
        //-----------------------------------
        List<Map> list3 = selectList("and tu.userstatus=0");
        for(int i=0;i<list3.size();i++){
                HSSFRow row5 = sheet3.createRow(i+1);
                HSSFCell cell10 = row5.createCell(0);
                cell10.setCellValue(list3.get(i).get("username").toString());
                HSSFCell cell11 = row5.createCell(1);
                cell11.setCellValue("未激活");
        }
        System.err.println("ok");
        //-------------------------------------






        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream("d://stu.xls");
        } catch (FileNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        try {
            wb.write(fos);
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    @SuppressWarnings({ "unchecked", "rawtypes" })


    public static List<Map> selectList(String newSql) {


        List<Map> list = new ArrayList<Map>();


        Connection conn = null;


        PreparedStatement pst = null;


        ResultSet rs = null;


        try {
            Class.forName("oracle.jdbc.OracleDriver");
            conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","scott","scott");
            String sql = "select tu.username,tu.userstatus,tuf.usersex,tuf.userage,tuf.useribo from t_user tu left join t_user_info tuf on tu.id=tuf.ufid where 1=1 "+newSql;


            pst = conn.prepareStatement(sql);
            rs = pst.executeQuery();


            while(rs.next()){
                Map map = new HashMap<>();
                map.put("username", rs.getString(1));
                map.put("userstatus", rs.getInt(2));
                map.put("usersex", rs.getInt(3));
                map.put("userage", rs.getInt(4));
                map.put("useribo", rs.getInt(5));
                list.add(map);
            }
        } catch (ClassNotFoundException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        }finally{
            try {
                if (rs != null) {
                    rs.close();
                    rs = null;
                }
                if (pst != null) {
                    pst.close();
                    pst = null;
                }
                if (conn != null) {
                    conn.close();
                    conn = null;
                }
            } catch (SQLException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }


        return list;
    }


}




03,07excel的用法
03excel  最大行号40000多,
07excel 最大行号1000万多点,


03 xls 07 xlsx 可以更改 
HSSFworkBook
XSSFworkBook 共同继承workBook总接口
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);    //单元格引用样式  










  基本创建:
            1. 创建excel文档,
            2. 通过文档创建sheet页签,
            3. 通过sheet页签创建行,
            4. 通过行创建列(单元格),
            5. 通过单元格对象为自己赋值(各种类型的值,但是date类型要通过样式进行设置)
            6. excle文档对象调用 写出流 写出。
   合并单元格:
            通过sheet表对象调用方法来创建单元格;
                  注意:1.合并多个单元格时,单元格默认选择左上角内容
                            2.合并之后,该大单元格占有多个单元格,给其它单元格赋值时,按照合并之前的下标,不然 或被大单元格覆盖;
   各种样式:
            通过excle文档对象创建样式;   
                       注意:font样式对象 通过excle文档对象创建,然后设置具体参数(字体,大小,颜色等)       
                                   之后交给样式对象(cellStyle.setFont(font));
                        其它的,基本上都是样式对象直接设置各种样式,
                        然后交给单元格(cell5.setCellStyle(cellStyle));





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值