我的匯出模板

2021-07-07 03:18:19 字數 1366 閱讀 8645

// 表頭

string title = new string ;

hssfworkbook book = new hssfworkbook();

hssfsheet sheet = book.createsheet("船舶基本資訊");

hssfrow titlerow0 = sheet.createrow(0);// 第一行 實施部門

titlerow0.setheightinpoints(20);// 第一行行高

// 字型

hssffont font = book.createfont();

font.setfontname("宋體");

font.setfontheightinpoints((short) 10);// 字型大小

font.setboldweight(hssffont.boldweight_bold);// 加粗

// 風格

hssfcellstyle style = book.createcellstyle();

style.setfont(font);

style.setalignment(hssfcellstyle.align_center);// 左右居中

style.setverticalalignment(hssfcellstyle.vertical_center);// 上下居中

for (int i = 0; i < title.length; i++) else

cell.setcellstyle(style);

cell.setcellvalue(title[i]);

}hssfcellstyle cellstringstyle = book.createcellstyle();

cellstringstyle.setalignment(hssfcellstyle.align_center);// 左右居中

cellstringstyle.setverticalalignment(hssfcellstyle.vertical_center);// 上下居中

for (int i = 0; i < problems.size(); i++) }}

response.setheader("content-disposition", "attachment; filename=" + new string("船舶基本資訊匯出".getbytes("gb18030"), "iso-8859-1") + ".xls");

servletoutputstream out = response.getoutputstream();

book.write(out);

out.flush();

out.close();

C excel模板匯出

環境 vs2010 excel2010 要引用microsoft excel 14.0 object liberty 引用的命名空間 using system using system.collections.generic using system.componentmodel using sys...

匯出帶有模板的repeator

region 建立單元格 private htmltablecell creatcell string innertext private htmltablecell creatcell int type,string innertext private htmltablecell creatcel...

我用的「模板」

php裡面有乙個很流行的詞 模板 所謂 模板 是一種在web開發中將html檔案和指令碼分離的一種做法,試圖更清楚的劃分程式設計師和美工的界限,等等功能。我一直很鬱悶的就是,寫程式的時候必須在模板和php之間來回奔波,每用一種模板,都要適應它們的語法,抱怨它們的不足。至於模板的好處,我就不說了,網上...