Opening Excel  files from a JSP page

Hi,
I am not able to open up an Excel file through JSP.
I am using following code snippet in JSP page
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition","inline; filename=Test.xls");Do i need to do additional settings for rendering Excel from a JSP
Thanks in advance !!!

Hi,
In my application , we have Excel files on the server i.e we are not creating excel sheets.
I just want to display these static excel files through a jsp.
I am able to display the excel files by reading them into ByteArrayOutputStream
<%
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-Disposition","attachment; filename=B.xls");
ServletOutputStream so = response.getOutputStream();
String filename = "D:\\Test.xls";
String mimetype = "application/vnd.ms-excel";
ByteArrayOutputStream output = new ByteArrayOutputStream();
InputStream in = new BufferedInputStream(new FileInputStream(filename));
byte bytebuff[] = new byte[500];
for(int lengthread = 0; (lengthread = in.read(bytebuff)) != -1;){
output.write(bytebuff, 0, lengthread);
byte data[] = output.toByteArray();
response.setContentType(mimetype);
so.write(data);
in.close();
so.close();
%>But my question is that , do i really need to do all this for rendering excel through a jsp.
Can't i do it by just setting the content type ?
Thanks

Similar Messages

  • Is there a way to open Excell file from the server and display in the UI and save it back on to the

    Hello there,
    Is there a way to open Excell file from the server and display in the UI and save it back on to the server? (like showing xell file as a datagrid - add rows, columns etc.)

    Hi Mike,
    Welcome you to the forum.
    You may try:
    SELECT * FROM MyDBNameHere.dbo.OUSR T0
    Thanks,
    Gordon

  • Can't open Excel files from Sharepoint 2013

    I am having an issue with opening Excel files from SharePoint 2013. If I click on an excel file it comes up with the error below.
    If I click Try again I get the message below also:
    If I try to open Word or PDF files they open correctly in the appropriate client and I have the option of checking them out and editing them. Any ideas why this would only be happening to Excel files?
    Thanks,
    Shaun

    Hi Shaun,
    I understand that the Excel files cannot be opened from SharePoint in Microsoft Excel.
    Can these files be viewed in the browser?
    I recommend to download a copy of the files with issue and then open them in Excel to see if the issue still occurs.
    If above cannot work, I recommend to repair Office.
    Best regards.
    Thanks
    Victoria Xia
    TechNet Community Support

  • Writing XML file from a jsp page

    how can i write a xml file from my jsp and store the values and after sometime, for example when the user clicks on the submit button, i check the values from xml file and compare those values from the data base.
    it means both writing and reading xml file from a jsp page...
    urgent help needed......thanks

    You need some API like XSL or JDOM to read data from/to XML file
    you can get a best tutorial from
    http://www.javaworld.com/javaworld/jw-05-2000/jw-0518-jdom.html
    and
    http://www.javaworld.com/javaworld/jw-07-2000/jw-0728-jdom2.html
    after reading both articals you will be able to do both the tasks

  • Excel 2008 wont open excel files from at WHS network share.

    hi all
    i have a strange problem here, i own a mac mini the 2.53ghz model bought a month ago, and a macbook (the white model) also bought a month ago, both running all the latest software updates, and office 2008 for mac, with all the latest updates
    on the mac mini, i can´t open any excel documents that are stored on a shared folder on my windows home server, it just says
    excel cannot open this file the file might have been damaged or modified from its original format
    but when i try to open the same document on the macbook, it opens just fine?
    i have tried to remove office 2008 and reinstall it on the mac mini, but that didnt help, and the strange thing is if i move the excel files, from my windows home server, to another windows home server, it opens just fine on the mac mini
    i then suspected that it was the WHS that was ****** up, and deleted the account on the WHS where the folders were stored, rebooted the whs, and added the account again, but with the same result, the mac mini wont open the excel files, it will open word files, from the same folder.
    and the macbook will still open both excel and word files, from the same folder?
    i´m really confused now, and cant seem to pinpoint the error, and hope that someone can give me some pointers of where to look?
    sincerely
    Carsten Larsen
    Denmark

    You're pobably better off posting your question on Microsoft's own forums for their Mac products, as it's their software you're having issue with:
    http://www.officeformac.com/productforums

  • Why does Acrobat suddenly not work on my Mac (won't open pdf files from a web page), yet I can open them from my iPhone? Everything worked fine yesteray.

    Hello:
    I have a Mac running OS 10.8.5 and I use Acrobat Pro and Acrobat Reader. Today for some reason, any time I try and access a pdf file from a web page, it won't open. I get a blank window. PDF files already on my computer open fine and I can create PDF files from Word docs, but I can't download or view any pdf file from any web page. Strangely, PDF files on web pages open just fine on my iPhone.
    I checked that both my copy of Acrobat Pro and Acrobat Reader are up-to-date. They are.
    I checked that my copy of Firefox is up-to-date. It is. And nothing changed with Firefox within the last 24 hours.
    I am a humble computer end-user. I am baffled as to why this would suddenly not work. I have not changed any settings, etc. Any help or suggestions would be greatly appreciated.

    Thank you.
    I checked your instructions you sent and as far as I can tell all of my settings, etc for Firefox (plugin updates and preferences) are correct but I am having the same problem.
    However, everything works in Safari. I don't have time to attempt to diagnose why Firefox no longer works. I will just switch to Safari.
    Many thanks.
    Charles
    Charles Deister
    (503) 949-5762
    [email protected]<applewebdata://81CB4171-226F-49DF-BD59-A38A7360B3FB/[email protected]>
            PO Box 5032
         Salem, OR 97304
    http://www.pilotstrat.com<http://www.pilotstrat.com/>
    This transmission (including any attachments) may contain confidential information, privileged material, or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.

  • Opening Excel Files from DB (blob column)

    My project has implemented a WEBUTIL solution to attach files into the database, view the files stored in the database (in a BLOB column), and remove the files stored in the database.
    Everything has been running smoothly. We are in final testing and have found a couple of interesting scenarios ...
    When a user tries to view an Microsoft Excel 2007 file from our application, the Excel file displays properly (as long as Microsoft Excel isn't already open - outside of our Oracle application). Once the Excel file is viewed, the system will not allow the user back to our application until after the Excel file is closed (we use the start /wait myExcelFile.xls ... command). This works perfectly for us.
    The two scenarios we encounter occur when
    1.) The user has Microsoft Excel open outside of our application and tries to open an Excel file from within our application, or
    2.) The user has the file already open (either from within our application or outside of our application) and then tries to open the file from within our application.
    Let me explain a little further because the above two scenarios are interrelated.
    When a user has Microsoft Excel open (outside of our application), and then clicks the button to open the Excel file, the system will open the file as another window (within Excel). The system will allow the user to navigate back to our application (where as, if Excel is not open outside of our application, the system will not allow the user to navigate back to our application). Once the user navigates back to our application (while the file is still open), the user can click the button to view the file again. At this point, the user is displayed a WUT-105 error message (I assume b/c the system is trying to open a file that is already open).
    I assume the two solutions are the following:
    a.) Do not allow a user to open a file that is already open (not sure how to check this from within Forms ?)
    b.) Do not allow a user to open an Excel file when another EXCEL process is already running (this will avoid allowing the user to naviagate back to our application)
    I don't know if there is a better solution.
    Do you experts have any recommendations?
    We are using Oracle Application Server 10g R2 (10.1.2.0.2), Oracle Database 10g R2 (10.2), and Oracle Developer 10g (10.1.2.0.2)
    I hope this all makes sense.
    Thanks,
    Mike
    Edited by: user639843 on Oct 20, 2008 2:15 PM
    Edited by: user639843 on Oct 20, 2008 2:20 PM

    Thank you, Thank you, Thank you!!!!
    I believe that will work (adding a sequence number to the end of the filename)!
    We do not allow a user to update the file, only view. If a user wants to make a change, they need to remove the existing file (from the database), create a new file (outside of our application), and attach the file in our application (into the database). All updates occur outside of our application - we are not a document authoring system, just a document storage system.
    Once again, many thanks on the solution!
    Mike

  • Open Excel File from oracle directory on a local machine

    Hi,
    I have an application where I generate a excel using data in a table and write excel file in oracle directory.Now my requirement is to open that file from local machine .How can i achieve it.
    I am using Apex 4.2,Oracle 10g .
    Thanks
    Rajan.C
    Edited by: Rajanjai on May 31, 2013 5:34 PM

    Close your question here and open here
    Oracle Discussion Forums » Oracle Database » Application Express

  • Cannot go on suspend with an open Excel file from network

    Hi all,
    I cannot go on suspend with an open Excel file with macro - from network.
    The error msg is that I need to close all the open files first.
    "Windows cannot go on standby because Microsoft Office documents or application components are being accessed from the network. You must close the open documents or exit the application before you can put the computer on standby"
    The error msg will not appear when I use regular excel files, only with macro.
    Any ideas?
    Thanks.

    Hi,
    In regarding of the issue, there are some reasons.
    Firstly, if we got some error message like: "Cannot find the file 'C:\Folder\FileName.xls' .Make sure the path and filename are correct and that all required libraries are available."
    Please try the steps:
    Open Excel>Click on file>options>Advanced options>General tab>Uncheck the box “ignore other applications which use Dynamic Data Exchange (DDE).
    Secondly, When we try to open a Office file, it'll create a temp file in the same directory. If we have no full permission with the folder and OneDrive, we also could not open it.  Thus, we'd better make sure we
    have full permission. Please try to use the administrator account to test.
    Thirdly, please see the some general troubleshooting about Excel start issue:
    http://support.microsoft.com/kb/280504
    Hope it's helpful.
    Regards,
    George Zhao
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please click "[email protected]"

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

  • Problem making an Excel file from a jsp

    Hi.
    I'm developing a web application that uses Excel for printing the reports. So far everything has worked fine, at least for the created Excel files that do not have any images on them. Now I need to create an excel file with an image as the header. I tried adding the necessary code to include the image, but when I open it, the image is not displayed (like when you open an HTML page that could load a certain image). I tried using different ways to set the src to see if maybe the path was the problem, but everytime I got the same result...
    How can I do this? How can I include the image and actually display it when the user opens the file in Excel?
    Thanks in advance
    CyberSpider

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

  • Unable to open excel files from yahoo mail

    I am unable to open an excel file in Yahoo! Mail (sent from PC) to my iMac.  My iMac has the MS Office suite too.  Any suggestions?

    Does not allow to open when on desk top. I took picture and Movie when i first got my iPhone5 and i have iphoto and iMovie 2008 they say ilife 11 is and upgrade. when i transfered pictures to start with to my iPhoto i had to inport them to iMove inorder to watch them. then when i messed around and added more shots and deleted some some went missing and to totally delet the whole bunch of photos and the movies My iMac made a folder in my Finder and drug and dropped and trashed my project that way. Three short movies went missing that i was looking to watch and they never showed back up. Today i started trying things in the New Yahoo.com Mail Applicatins Attachments and there were the three Items and the Mail Attachments page does not offer a Choice or deleting attachments.  Does Icloud save a few pictures and a movie or two for security reasons?   I tried Google answers to get my Yahoo front page restored so i do not have to use the Everything page and it was a Conection doctor and he or it wanted $38.00    I am not to sure i want to waste grocery money, Hard times!  
        If you can help great if not i am still working on things Greg

  • Unhandled exception while opening excel file from e-business suite form

    Hello,
    I am getting error ORA-106561 (Unhandled errorg) when I am trying to open excel sheet which is reside in my desk top from Oracle E-business suite customized form using dde.app_begin('C:\Program Files\Microsoft Office\Office12\EXCEL.EXE'||'d:\emp.xls' ,dde.app_mode_normal)
    E-BUSINESS SUITE is in Unix server and EBS version is 10.5.10.2cu and hp Unix version is 11.11
    Please help me out in the above issue
    My objective is to open an excel sheet which is in my local disk and read and update the excel.
    Edited by: user538673 on Jul 23, 2010 2:20 AM

    Hello,
    This is the standalone Forms forum here.
    Please, ask your EBS questions on the E-Business Suite forum ;-)
    Francois

  • Unable to open pdf files from search results page in Office 365 site

    Hi folks,
    I am getting this issue since a while now. In office 365 site, if I click on links that points to pdf files in search results page, I get this -
    “The filename, directory name, or volume label syntax is incorrect”. 
    These pdf files are stored in the same site and I am able to open them in adobe reader directly from the document library but not from the search results page.
    I have already gone this post and doesn't help me -
    https://social.msdn.microsoft.com/Forums/sharepoint/en-US/545efcc6-b748-4df8-aee0-7f57f778ad1e/sharepoint-2010-opening-pdfs-in-search-results-the-filename-directory-name-or-volume-label?forum=sharepointgeneralprevious
    Any help or pointer is much appreciated.
    Thanks,
    Manvir
    Manvir

    Hi,
    Besides pamma has suggested, here are similar issues, you can take a look at:
    http://unsolicitedbutoffered.blogspot.com/2014/01/quick-fix-volume-syntax-error-when.html
    http://crowdsupport.telstra.com.au/t5/T-Suite-Applications/There-was-an-error-opening-this-document-The-filename-directory/td-p/197425
    Best Regards,
    Lisa Chen
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]
    Lisa Chen
    TechNet Community Support

  • Can i cal .fmx file from a JSP Page

    Hi,
    i have Forms Runtime loaded in my System. i able run the .fmx file from Windows Run command. But i want run the fmx file from a link of JSP Page.
    is it possible... plz let me know
    [email protected]

    U can not .
    U can only if you are using an appliction server to run the forms. In this case you can call the URL to run the forms from JSP
    Rajesh ALex

Maybe you are looking for