| Author |
showing in Excel Sheet
|
amanb amanb
Greenhorn
Joined: Jan 30, 2003
Posts: 1
|
|
public ExcelReport(HttpSession session, HttpServletResponse res, Vector membershipList, Vector investmentList) throws IOException { // BoardMember object declaration // Set content tyoe to type ms-excel res.setContentType("application/vnd.ms-excel"); //res.setContentType("application/msword"); // instantiate printwriter //PrintWriter out = res.getWriter(); ServletOutputStream out = res.getOutputStream(); // Retrieve membership list from the current session //Vector membershipList = (Vector)session.getValue(Constants.LIST); // Set header to the Excel report System.out.println("**************In Excel Report******************************"); InvestmentDisclosure invDisc; // Declare company, number of shares, total amount invested and status String userName = ""; String companyName = ""; String noOfShares = ""; String totalAmount = ""; String invStatus = ""; // Set header to the Excel report out.println("Name\tCompany\tNumber of Shares\tTotal Amount Invested\tStatus"); // And display in a tab delimited format for (int i=0;i<investmentList.size();i++) { invDisc = (InvestmentDisclosure)investmentList.elementAt(i); userName = invDisc.getFullName(); companyName = ((Company)invDisc.getCompany()).getCompanyName(); noOfShares = invDisc.getPlannedSharesNum(); totalAmount = invDisc.getInvDollarAmt(); invStatus = invDisc.getInvestmentStatus(); out.println(userName.trim() + "\t" + companyName.trim() + "\t" + noOfShares.trim() + "\t" + totalAmount.trim() + "\t" + invStatus.trim()); } } The above is code I have written to show the output in Excel Sheet But I don't know the content type is set to normal text and I don't see an Excel sheet and the output is shown in plain text..... Can u please help me out Urgent............
|
 |
 |
|
|
subject: showing in Excel Sheet
|
|
|