How to open Excel in JSP

Hi,
I want to open Excel application by clicking on link which should open the file which is in <table><tr><td>
format.
I could able to do it by setting content type but the worksheet is opening in the browser itself and
not as a seperate excel application.

This code is the one to use to open an Excel in a browser.
I'm trying to open a download pop-up but for the moment I didn't find the isue...
<%@ page contentType="application/vnd.ms-excel" %>
String format = request.getParameter("format");
if ((format != null) && (format.equals("excel"))) {
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition","attachment;filename="name.xls"");
} To download the page, you must change the page content and download a page with the extension .csv. Microsoft regognizes an excel file an directly open it. So you must force IE to open the pop-up. You must set this:
page contentType="application/download "
response.setContentType("application/download ");
response.setHeader("Content-Disposition","attachment; filename=Database.csv");
The first part of the answer is correct I tested it, but the second part I'm still working on it.
Here is the link to my question on this subject, if anyone can help!
http://forum.java.sun.com/thread.jsp?forum=45&thread=243214
I hope this help
Yasssi

Similar Messages

  • 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>

  • How to open excel files from email in macro enabled workbooks NOT 2003-2007 worksheets?

    I have recently installed Office 365 and it was working great. I needed to open excel documents via email with the macro enabled option. Yesterday it flicked back to only giving me the option to open in 2003-2007 workbook so now I am having issues with the
    macros. I am contracting and trying to get work out and this has now caused huge problems.
    Am thinking of uninstalling and reinstalling. I did have older versions of ms office so maybe there is some residual content there to remove? I have tried to change the associations and protocols to open in excel macro enabled workbooks but these tick boxes
    are greyed out and I do not know how to gain access to these. Have been hunting all through my computer system but do not know how to do this. Am no expert. 
    If someone could help I would really appreciate it otherwise will need to find some computer shop expert I suppose...urgently ha.
    Thanks in advance

    it's sound like excel 13 disable the macros, turn on it will fix your issue.
    see here:
    http://office.microsoft.com/en-us/excel-help/enable-or-disable-macros-in-office-files-HA010354316.aspx
    ps: use the local admin to change the setting, the reason why the setting grey out.
    KR

  • How to open Excel Template save it under a different name and then write and save data to it at regualar intervals

    I have an excel template that I have created. I am opening that template, saving it under a different name, and then writing and saving data to that excel sheet at regular intervals. It is giving me an error 5, I understand what this means and I am trying to work around it.  However after too many hours spent trying to figure it out, I have asked for any help or input. I have attached an example vi, not the actual one since it is very involved.
    Thanks
    Solved!
    Go to Solution.
    Attachments:
    Power Cycle Test 3.0 Excel Save Testing.vi ‏18 KB

    This snippet encapsulates most of the previous suggestions, and adds a few of my own.
    The first code shows one (simplified) way of building the output file name.  It incorporates the Build Path function to combine Report File Path with the file name (don't need initial "\"), builds the File Name with Format into String, getting the Time part of the name from Format Date/Time String.  I also use Build Path to get the Template path.  Inside the For Loop, another Format into String gets the data that is placed in the 10 Excel cells.  We don't write anything yet -- we're only filling in the cells in the WorkSheet (think of how you use Excel -- you could, but probably don't, save the WorkBook after every cell entry, you wait until you are all done and then do a Save, followed by closing Excel).  Finally, when we are done, we save the file using the output name we want to use, then close Excel (which disposes of the Report Object).  If we want to generate another report, with another (time-based) name, we can put this code into a sub-VI and simply call it again.
    Don't worry if you don't have LabVIEW 2014 (which was used to save this snippet) -- most of the code comes from the original that you posted, so it should be a pretty simple edit to change that code to match this.
    Bob Schor

  • How to open Excel FIles

    I am a novice
    When I open excel file  I found some problems.
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Reflection;
    using System.Windows.Forms;
    using XLS=Microsoft.Office.Interop.Excel;
    using WD=Microsoft.Office.Interop.Word;
    using Microsoft.Office.Core;
    namespace ExcelDataFillWord
        public partial class Form1 : Form
            public Form1()
                InitializeComponent();
            private void button1_Click(object sender, EventArgs e)
                //  Scheduler sched = new Scheduler();
                //foreach (Task t in sched.Tasks)
                //    Console.WriteLine(t.ToString());
                //    foreach (Trigger tr in t.Triggers)
                //        Console.WriteLine(tr.ToString());
            private void label1_Click(object sender, EventArgs e)
                FileDialog.Filter = "excel文件|*.xls|Excel文件|*.xlsx";
                FileDialog.Multiselect = false;
                FileDialog.Title = "打开excel文件";
                if (FileDialog.ShowDialog() == DialogResult.OK)
                    textBox1.Text = FileDialog.FileName;
                    object missing = System.Reflection.Missing.Value;
                    //object missing = Type.Missing;
                    CloseProcess();
                   //'Excel::Application excel =new Excel::ApplicationClass();
                    Microsoft.Office.Interop.Excel.Application excel= new Microsoft.Office.Interop.Excel.Application();
                    //Excel::Workbook  Wk =(Excel::Workbook )Xls.Workbooks.Open(textBox1.Text, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing,
    missing, missing, missing, missing);
                    Microsoft.Office.Interop.Excel.Workbook workbook =(Microsoft.Office.Interop.Excel.Workbook) excel.Application.Workbooks.Open(textBox1.Text , missing, missing, missing,
    missing, missing, missing, missing, missing, missing, missing, missing, missing, missing, missing);
                    //comboBox1.Items.Clear();
                    //foreach (Excel::Worksheet Sh in Wk.Worksheets)
                    //    comboBox1.Items.Add((Sh.Name).ToString());
                    workbook.Close(missing, missing, missing);
                    excel.Quit();
            private void CloseProcess()
                System.Diagnostics.Process[] excelProcess = System.Diagnostics.Process.GetProcessesByName("EXCEL");//实例化进程对象
                foreach (System.Diagnostics.Process p in excelProcess)
                    p.Kill();//关闭进程
                System.Threading.Thread.Sleep(10);//使线程休眠10毫秒
    problem is : can't change  excel.applicaitonclass's Com object   to   interface
    so I want to ask a question:
    excel.application is a interface ,then interface variant = a class( it inherients this interface)  object
    but interface is a abstract object ,It has no construct function . why We use  Excel.Applcation xsl=new Excel.Application();

    Hello,
    Perhaps this will help. Open an Excel file, select a sheet, range then set a value, save then close. The idea here is not to write or save but demo a few basic operations.
    Also note 'as is' all memory is cleaned up without resorting to what many do, force the garbage collector. This is important if objects are not cleaned up it is very possible in extreme cases to bring a machine down so one should ensure all objects are cleaned
    up which only comes from well written code be it C# or VB.NET
    using System;
    using System.Data;
    using System.Data.OleDb;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;
    using Excel = Microsoft.Office.Interop.Excel;
    namespace Example_C1
    public partial class Form1 : Form
    public Form1()
    InitializeComponent();
    public void OpenExcelExample(string FileName, string SheetName)
    if (System.IO.File.Exists(FileName))
    bool Proceed = false;
    Excel.Application xlApp = null;
    Excel.Workbooks xlWorkBooks = null;
    Excel.Workbook xlWorkBook = null;
    Excel.Worksheet xlWorkSheet = null;
    Excel.Sheets xlWorkSheets = null;
    Excel.Range xlCells = null;
    xlApp = new Excel.Application();
    xlApp.DisplayAlerts = false;
    xlWorkBooks = xlApp.Workbooks;
    xlWorkBook = xlWorkBooks.Open(FileName);
    xlApp.Visible = false;
    xlWorkSheets = xlWorkBook.Sheets;
    for (int x = 1; x <= xlWorkSheets.Count; x++)
    xlWorkSheet = (Excel.Worksheet)xlWorkSheets.get_Item(x);
    if (xlWorkSheet.Name == SheetName)
    Proceed = true;
    break;
    System.Runtime.InteropServices.Marshal.FinalReleaseComObject(xlWorkSheet);
    xlWorkSheet = null;
    if (Proceed)
    Excel.Range xlRange1 = null;
    xlRange1 = xlWorkSheet.get_Range("A1");
    xlRange1.Value = "Hello";
    Marshal.FinalReleaseComObject(xlRange1);
    xlRange1 = null;
    xlWorkSheet.SaveAs(FileName);
    else
    MessageBox.Show(SheetName + " not found.");
    xlWorkBook.Close();
    xlApp.UserControl = true;
    xlApp.Quit();
    ReleaseComObject(xlCells);
    ReleaseComObject(xlWorkSheets);
    ReleaseComObject(xlWorkSheet);
    ReleaseComObject(xlWorkBook);
    ReleaseComObject(xlWorkBooks);
    ReleaseComObject(xlApp);
    MessageBox.Show("Done");
    else
    MessageBox.Show("'" + FileName + "' not located. Try one of the write examples first.");
    private void ReleaseComObject(object obj)
    try
    System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
    obj = null;
    catch (Exception)
    obj = null;
    private void button1_Click(object sender, EventArgs e)
    OpenExcelExample(System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "WS1.xlsx"), "Sheet3");
    private void releaseObject(object obj)
    try
    if (obj == null)
    System.Runtime.InteropServices.Marshal.ReleaseComObject(obj);
    obj = null;
    catch (Exception ex)
    obj = null;
    MessageBox.Show("Exception Occured while releasing object " + ex.ToString());
    finally
    GC.Collect();
    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem.

  • Email has paperclip, but don't know how to open Excel & Word attachments

    I received an email that shows a paperclip in my Inbox on my iPhone 3G. How do I open the Excel and Word documents that are attached to the email?

    See if this iphone tip and tricks helps:
    Open an attached file:
    Tap the attachment. It downloads to iPhone and then opens.
    You can view attachments in portrait or landscape orientation. If the format of an attached file isn't supported by iPhone, you can see the name of the file but you can't open it. iPhone supports the following document types:
    .doc:
    Microsoft Word
    .docx:
    Microsoft Word (XML)
    .htm:
    webpage
    .html:
    webpage
    .key:
    Keynote
    .numbers:
    Numbers
    .pages:
    Pages
    .pdf:
    Preview, Adobe Acrobat
    .ppt:
    Microsoft PowerPoint
    .pptx:
    Microsoft PowerPoint (XML)
    .txt:
    text
    .vcf:
    contact information
    .xls:
    Microsoft Excel
    .xlsx:
    Microsoft Excel (XML)

  • How to open a new JSP as a Popup

    Hello everybody,
    I have quite some experience working with java web dynpros, however I now have a requirement to work on an existing JSP page to add some new functionality, and I'm  a little bit lost since this is the first time I work with JSPs in SAP portal.
    What I need to do is that when an user clicks on a button on page1.jsp, a new jsp (that didn't exist before, since I've just created it) called page2.jsp has to open as a popup with a selection list. After the user selects a value from this list, this value has to be sent to an input field in page1.jsp.
    I've can do this in regular JSPs running on tomcat, with no problems ;).... However, when I try to do this in SAP portal, I get an error and the following exception in the logs, when I click on the button in page1.jsp:
    com.sapportals.portal.prt.runtime.PortalRuntimeException: iView not found: page2.jsp
    at com.sapportals.portal.prt.deployment.DeploymentManager.getPropertyContentProvider(DeploymentManager.java:1937)
    at com.sapportals.portal.prt.core.broker.PortalComponentContextItem.refresh(PortalComponentContextItem.java:222)
    at com.sapportals.portal.prt.core.broker.PortalComponentContextItem.getContext(PortalComponentContextItem.java:316)
    at com.sapportals.portal.prt.component.PortalComponentRequest.getComponentContext(PortalComponentRequest.java:387)
    I'm not sure what I have to do to fix this... do I need to ask the portal guys to create a new iview for the new jsp and treat it as a new app? Or is there a simplier solution?
    Any help will be greatly appreciated, and of course points awarded accordingly
    Cheers!

    Hi Ventsi,
    Sure, it is:
    In page1.jsp I use this code to open the pop-up:
    <td>
    <input type="text" name="details" value="">
    </td>
    <td align="center">
    <input type="button" name="choice"
    onClientClick="window.open('page2.jsp','popuppage','width=850,toolbar=1,
    resizable=1,scrollbars=yes,height=700,top=100,left=100');" value="Open">
    </td>
    In page2.jsp I use this code:
    I have this javascript function for passing the value to page1.jsp:
        function setValue (s){
            window.opener.document.getElementById('details').value = s;
            window.close();
    that i call using this line:
    javascript:window.setValue('test')
    and this is the code of the portalapp.xml, but I'm not sure if there's anything missing or wrong here:
    <?xml version="1.0" encoding="UTF-8"?>
    <application>
      <application-config>
        <property name="PrivateSharingReference" value="com.sap.portal.htmlb"/>
      </application-config>
      <components>
        <component name="Page1">
          <component-config>
            <property name="ClassName" value="com.test.firstapp"/>
            <property name="ComponentType" value="jspnative"/>
            <property name="JSP" value="pagelet/page1.jsp"/>
            <property name="AuthScheme" value="anonymous"/>
          </component-config>
          <component-profile>
            <property name="SAP_MANDANT" value=""/>
            <property name="SAP_USER" value=""/>
            <property name="SAP_PASSWORD" value=""/>
            <property name="SAP_LANGUAGE" value=""/>
            <property name="SAP_HOST" value=""/>
            <property name="SAP_SYSTEM_NUMBER" value=""/>    
          </component-profile>
        </component>
      </components>
      <services/>
    </application>
    Please let me know if you need more information regarding the code.
    Cheers!
    Edited by: amore82 on Apr 1, 2010 8:18 PM

  • How to open Excel spreadsheet in Numbers.

    Hey Kids:
    I have trouble opening imported Excel spreadsheets in Numbers on my iMac.  I have Mountain Lion 10.8.2.  Previously I tried a demo of Office Mac that has expired.  When I try to open an Excel spreadsheet I get a message to buy Office Mac.  I've tried to put the demo application in the trash but I still can't open the Excel spreaddsheet and get a message that Excel is in the trash and can't open the spreadsheet. 
    HELP!

    In addition to what Niel said...
    In the Finder, click on an Excel file (.xls) to select it, press command-I to Get Info.
    In the Info window, expand the Open with...section.
    Click the pop-up menu bar in that section and choose Numbers '09.
    Click the Change All button below the menu.
    Repeat with a current version (.xlsx) file.
    Regards,
    Barry
    PS: Unless you have something vital that you're storing in the Trash, you might also want to Empty the Trash to get rid of the Excel trial that's expired.
    B

  • How to open Excel when Safari downloads

    I am using Safari 7 in Mac OS X Mavericks
    I download many Excel and Word documents during the work day. Pdf's open automatically, but not Excel or Word.
    I have searched and found a few posts that say adding com.apple.DownloadAssessment.plist to Library \ Preferences.
    The contents of this file are:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
              <key>LSRiskCategorySafe</key>
              <dict>
                        <key>LSRiskCategoryExtensions</key>
                        <array>
                                  <string>doc</string>
                                  <string>docx</string>
                                  <string>xls</string>
                                  <string>xlsx</string>
                                  <string>ppt</string>
                                  <string>pptx</string>
                        </array>
              </dict>
    </dict>
    </plist>
    I have restarted Safari and it still won't auto-open the file.
    Thanks,
    Stephen

    If the user is using a web browser you can just provide a link to the
    file and let them download, open in their preferred editor, print or
    whatever else they want to do.

  • How to open a local jsp copy in a browser window?

    My problem is that I am trying to open the local copy
    of the JSP for testing in IE6 but when I try to open
    it seems like it's dowloading something.
    I am using Tomcat 4.0.
    I have the file to open saved at:
    C:\Documents and Settings\Rie Mino\jbproject\myproject
    Please help!
    Thanks.

    You may not have installed the tomcat server correctly. Uninstall tomcat and follow the instructions pertaining to installing and configuring tomcat. After that start tomcat and see if you can see the default tomcat page. If you see the default page, then try to check your page out. If there are issues, look in tomcat/logs/catalina.out. You may find the source of your trouble there.

  • Open excel,doc and ppt

    how to open excel , doc and ppt files with air application

    Acrobat Version
    not have word………………
       not have word………………
    My office2010 subversion is 14.0.5128.5000(32bit),the office 64bit version i have tried,but have the same problem also.
    Now i try to install Office 2010 sp1,i will tall you the result later,thank a lot.

  • How to open a local file from javascript in a jsp-page

    Hi
    I have created an iview from a PAR file. In the par file I have a jsp-page with some javascript code. From the javascript coe I want to open a new window with an Excel file.
    I have tried window.open("c:
    test.xls", "test_window"), but it doesn't seem to work. I have created a small HTML page locally with the same command and there a new window opens with the Excel file.
    If I change the local file path with an URL it also works.
    Any idea how to open a local file ?
    Thanks
    /Jakob

    Jacob,
    I'm not 100% (but 99,9%) and it has to do with security ristrictions of the browser not allowing to have local workstation interation from the web. This is ofcourse very dangerous if the browser would allow it... So therfore it is blocked. What if somone would point to a file/executable that formats your drive so for that reason it is not allowed to have web interaction with a local file. Only with Java Applets this is possible but still with many limitations, and what I remember Google Gears and Adobe Air do have some limited web 2 local file interaction... So best and most simple solution you are left with is pointing to a url instead of a file on a c:\ drive.
    PS The reason why it works when you start the html from your local PC has todo with the fact that the browser detects that the html is not running in the web at that moment therefor allowing the access.
    Cheers,
    Benjamin Houttuin

  • Error in Open Excel Files from JSP..it display Eksponen...

    How to set Excel format in JSP? - Error in Eksponen.
    Hi, i have a problem.
    I am using JSP to select data from database and open it as an Excel file.
    It works perfectly, but the problem is,
    when the data is NUMBER (even though in JSP, i declare it as a String), in the Excel file, when the data is more than 10, the data will change to Eksponen value.
    Should be = 982520000324464
    but in Excel is = 9.8252E+14
    Can anybody help?

    Depending on how you are generating the Excel file there are different solutions.
    If you are generating the Excel file using contentType="application/vnd.ms-excel" and HTML tables, then you can use the following attribute on the cell you wish to format:
    <TD style="vnd.ms-excel.numberformat:#,##0;">24.562234</TD>where the #,##0 corresponds to the format you wish to present the data in.

  • How to open and the view the .jsp(OAF) page and it's related code?

    Hi,
    Can anybody help on how to open the .jsp and it's related java files to see the coding? I want to know the table and view details related to a particular OAF page. It will be great help if someone explains.
    Thanks in advance.
    Muruga.
    Edited by: Murugeshapps on Jun 26, 2009 6:37 AM

    Hi,
    Please see the following documents.
    Note: 416708.1 - How to find the correct version of JDeveloper to use with eBusiness Suite 11i or Release 12.x
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=416708.1
    Note: 330236.1 - Configuring JDeveloper For Use With Oracle Applications 11i and R12
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=330236.1
    For further OAF questions, please post it in [Technology - OA Framework |http://forums.oracle.com/forums/forum.jspa?forumID=210] forum, you would probably get a better/faster response.
    Regards,
    Hussein

  • How to open and read Excel Sheet from SharePoint 2013 Document Library using C# Visual Studio 2012

    Hi,
    To achieve these are the steps that I had followed :
    1. Add the document Library path into Central Admin -> Application Mgmt -> Manage Service App -> Excel Service App -> Trusted File Locations
    2. Add Documnet Library link to Trusted Connection Proivder
    3. Open Visual Studio as Run as Administrator
    4.Create an SharePoint 2013 Empty Project.
    5.Add Service Reference : http:\\<server>\_vti_bin/excelservice.asmx
    6.Service added successfully
    7.Create a class file and add the Service Reference namespace
    There is no such class as ExcelService to call. 
    Please let me know if somebody knows how to open the Excel file into C#(2012)  either using ExcelService or any other way to open. I tried old methods of Sharepoint 2010 server but it's not able to access classes.
    Requirement is :
    Need to read the excel sheet  from Document Library and transfer all data into DataTable.
    Please help asap. 

    Hi,
    This is the forum to discuss questions and feedback for Microsoft Office, I'll move your question to the SharePoint 2013 development forum
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/home?forum=sharepointdevelopment
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
    George Zhao
    TechNet Community Support

Maybe you are looking for

  • Is it possible to play audio and video files(urls) directly in webView ?

    Hello Everybody, I have implemented one article page in webView. The content of the that page is html file. There are some links for audio and video files. Is it possible to play that links directly in that webView by clicking them? Or is there any o

  • Blackbook Apps - licence key probleme after purchase

    Hello, I am a french user of BB. I bought Blackbook app yesterday but It don't generate a license key. I have received the confirmation of the purchase by email with my order number but no license key. How sould I do to resolve this problem? I don t

  • I bought a used MacBook Pro and didn't come with an install disc.

    I recently purchased a used MacBook Pro, it is the 2006 15.4inch, with 1.83GHz Intel core duo processor. It didn't come with RAM, a charger or the instal disc and the battery was dead. I installed RAM, bought a battery and charger and it booted up no

  • Facing problem in adding measure in Dimension hierarchy

    Hi, I am using OBIEE 10g Administrator tool. I am trying to replicate same RPD(BI Model) as default sample "Paint.rpd" and have completed "Physical layer" successfully in offline mode. In BMM layer, dragged dimension and fact table from physical laye

  • No audio on Flash Media Encoder

    I recently install the FME 3 in my computer and I try to broadcast live to justing.tv and there is no sound. The hardware I'm using is a TV tuner card or  a web cam with a microphone. I  reinstall the software and drivers fof all devices and I have n