excel匯出功能

2021-08-08 06:59:10 字數 2624 閱讀 7731

1:pom.xml匯入依賴

org.apache.poi

poi$

org.apache.poi

poi-ooxml //本地倉庫位置

$

2:controller

@apioperation(value = "分析資料**匯出", httpmethod = "get", notes = " 說明:匯出csv格式資料", response = string.class)

@responsebody

public string passengerflowdatagridexport(@apiparam(required = true, name = "datetype", value = "日期型別", defaultvalue = "day",

allowablevalues = "day") @requestparam(required = true) string datetype,

@apiparam(required = false, name = "starttime", value = "開始時間", defaultvalue = "2017-06-10")

@requestparam(required = false) string starttime,

@apiparam(required = false, name = "endtime", value = "結束時間", defaultvalue = "2017-06-11")

@requestparam(required = false) string endtime,

@apiparam(required = true, name = "storecode", value = "門店編碼", defaultvalue = "871l")

@requestparam(required = true) string storecode

),starttime:{},endtime:{},storecode:{}" , datetype ,starttime ,endtime ,storecode);

storefrontqueryparam queryparam = new storefrontqueryparam(datetype, starttime, endtime, storecode);

storefrontpassengerflowanalysisservice.datagridexport(queryparam, response);

logger.info("datagridexport costs:" + (system.currenttimemillis() - begin) + " ms");

return null;

}

3:service:

@override

//資料匯出

** @param queryparam 查詢引數

* @return

*/@override

//**資料

public storefrontpassengerflowanalysisdatagridvo datagrid(storefrontqueryparam queryparam)

//多天處理

else if (queryparam.getstorefrontquerydatetype()== storefrontanalysisquerydatetype.day_more)

else

//獲取返回的結果

list> datagrids = processor.getdatagrid();

storefrontpassengerflowanalysisdatagridvo.setdata(datagrids);

storefrontpassengerflowanalysisdatagridvo.setrecordstotal(datagrids.size());

logger.info("end datagrid costs:{} ms",(system.currenttimemillis() - begin));

return storefrontpassengerflowanalysisdatagridvo;

}

/**

* 建立excel表頭

** @param datarow 行資料

*/public void createexcelheader(sxssfworkbook workbook,sxssfrow datarow)

Vue匯出excel功能

exporttable require.ensure 表頭集合 const theader 站名 設計規模 萬噸 日 處理水量 萬噸 符合率 表中的prop值 const filterval stnm designscale watertreatment coincidencerate table中...

JSF 匯出excel功能

前台頁面標籤 後代邏輯 只留下核心 public string export 要匯出的資料 每列的名字,根據你頁面中真是資料編輯 getexcel title,header0,beanlist,out,生成excel 的方法 setrunmessage stopwait catch exceptio...

POI實現excel匯出功能

export工具類 public void exportutil 設定sheet表頭資訊 param titlesinfo 表頭的string陣列 param sheet public static void outputheaders string titlesinfo,hssfsheet she...