Open excel sheets in separate windows by clicking link.

Hi,
I have a web page which has a link. When user clicks on the link, a servlet is invoked that creates an excel sheet and opens it in MS-Excel. I used "res.setContentType("application/vnd.ms-excel");" to achieve this.
But every time I click the link it opens up the sheet on the same MS-Excel window. It doesn't open up the excel sheet in new other window.
Now here is my requirement: Whenever user clicks on the link, a new MS-Excel window should open up containing the excel sheet. So if user clicks the link 3 times, then 3 separate window should open up each containing its own excel sheet.
Can anyone help me out in achieving this?
Thanks in advance...

Hi, try this
In JSP/HTML
Export To Excel
In Servlet
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-disposition","attachment; filename=MyProjectExport.xls" );
In web.xml
  <servlet>
    <servlet-name>excelservlet</servlet-name>
    <servlet-class>myPackage.ExcelServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>excelservlet</servlet-name>
    <url-pattern>/MyProjectExport.xls</url-pattern>
  </servlet-mapping>Assuming I haven't made any typos obfuscating the real packages, it
should work. I think the step you are missing is to add the servlet
mapping so that the servlet name is MyProjectExport.xls
In the example above, I've made my servlet name match the filename in
the Content-disposition, though in my real application it deosn't seem to
matter that they don't match. In the html, you link to the name of the
servlet, rather than the filename, but if you name them the same, I
guess it won't matter.
Arth

