1. Display webpage data in an Excel report in the form of online browsing
<% @ Page contenttype = "application/MSExcel" %> <br/> <! -- In the preceding line, set this webpage to an Excel webpage --> <br/> <% <br/> response. setheader ("content-disposition", "inline; filename=test1.xls"); <br/> // test1.xls is the file used for transferring data to the browser. <br/> // This line is used, enable the front-end browser to receive an Excel file <br/>%> <br/> <HTML> <br/> <pead> <br/> <title> Excel file presentation mode </title> <br/> </pead> <br/> <body> <br/> <Table border = "1" width = "100%"> <br/> <tr> <br/> <TD> name </TD> <TD> ID card size </TD> <TD> birthday </TD> <br/> </tr> <br/> <tr> <br/> <TD> Li Yun </TD> <TD> n111111111 </TD> <TD> 1900/11/12 </TD> <br/> </tr> <br/> <TD> Liang jingru </TD> <TD> n222222222 </TD> <TD> 1923/10/1 </TD> <br/> </tr> <br/> <TD> Zhang huimei </TD> <TD> n333333333 </TD> <TD> 1934/12/18 </ TD> <br/> </tr> <br/> </table> <br/> </body> <br/> </ptml>
2. Use an Excel report to download and present webpage Materials
This JSP file is similar to the previous one. Only the difference lies in this line:
Online browsing: Response. setheader ("content-disposition", "inline; filename=test1.xls ");
Download Method: Response. setheader ("content-disposition", "attachment; filename=test2.xls ");
Note: 1. the Excel files are displayed only on static Web pages. With the help of the database, you can use dynamic reports to make EXCEL reports.
2. There is no need to install any components at all, or it can only be restricted to the win platform. A simple solution to your report needs
3. If you are smart, you should be able to show your website information in Word doc format!
(Do you only need to change contenttype to "application/MSWord" and the filename's subdocument name to .doc !)