zoukankan      html  css  js  c++  java
  • java操作Excel的poi的字体设置

    package com.java.poi;

    import org.apache.poi.hssf.usermodel.HSSFWorkbook;
    import org.apache.poi.ss.usermodel.*;

    import java.io.FileOutputStream;

    /**
    * 字体设置
    * @author nidegui
    * @create 2019-06-17 11:30
    */
    public class Test7 {
    public static void main(String[] args) throws Exception {

    Workbook wb=new HSSFWorkbook();
    Sheet sheet = wb.createSheet("sheet页");
    Row row=sheet.createRow(1);

    //创建一个字体
    Font font=wb.createFont();
    font.setFontHeightInPoints((short) 24);
    font.setFontName("Courier New ");
    font.setItalic(true);
    font.setStrikeout(true);

    CellStyle style=wb.createCellStyle();
    style.setFont(font);

    Cell cell = row.createCell((short) 1);
    cell.setCellValue("this is test of fonts");
    cell.setCellStyle(style);

    FileOutputStream is=new FileOutputStream("E:\3.xls");
    wb.write(is);
    is.close();
    }
    }

    
    
  • 相关阅读:
    QTP err.number
    QTP参数化
    QTP基础
    QTP脚本补录
    QTP添加对象入库
    系统自带计算器自动化
    QTP安装
    App 测试
    本地化和国际化测试
    剑桥雅思写作高分范文ESSAY30
  • 原文地址:https://www.cnblogs.com/nidegui/p/11038925.html
Copyright © 2011-2022 走看看