<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 21,  comments - 6,  trackbacks - 0

    /*
    ?* Created on 2006-9-13
    ?*/
    package com.livedoor.finance.credit.admin.business.event.service;

    import java.io.FileNotFoundException;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.OutputStream;

    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.Region;

    /**
    ?* @author Warren~@_@
    ?*/
    public class CatOutputSpecification2 {
    ??? HSSFWorkbook hssfWorkbook;
    ??? HSSFSheet hssfSheet;
    ??? HSSFRow hssfRow;
    ??? HSSFCell hssfCell;
    ???
    ??? OutputStream out;
    ???
    ??? private String fontName = "MS Pゴシツク";
    ??? private short fontSize = (short) 11;
    ??? private short fontTitleSize = (short) 16;
    ???
    ??? public CatOutputSpecification2() {
    ???????
    ??? }
    ???
    ??? public static void main(String[] args) {
    ??????? CatOutputSpecification2 cat = new CatOutputSpecification2();
    ??????? cat.executeExcel();
    ???????
    ??????? System.out.println("========");
    ??? }
    ???
    ??? public void executeExcel() {
    ??????? String filePath = null;
    ??????? FileOutputStream fos = null;
    ???????
    ??????? filePath = "./data/testPOI.xls";
    ???????
    ??????? try {
    ??????????? fos = new FileOutputStream(filePath);
    ???????????
    ??????????? generate(fos);
    ???????????
    ??????????? fos.close();
    ??????? } catch (FileNotFoundException e) {
    ??????????? // TODO Auto-generated catch block
    ??????????? e.printStackTrace();
    ??????? } catch (IOException e) {
    ??????????? // TODO Auto-generated catch block
    ??????????? e.printStackTrace();
    ??????? }
    ??? }

    ??? /**
    ???? * @param fos
    ???? */
    ??? private void generate(OutputStream out) {
    ??????? // TODO Auto-generated method stub
    ??????? this.out = out;
    ???????
    ??????? drawWB();
    ??? }

    ??? /**
    ???? *
    ???? */
    ??? private void drawWB() {
    ??????? // TODO Auto-generated method stub
    ??????? hssfWorkbook = new HSSFWorkbook();
    ???????
    ??????? hssfSheet = hssfWorkbook.createSheet();
    ??????? hssfWorkbook.setSheetName(0, "test", HSSFWorkbook.ENCODING_UTF_16);
    ???????
    ??????? hssfSheet.setDisplayGridlines(true);
    ???????
    ??????? for (int i = 0; i < 30; i++) {
    ??????????? hssfSheet.setColumnWidth((short) i, (short) (4.25 * 256));
    ??????? }
    ???????
    ??????? drawCell();
    ???????
    ??????? try {
    ??????????? hssfWorkbook.write(out);
    ??????? } catch (IOException e) {
    ??????????? // TODO Auto-generated catch block
    ??????????? e.printStackTrace();
    ??????? }
    ??? }

    ??? /**
    ???? *
    ???? */
    ??? private void drawCell() {
    ??????? // 1~2 row
    ??????? HSSFRow row_001 = hssfSheet.createRow(1);
    ??????? HSSFRow row_002 = hssfSheet.createRow(2);
    ???????
    ??????? HSSFCell cell_001_000 = row_001.createCell((short) 0);
    ??????? HSSFCell cell_002_029 = row_002.createCell((short) 29);
    ???????
    ??????? hssfSheet.addMergedRegion(new Region(1, (short) 0, 2, (short) 29));
    ???????
    ??????? // 4 row
    ??????? HSSFRow row_004 = hssfSheet.createRow(4);
    ???????
    ??????? HSSFCell cell_004_001 = row_004.createCell((short) 1);
    ??????? HSSFCell cell_004_005 = row_004.createCell((short) 5);
    ??????? HSSFCell cell_004_013 = row_004.createCell((short) 13);
    ???????
    ??????? hssfSheet.addMergedRegion(new Region(4, (short) 5, 4, (short) 13));
    ???????
    ??????? // 5~11 row
    ??????? HSSFRow row_005 = hssfSheet.createRow(5);
    ??????? HSSFRow row_011 = hssfSheet.createRow(11);
    ???????
    ??????? HSSFCell cell_005_000 = row_005.createCell((short) 0);
    ??????? HSSFCell cell_011_029 = row_011.createCell((short) 29);
    ???????
    ??????? hssfSheet.addMergedRegion(new Region(5, (short) 0, 11, (short) 29));
    ???????
    ??????? // 13 row
    ??????? HSSFRow row_013 = hssfSheet.createRow(13);
    ???????
    ??????? HSSFCell cell_013_000 = row_013.createCell((short) 0);
    ???????
    ??????? // 14 row
    ??????? HSSFRow row_014 = hssfSheet.createRow(14);
    ???????
    ??????? HSSFCell cell_014_001 = row_014.createCell((short) 1);
    ??????? HSSFCell cell_014_007 = row_014.createCell((short) 7);
    ??????? HSSFCell cell_014_008 = row_014.createCell((short) 8);
    ??????? HSSFCell cell_014_027 = row_014.createCell((short) 27);
    ???????
    ??????? hssfSheet.addMergedRegion(new Region(14, (short) 1, 14, (short) 7));
    ??????? hssfSheet.addMergedRegion(new Region(14, (short) 8, 14, (short) 27));
    ???????
    ??????? // 15 row
    ??????? HSSFRow row_015 = hssfSheet.createRow(14);
    ???????
    ??????? HSSFCell cell_015_001 = row_015.createCell((short) 1);
    ??????? HSSFCell cell_015_007 = row_015.createCell((short) 7);
    ??????? HSSFCell cell_015_008 = row_015.createCell((short) 8);
    ??????? HSSFCell cell_015_027 = row_015.createCell((short) 27);
    ???????
    ??????? hssfSheet.addMergedRegion(new Region(15, (short) 1, 15, (short) 7));
    ??????? hssfSheet.addMergedRegion(new Region(15, (short) 8, 15, (short) 27));
    ???????
    ??????? // 16 row
    ??????? HSSFRow row_016 = hssfSheet.createRow(14);
    ???????
    ??????? HSSFCell cell_016_001 = row_016.createCell((short) 1);
    ??????? HSSFCell cell_016_007 = row_016.createCell((short) 7);
    ??????? HSSFCell cell_016_008 = row_016.createCell((short) 8);
    ??????? HSSFCell cell_016_027 = row_016.createCell((short) 27);
    ???????
    ??????? hssfSheet.addMergedRegion(new Region(16, (short) 1, 16, (short) 7));
    ??????? hssfSheet.addMergedRegion(new Region(16, (short) 8, 16, (short) 27));
    ???????
    ??????? // 17 row
    ??????? HSSFRow row_017 = hssfSheet.createRow(14);
    ???????
    ??????? HSSFCell cell_017_001 = row_017.createCell((short) 1);
    ??????? HSSFCell cell_017_007 = row_017.createCell((short) 7);
    ??????? HSSFCell cell_017_008 = row_017.createCell((short) 8);
    ??????? HSSFCell cell_017_027 = row_017.createCell((short) 27);
    ???????
    ??????? hssfSheet.addMergedRegion(new Region(17, (short) 1, 17, (short) 7));
    ??????? hssfSheet.addMergedRegion(new Region(17, (short) 8, 17, (short) 27));
    ???????
    ??????? // 18 row
    ??????? HSSFRow row_018 = hssfSheet.createRow(14);
    ???????
    ??????? HSSFCell cell_018_001 = row_018.createCell((short) 1);
    ??????? HSSFCell cell_018_007 = row_018.createCell((short) 7);
    ??????? HSSFCell cell_018_008 = row_018.createCell((short) 8);
    ??????? HSSFCell cell_018_027 = row_018.createCell((short) 27);
    ???????
    ??????? hssfSheet.addMergedRegion(new Region(18, (short) 1, 18, (short) 7));
    ??????? hssfSheet.addMergedRegion(new Region(18, (short) 8, 18, (short) 27));
    ???????
    ??????? // 19 row
    ??????? HSSFRow row_019 = hssfSheet.createRow(14);
    ???????
    ??????? HSSFCell cell_019_001 = row_019.createCell((short) 1);
    ??????? HSSFCell cell_019_007 = row_019.createCell((short) 7);
    ??????? HSSFCell cell_019_008 = row_019.createCell((short) 8);
    ??????? HSSFCell cell_019_027 = row_019.createCell((short) 27);
    ???????
    ??????? hssfSheet.addMergedRegion(new Region(19, (short) 1, 19, (short) 7));
    ??????? hssfSheet.addMergedRegion(new Region(19, (short) 8, 19, (short) 27));
    ???????
    ??????? // set style
    ??????? cell_001_000.setCellStyle(cellStyle_title());
    ???????
    ??????? // set encoding
    ??????? cell_001_000.setEncoding(HSSFCell.ENCODING_UTF_16);
    ?
    ??????? // set value
    ??????? cell_001_000.setCellValue("テクス");
    ??? }

    ??? /**
    ???? * @return style_title
    ???? */
    ??? private HSSFCellStyle cellStyle_title() {
    ??????? HSSFCellStyle style_title = hssfWorkbook.createCellStyle();
    ??????? style_title.setFont(getFont_title());
    ??????? style_title.setVerticalAlignment(HSSFCellStyle.ALIGN_CENTER);
    ??????? return style_title;
    ??? }

    ??? /**
    ???? * @return font_title
    ???? */
    ??? private HSSFFont getFont_title() {
    ??????? HSSFFont font_title = hssfWorkbook.createFont();
    ??????? font_title.setFontName(fontName);
    ??????? font_title.setFontHeightInPoints(fontTitleSize);
    ??????? font_title.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
    ??????? return font_title;
    ??? }
    }
    ~@_@

    posted on 2006-09-19 17:13 Warren.Wu 閱讀(316) 評(píng)論(0)  編輯  收藏

    只有注冊(cè)用戶登錄后才能發(fā)表評(píng)論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 国产成人免费爽爽爽视频| 18禁无遮挡无码网站免费| 免费一级肉体全黄毛片| 亚洲成a人片在线观看老师| 亚洲GV天堂无码男同在线观看| 成在人线AV无码免费| 亚洲欧洲日产国码久在线| 十八禁的黄污污免费网站| 91麻豆国产免费观看| 国产免费观看黄AV片| 老汉色老汉首页a亚洲| 免费国产黄网站在线看| 亚洲阿v天堂在线2017免费| 曰批免费视频播放在线看片二| 亚洲色偷偷狠狠综合网| 一级毛片a免费播放王色| 亚洲色欲色欲www在线丝| 日韩免费电影网址| 国产精品国产免费无码专区不卡| 亚洲av永久无码一区二区三区| 四虎影视永久免费观看地址| 九九久久精品国产免费看小说| 亚洲亚洲人成综合网络| 91久久精品国产免费一区| 亚洲午夜一区二区三区| 国产一区二区免费在线| 中文字幕一区二区免费| 免费一级黄色毛片| 国产成人久久AV免费| 亚洲 日韩经典 中文字幕| 亚洲?v无码国产在丝袜线观看| 你懂得的在线观看免费视频| 亚洲午夜电影一区二区三区| 成全视成人免费观看在线看| 国产yw855.c免费视频| 国产又黄又爽又大的免费视频| 亚洲欧洲国产视频| 最近免费中文字幕大全免费版视频| 亚洲综合久久一本伊伊区| 亚洲日韩在线第一页| 亚洲视频免费观看|