欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

怎么解決java導(dǎo)出excel時(shí)文件名亂碼

java解決導(dǎo)出Excel時(shí)文件名亂碼的方法示例:

成都創(chuàng)新互聯(lián)公司堅(jiān)持“要么做到,要么別承諾”的工作理念,服務(wù)領(lǐng)域包括:成都網(wǎng)站建設(shè)、成都網(wǎng)站制作、企業(yè)官網(wǎng)、英文網(wǎng)站、手機(jī)端網(wǎng)站、網(wǎng)站推廣等服務(wù),滿足客戶于互聯(lián)網(wǎng)時(shí)代的梅河口網(wǎng)站設(shè)計(jì)、移動媒體設(shè)計(jì)的需求,幫助企業(yè)找到有效的互聯(lián)網(wǎng)解決方案。努力成為您成熟可靠的網(wǎng)絡(luò)建設(shè)合作伙伴!

String agent = request.getHeader("USER-AGENT").toLowerCase();
   response.setContentType("application/vnd.ms-excel");
   String fileName = "文件名";
   String codedFileName = java.net.URLEncoder.encode(fileName, "UTF-8");
   if (agent.contains("firefox")) {
           response.setCharacterEncoding("utf-8");
           response.setHeader("content-disposition", "attachment;filename=" + new String(fileName.getBytes(), "ISO8859-1") + ".xls" );
  } else {
          response.setHeader("content-disposition", "attachment;filename=" + codedFileName + ".xls");
   }

encode() 方法以指定的編碼格式編碼字符串。

擴(kuò)展:

Java POI導(dǎo)出Word文檔代碼

pom.xml:

<dependency>

<groupId>org.apache.poi</groupId>

<artifactId>poi</artifactId>

<version>3.14</version>

</dependency>

<dependency>

<groupId>org.apache.poi</groupId>

<artifactId>poi-ooxml</artifactId>

<version>3.14</version>

</dependency>

<dependency>

<groupId>org.apache.poi</groupId>

<artifactId>poi-ooxml-schemas</artifactId>

<version>3.14</version>

</dependency>

<dependency>

<groupId>org.apache.poi</groupId>

<artifactId>poi-scratchpad</artifactId>

<version>3.14</version>

</dependency>

Controller:

@Transactional(propagation=Propagation.SUPPORTS)

@ResponseBody

@RequestMapping("/ExportInterpretationSignsWord")

public  ResponseEntity<byte[]>  ExportInterpretationSignsWord(@RequestParam String token,HttpServletRequest request,

HttpServletResponse response,

@RequestParam int id) throws IOException{

response.setContentType("text/html;charset=UTF-8");   

    response.setHeader("Content-type", "application/json;charset=UTF-8");

    if(redisPool.checkToken(token)==false) {

    return null;

    }

ResponseEntity<byte[]> temp=buildService.ExportInterpretationSignsWordById(id);

return temp; 

}

以上就是java導(dǎo)出excel時(shí)出現(xiàn)文件名亂碼解決方法的詳細(xì)內(nèi)容,更多請關(guān)注創(chuàng)新互聯(lián)其它相關(guān)文章!

分享標(biāo)題:怎么解決java導(dǎo)出excel時(shí)文件名亂碼
地址分享:http://www.chinadenli.net/article48/gooshp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計(jì)網(wǎng)站內(nèi)鏈網(wǎng)站制作企業(yè)網(wǎng)站制作品牌網(wǎng)站制作定制開發(fā)

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

網(wǎng)站托管運(yùn)營