JAVA原始的匯出excel檔案,快捷通用 方便 還可以匯出word文檔哦,excelword

來源:互聯網
上載者:User

JAVA原始的匯出excel檔案,快捷通用 方便 還可以匯出word文檔哦,excelword

現在匯出excel基本上都是用poi了,當報表格式很負責的時候 開發難度會加大

如果報表有格式有變化 那就更複雜了,先發現一個很老的技術,可以解決格式複雜的報表。

執行個體代碼如下:

<%@ page contentType="application/vnd.ms-excel;charset=GBK" %><%@page import="java.net.URLEncoder"%><%String filedisplay = "檔案.xls"; filedisplay = URLEncoder.encode(filedisplay, "UTF-8"); response.addHeader("Content-Disposition", "attachment;filename=" + filedisplay); %><!doctype html><html><head><title>匯出Excel執行個體</title><style>tr td{border:1px red double;}</style></head><body><table style="border:1px"><tr><td>ID</td><td>名稱</td><td>性別</td><td>年齡</td></tr><tr><td>1</td><td>張三</td><td>男</td><td>18</td></tr><tr><td>2</td><td>張三</td><td>男</td><td>18</td></tr><tr><td>3</td><td>張三</td><td>男</td><td>18</td></tr><tr><td>4</td><td>張三</td><td>男</td><td>18</td></tr></table></body></html>



java怎實現匯出資料後放到word文檔中,並且可以儲存到本硬碟上(類似於百度文庫裡面的下載功可以)

可以試試用apache的poi來產生word檔案,個人沒用過poi
至於下載,你可以設定檔案的類型是word文檔嘛
 
word文檔中包含的例如rar,excel,以及其他附件,怎把它從word文檔中匯出儲存?

找到那個檔案,雙擊,會開啟那些檔案,然後 在對應程式中 另存新檔。。。 就ok了
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.