| Author |
Printing contents
|
Shailesh Pillai
Ranch Hand
Joined: Jan 24, 2006
Posts: 78
|
|
Hello Ranchers, Can anyone suggest me how to print the contents i have on my jsp page to a printer.
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56191
|
|
|
On the client or the server?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Shailesh Pillai
Ranch Hand
Joined: Jan 24, 2006
Posts: 78
|
|
|
Both, on the client as well as on the server.
|
 |
GS Chidam
Ranch Hand
Joined: Jul 07, 2006
Posts: 34
|
|
hi, If your jsp page contain the data, just export to excel using jxl.write, Class WritableWorkbook, then print. What is your jsp contain? How you want to print?
|
 |
Shailesh Pillai
Ranch Hand
Joined: Jan 24, 2006
Posts: 78
|
|
My jsp displays data(from database) in a tabular format. In my jsp page, I do have some headings and other stuff, but i only want the data in tabular format to be printed. How about the PrinterJob class?
|
 |
Chetan Parekh
Ranch Hand
Joined: Sep 16, 2004
Posts: 3636
|
|
|
Use JasperReports with iReport.
|
My blood is tested +ve for Java.
|
 |
GS Chidam
Ranch Hand
Joined: Jul 07, 2006
Posts: 34
|
|
using jxl.write, just export to excel then print. Already you are having jsp display data in the List isn't, use that data, Export to excel. The example code something like this. response.setContentType("application/vnd.ms-excel;charset=UTF-8"); response.setHeader("Content-Disposition", "attachment;filename=dfs.xls"); WritableWorkbook w = Workbook.createWorkbook(response.getOutputStream()); WritableSheet s = w.createSheet("sheet name", 0); WritableFont wfTitle = new WritableFont( WritableFont.ARIAL, 14); Label l1; WritableCellFormat cfTitle = new WritableCellFormat(wfTitle); l1= new Label(0,0,"abc",cfTitle); s.addCell(l1);
|
 |
Shailesh Pillai
Ranch Hand
Joined: Jan 24, 2006
Posts: 78
|
|
|
Thanks all for your reply.
|
 |
 |
|
|
subject: Printing contents
|
|
|