Similar Messages

  • Windows 7 - Open Excel 2010 in separate window

    Setup:
    Windows 7 Ent.
    2 monitors in extended desktop mode
    Office 2010
    Opening Excel Files from multiple sources (Outlook 2010, Desktop, OneNote 2010, etc.)
    New laptop with 12GB of RAM
    i7 Quad Proc.
    Problem:
    By default, all of my Excel books open in the same window of Excel.  I open lots of sheets that need visual side-by-side comparison.  I want every every Excel book I open to have its own Excel window.  It doesn't necessarily need to be it's
    own running instance of the binary, but it's own separate window that I can minimize, maximize, resize, or close independently of the other Excel windows.
    I've tried the registry fixes for DDE.  I've tried the "Ignore other applications with DDE" option in Excel.  Both of those solutions give the desired multi-window result, but both break my ability to open spread sheets from OneNote and
    Outlook.  The error for OneNote is "OneNote has encountered a problem and cannot complete this operation", when I double click an embedded Excel file.
    Question:
    Is it possible to get Excel to open a new window for each file without disabling DDE or breaking my ability to open embeddede spreadsheets from other applications like Outlook and OneNote?  The "Put Excel into windowed mode and drag it across multiple
    monitors" work around is not feasible since I run two different sized monitors.

    Not necessarily an ideal solution, but the only way I've found with Excel 2010 is to open a second instance of Excel, which will then allow you to move it to the second screen and either open your spreadsheets from there, or drop and drop them into
    the required copy of Excel from Outlook/OneNote. Annoyingly with Excel 2010 by default it only opens one instance of Excel and then all workbooks you open after then are opened within that same instance, but if you select Excel from the start menu it will
    open a second (or third, or forth etc) instance which can be moved and handled independently.
    The other option would be to upgrade to Excel 2013 since that doesn't have that limitation, but that may be an expensive way around the issue!

  • I want to open a folder in a separate window by clicking on it.  For some reason when I click on a folder it just replaces the one I was just in.  I want them both to be open at the same time without having to go through several steps.

    I want to open a folder in a separate window by clicking on it.  For some reason when I click on a folder it just replaces the one I was just in.  I want them both to be open at the same time without having to go through several steps. Old apple operating systems made it easy to have several folders open at one time. 

    Eric, thanks that works but seems like an extra added step also to do it that way.  I've got to move and organize a ton of files and I'm looking for a easy way to get this done.  I could also open the folder into a separate tab and then drag the tab out so it becomes an open window but thats a lot of fussing around also with extra steps.  Not sure why these newer operating system seems more confusing and less user friendly than what they used to.  In the past I could just click on any folder and it would open in a separate window making it really easy to copy or move files from one place to the other just by simply dragging them from one window to the other.  Seems like I'm going through several extra steps now to do a simple task. 

  • Problem in opening excel file in different window

    hi
    i want to open excel file in different window it open in same window properly on the bases of condition but when i try to open in different with window.open( )
    it give error that file has already used or path not exist OR requisted site either unavailable
    how can i rectified

    Hi.
    I am too facing the same problem. I am using Jakarta Poi to display my resultset in an excel sheet directly(and not into a jsp)
    The browser opens a window showing Open Save Cancel. If i click and save the excel sheet and then open, it opens. But clicking on Open directly doesnt open the excel sheet. Rather it gives the same error
    The file name or path name does not exist.
    The file you are trying to open is being used by another progrtam . close the document in other program and try again
    The name of the work book your tring to save is the same as name of another document that is readonly .try saving workbook with different name
    Can somebody please help me fix this problem, since its an urgent requirement. Mail me at [email protected]
    Thanks
    Hitesh

  • Opening Excel sheet from server

    Hi I have one requirement to open Excel Sheet.
    The Excel sheet is residing in a directory parallel to WEB-INF. I am using Jboss server in Linux. in UI whenever I click on link I have to open Excel sheet from the server. Before opening Excel sheet I have to fill with some data. i am using JSP/Servlets .
    Can any one help me on this?
    Guru

    this piece of code is just open a xsl file with writing some data on the file
    it may be helpful for u .i am giving only logic.
    import java.util.*;
    import java.io.* ;
    import java.text.* ;
    public class a{
         // Main method
         public static void main (String args[])
              // Stream to write file
              //File file;
              FileWriter fout;
              String TimeStamp;
              try
              // Open an output stream
              Calendar currentdate= Calendar.getInstance();
                   int currmonth=currentdate.get(Calendar.MONTH)+1;
                   String strMonth="";
                   if(currmonth<10)
                        strMonth="0"+currmonth;
                   String wbname="Equifax"+strMonth+currentdate.get(Calendar.YEAR)+".xls";
                   System.out.println(wbname);
              BufferedWriter outfile = new BufferedWriter(new FileWriter(wbname));
                   //file=new File(filename);
                   fout = new FileWriter (wbname);
              // Print a line of text
              TimeStamp = new java.util.Date().toString();
              //String filename1=file.getName();
              outfile.write(" Apply ");
              // Close our output stream
              outfile.close();          
              // Catches any error conditions
              catch (IOException e)
                   System.err.println ("Unable to write to file");
                   System.exit(-1);
    }

  • Installing Control Panel 2/3 causes problems in opening Excel sheets

    After installing the control panel 3.0, I can't open Excel sheets properly anymore. A message says that the Excel sheet contains corrupted data and Excel can try to restore them. After confirming this, the excel sheet shows opened but all formating is gone.
    I had this issue yet with Control Panel 2.0. After some research on the web I found out that the problem is caused by the CP for Windows. I then switched back to CP V 1.1.4 and the excel sheets opened properly again.
    Thanks for any advise. I'm using Windows 7 and Excel/Outlook 2007.

    You are downloading software illegally. ShapeShifter is shareware so unless you indicate that you paid for it I don't feel it is appropriate to post your issue in this forum setting.

  • EXCEPTION RAISED WHILE OPENING EXCEL SHEET FROM E-BUSINESS SUITE FORM

    Hi,
    I got error message ORA-10656I when was trying to open excel sheet which is in my local drive from e-business suite form. the following is the code where it is raising error.
    Appid := dde.app_begin('C:\Program Files\Microsoft Office\Office12\EXCEL.EXE '||'D:\emp.xls' ,dde.app_mode_normal);
    Oracle EBS version : 11.5.10.2cu
    Server : HP
    OS : HP Unix 11.11
    Could anyone help me out
    Thanks

    Two different forum users, exactly the same question? Hardly possible. So I guess this is just a double post.

  • Upgraded Exchange to CU 7, now users cannot open emails in a separate window in webmail (OWA).

    Hello,
    Strange issue. I upgraded our Exchange 2013 to CU 7 and now users are reporting they cannot open emails in a separate window in OWA. Regardless of browser, browser version even regardless of another computer or mac. Chrome, Firefox, IE, Safari...same
    issue regardless of version numbers also.
    I've tested these settings on several laptops and I cannot open emails in a separate window. This happened a day after the upgrade. Previously this was working for all users. Now its hit or miss. Not all users are affected however. My mailbox/account is
    also a victim so I can test any theories out.
    Any suggestions would help and be appreciated.
    Thanks,

    Hi,
    Please check if there is any error message when these affected users try to open mail in a new window.
    Please check if these users can open messages in Outlook. This can help us to narrow the issue.
    And please check the aplication log in Exchange server to see if there is events related to this problem, which can help us to troubleshoot the issue.
    Best regards,
    If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Belinda Ma
    TechNet Community Support

  • Open project document in separate window.

    Hellow!
    I use solutiom manager to support project documentation.
    When I open document for editing it is opened in the same window (right side). And if doc type is word, it is hard to work because only part of window is used for text.
    If I attach document in customizing tab it is opened for edeting in separate window! It is very comfortable.
    Could I make solution manger open docs in separate windows from project docs tab?
    Andrey Garshin.

    Hi,
    You can do this by changing the user settings
    by go to solar02-> utilities-> user settings -> In the dialog box that pops up, go to the section 'General Settings' and please check the following two boxes, @Separate Document Display window,@ Separate Document Maintenance window
    plese check
    Thanks,
    Jansi

  • Problem when opening excel sheet in jsp

    Hi friends
    When i try to open excel sheet from my program I am getting two problems
    1. first row of excel sheet is empty
    2. while opening I am getting error message of "the file is not in a recognizable format"
    Please help me..It is an urgent work
    my code
    <%@page language="java" import="java.io.*,java.text.*,java.sql.*,java.util.*"%>
    <%
    Class.forName("org.gjt.mm.mysql.Driver");
    Connection conn = DriverManager.getConnection("jdbc:mysql://256.136.119.86/mydb","zzz","zzz");
    Statement st = conn.createStatement();
    StringBuffer sb = new StringBuffer();
    sb.append("SAP#" + "\t");
    sb.append("x-plant status" + "\t");
    sb.append("Total Amount" +"\t");
    sb.append(">90 days" + "\t");
    sb.append("\n");
    try
    String query="select * from temp_Xplant";
    ResultSet rs = st.executeQuery(query);
    while(rs.next()){
    sb.append(rs.getString("sapNo") + "\t");
    sb.append(rs.getString("status")+ "\t");
    sb.append(rs.getString("amt") + "\t");
    sb.append(rs.getString("days") + "\t");
    sb.append("\n");
    conn.close();
    st.close();
    catch (Exception e)
    out.println("error");
    conn.close();
    st.close();
    response.setContentType("application/vnd.ms-excel");
    // response.setHeader("Content-Disposition", "attachment; filename=\"test.xls\"");
    String testt = "tests.xls";
    response.setHeader("Content-Disposition", "attachment; filename="+testt);
    out.println(sb.toString());
    out.close();
    %>
    thanks in advance

    The problem here is, you have setted the content type as excel sheet and you are writing some String content into the output stream. when excel tries to read the String content it will surely throw some error. Lot of excel APIs are available in the market to generate excel sheets.
    you can find one in the below URL.
    http://www.teamdev.com/downloads/jexcel/docs/JExcel-PGuide.html

  • When I open mac mail, it opens 1000 emails in separate windows. Emails that are not even in my account anymore. Can anyone help?

    When I open mac mail, it opens 1000 emails in separate windows. Emails that are not even in my account anymore. The system freezes and the only thing I can do is force quit. Can anyone help?

    You should post in the Mail forum area of whichever os is installed on your computer.

  • How to open Excel Sheet using JSP?

    Hi Dear,
    I want to open Excel Sheet in client browser, How to do this using JSP?
    If it is possible to open, client can make the changes in the sheet if he saves those changes, those changes must reflect on server.
    So pl. tell me how to do this?
    Thanks

    The following code gets data from an ODBC link to an Excel spreadsheet and displays it as a HTML table. You can modify the table to include <input> fields to update the spreadsheet when the form is submitted.
    I hope that this helps. -Don
    <%
    /* Establish connection to excel database(spreadsheet)
    ODBC DSN="xltest" */
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    java.sql.Connection con= java.sql.DriverManager.getConnection("jdbc:odbc:xltest");
    java.sql.Statement st = con.createStatement();
    java.sql.ResultSet rs = st.executeQuery("SELECT * from [Sheet1$]");
    java.sql.ResultSetMetaData rsmd = rs.getMetaData();
    %>
    <html>
         <head><title>Excel Database connection test</title></head>
         <body><table border=1 cellspacing=0><tr>
    <% // Print Column headings (first row of spreadsheet)
    for (int i = 1; i <= rsmd.getColumnCount(); i ++){
              %><td id='td1'><%=rsmd.getColumnName(i)%></td><%
    }//End for
    %></tr><%
    while(rs.next()) { // Print row data
    %><tr><%
         for (int i = 1; i <= rsmd.getColumnCount(); i ++) {
                   %><td id='td2'> <%=rs.getString(i)%></td><%;}// End for
    }//End while
    st.close();
    con.close();
    %>
    </tr></table></body></html>

  • Mail: Clicking a message in Inbox should open it in a separate window (not just  in lower pane). This stopped working after an automatic update of OS(10.6.8). Suggestions?

    Before updating software (10.6.8), in Mail, clicking a message in the inbox caused the message to appear in its own separate window-- not just in the pane below the inbox. I'm not sure why this function is no longer available. I guess I could delete Preferences (where?) and see if that does it. Any ideas?
    Thanks,
    Nick

    Before updating software (10.6.8), in Mail, clicking a message in the inbox caused the message to appear in its own separate window-- not just in the pane below the inbox.
    Uh…no it didn't. Double-clicking a message would open it in a new window. Regardless of whether you have the message pane visible, you still have to double-click the message if you want it to open in it's own message window.
    I guess I could delete Preferences (where?) and see if that does it.
    No, you can't do that; not unless you want to say bye-bye to all your email. Don't even think about messing around with things unless you know what you're doing, and the consequences.

  • Not able to open excel file in new window any one plese help me as early

    Hi all,
    I have a imag tag in jsp on click on the image i am submitting the form
    1. i have used the below code
    HSSFWorkbook wb=viewHelper.getExcel();
    response.reset();
    ServletOutputStream outs = response.getOutputStream();
         response.setContentType("application/vnd.ms-excel");
         response.addHeader("Pragma", "No-cache");
         response.addHeader("Cache-control", "no-cache");
         response.addDateHeader("Expires",1 );
         wb.write(outs);
         outs.flush();
         outs.close();
         return;
    2. I got one dialog box to open ,save,cancel . if i try to open it is openeing in the same window i had made the request. i need it to ask for in which type of application to open. i.e, in excel , notepad,.....
    please mail me as soon as possible
    [email protected]

    I had a similar porblem....
    I got some help from...http://www.javaworld.com/javaworld/jw-10-2006/jw-1019-xmlexcel.html?page=1...
    This is my code in servlet...
    HSSFWorkbook wb = new HSSFWorkbook();
    HSSFSheet spreadSheet = wb.createSheet("Users");
    spreadSheet.setColumnWidth((short) 0, (short) (256 * 25));
    spreadSheet.setColumnWidth((short) 1, (short) (256 * 25));
    // Creating Rows
    HSSFRow row = spreadSheet.createRow(0);
    HSSFCell cell = row.createCell((short) 1);
    cell.setCellValue("Year 2005");
    cell = row.createCell((short) 2);
    cell.setCellValue("Year 2004");
    HSSFRow row1 = spreadSheet.createRow(1);
    HSSFCellStyle cellStyle = wb.createCellStyle();
    cellStyle.setBorderRight(HSSFCellStyle.BORDER_MEDIUM);
    cellStyle.setBorderTop(HSSFCellStyle.BORDER_MEDIUM);
    cellStyle.setBorderLeft(HSSFCellStyle.BORDER_MEDIUM);
    cellStyle.setBorderBottom(HSSFCellStyle.BORDER_MEDIUM);
    cell = row1.createCell((short) 0);
    cell.setCellValue("Revenue ($)");
    cell = row1.createCell((short) 1);
    cell.setCellValue("25656");
    cell = row1.createCell((short) 2);
    cell.setCellValue("15457");
    FileOutputStream output = new FileOutputStream(new File("/tmp/Users.xls"));
    response.setContentType("application/vnd.ms-excel");
    response.setHeader("Content-Disposition", "attachment;filename=Users.xls");
    ServletOutputStream out = response.getOutputStream();
    wb.write(output);
    output.flush();
    output.close();
    forward = null;
    In firefox i get the download dialog box but not able to open in from there,i need to save it and then open. In IE i dont get the dialog box instead the excell open inside the browser......Please help me to open a excel sheet onclick on a link "Export to excel" in jsp......
    Thanks in advance...

  • Opening excel sheets

    Hi,
    I have one servlet that is supposed to create an excel sheet. Then I have a couple jsp's with a link to this servlet on each of those jsp's. The content of the excel sheet should depend on wich link has been clicked. My problem is: if I open an excel sheet from one link, and then open another sheet from another link without closing the first one, the new sheet is not created. Is there any solution for this? Thanks

    How? Here is the link to the servlet where ExcelTable.java is the name of the servlet file.
    Download this table in Excel format

Maybe you are looking for

  • My vertical column of bookmarks down the left side of my screen has disappeared and I need to find a way to get it back in the same place.

    This is purely a lay-out issue. We used to be able to choose to permanently display our bookmarks vertically down the left side of the screen, and I want to continue to be able to do so. My bookmarks are not lost; I know they are in my library. But t

  • How do I get envelopes to print properly

    I'm going out of my mind. I've been trying to do a mail-merge print of Monarch (4"x10.5") envelopes on a networked HP4000N Laserjet. I've done the mail merge using MS Word, and OpenOffice. I've tried to print to the HP directly and print to PDF (save

  • Efragdb.exe in Oracle Lite 10g R3

    We have the following situation when working on Oracle LIte 10g R3. We used defrag.exe with a database created in Oracle Lite R2. During the "Dumping Triggers" phase, it shows the error message "Wrong trigger type 34 for trigger TRIG_INSUPDPVDETPAGCA

  • INVERTING SCALE LABEL IN XY GRAPH

    Hi All Is there any way to inverse the direction of scale label in xy graph? If we duplicate Y scale and swap side then the scale label appears in different orientation in the y2 scale (compared to y1) If y1's label is voltage1 and is appeared frm bo

  • Tooltips for moving buttons

    Hi all, I am trying to add tooltips on mouse-over to moving buttons (the buttons are movie clips acting as buttons). It works at first, but when the movie clips enter the second motion tween they start blinking as the movie clips start to play all fo