poi 生成excel報表一般步驟

2021-08-25 20:08:56 字數 1716 閱讀 9999

//表題

//表頭

//資料

//合併區域

//是否顯示網格線

//行號

//外邊框加粗

//內邊框普通

//設定列印區域

//列印設定

public static  workbook getworkbook(projectstatreporter reporter)

}//y資料

for(int i=0;i}

} //合併區域

sheet.addmergedregion(new cellrangeaddress(0,1,0,0));//左上角的空白

for(int i=0;i//樣式:不顯示網格線 居中 行號25.5 外邊框加粗 內邊框普通 row0 1 字型宋體加粗 col 1 字型宋體加粗

//不顯示網格線

sheet.setdisplaygridlines(false);

//居中 row0 1 字型宋體加粗 col 1 字型宋體加粗

//呼叫createcell()

//行號25.5

for(int i=0;i<2+y.size();i++)

//外邊框加粗

cellrangeaddress region=new cellrangeaddress(0,2+y.size()-1,0,x.size()*f.size());

regionutil.setborderbottom(cellstyle.border_thick, region, sheet, workbook);

regionutil.setborderleft(cellstyle.border_thick, region, sheet, workbook);

regionutil.setborderright(cellstyle.border_thick, region, sheet, workbook);

regionutil.setbordertop(cellstyle.border_thick, region, sheet, workbook);

//內邊框普通

//呼叫createcell() 中設定

//返回

//測試

sheet sheet1 = workbook.createsheet("new sheet");

sheet1.grouprow( 5, 14 );

sheet1.grouprow( 7, 14 );

sheet1.grouprow( 16, 19 );

sheet1.groupcolumn( (short)4, (short)7 );

sheet1.groupcolumn( (short)9, (short)12 );

sheet1.groupcolumn( (short)10, (short)11 );

return workbook;

}

private static void createcell(workbook wb, row row, int column, short halign, short valign,string text)

private static void createcell(workbook wb, row row, int column, short halign, short valign,richtextstring richtext)

一般Excel匯出功能

public class excelutil 產生 標題行 hssfrow row sheet.createrow 0 for int i 0 i headers.length i if null datalist for int i 0 i datalist.size i else workboo...

delphi對於excel的一般操作

單元格設定 1.設定單元格線框 excel.activesheet.range b10 c13 borders n linestyle xlnone excel.activesheet.range b10 c13 borders n weight xlthin 邊框的型別 borders n xle...

zz Unix下編寫Socket程式一般步驟

unix下編寫socket程式的一般步驟 ackarlix 理解幾個常用的socket函式 include include int socket int domain,int type,int portocol domain指所使用的協議族 family 可以為af unix和af inet,一般只...