Warning from Excel when opening Excel document in JSP

Hi,
I populate a HSSFWorkbook with data retrieved from a database using user input. I then want to open the excel file up so the user can see it.
This works fine, but prior to the file opening I get a warning message from Excel saying that the file is of another format etc etc do you still want to open. It actually takes the name of the JSP page as the name of the file I want to open. The file opens if I ignore the warning.
I do the following when opening the file:
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext = facesContext.getExternalContext();
HttpServletResponse response = (HttpServletResponse) externalContext.getResponse();
ServletOutputStream out = null;
try {
// Initiate servlet response
response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-disposition", "inline;filename=\"" + excelSheet.getFile().getName() + "\""); //ExcelSheet getFile() returns java.io.File
out = response.getOutputStream();
excelSheet.getWb().write(out); //get HSSFWorkbook
// Finalize task.
out.flush();
} finally {
// Gently close stream.
close(out);
Any tips?

This would occur only in a certain widely used webbrowser developed by a team in Redmond. It completely ignores the filename part of the content disposition header, takes the part after the last slash of the URL as the actual file name, examines its extension against the platform specific list of file associations and in case of an unknown filetype it reads the content type header and gives a warning before when the content type is different.
To solve this problem, you need to append the filename as part of the URL. You can get some ideas out of this: [http://balusc.blogspot.com/2007/07/fileservlet.html].
Its market coverage if fortunately shrinking, but until then we, developers, have to live with that product. It works perfectly in all other webbrowsers.

Similar Messages

  • Delete Windows Live ID from list when opening office document on Skydrive

    I have office documents that are on Skydrive and when I open them the Sign-In form has some old account in the list.  Is there a way to delete these other accounts?
    Thanks

    Hi Glenn,
    There is a little cross in the top right corner of the Sign-In form when you move you mouse on it. Click it remove the certain account from the list.
    Sincerely,
    Max Meng
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    There is no cross.  The title of the form is "Connecting to ...live.net".  Inside the form I laid out below (I tried to copy the form but it did not work).
    Enter your Windows Live ID credentials
    Email Address: [drop down box\
    Password: [text box]
    [check box] Sign me in automaticly
    [OK button] [Cancel button]
    Windows live ID
    [hyperlink Sign up]      [hyperlink
    Help]
    The only other item is Red X to close the form.

  • Login prompt appearing when opening Excel Files - SharePoint 2010 SP1 - Office 2007

    hi,
    i have 2 sites on the same server, 1 at Port 80 and 1 at port 8300
    https://contoso.com
    https://contoso.com:8300
    Both are under same AD and credentials.
    But when users on 8300 port site, tries to open office files such as Word or Excel.
    In read only mode, login credentials screen comes atleast 3 times again and again, although users are using same and correct credentials
    but when clicked as edit mode, then file just opens.
    I have saves their credentials locally using credentials vault under user accounts.
    while suggestions on this page were already there:
    http://sharepoint.licomputersource.com/2011/04/sharepoint-2010-prompts-for-credentials-when-opening-office-documents/
    I have added https under Excel trusted File Locations under CA
    I have correct AAM mapping under CA.
    Please guide how to fix this. Thank you
    Server: Sharepoint 2010 SP1
    End Users: Office 2007 and Office 2010

    Hi,
    For Login prompt appearing, please refer to:
    http://support.microsoft.com/kb/943280. also, please make sure you have already add this site into trusted sites zone in IE since after this settings, you will not get the read only/edit popup windows. you can change different computers to test
    to check if the office settings has some special. in addition, please keep one version of office product.
    For he excel files open in browser and then have a option to open in Excel, please go to library settings > advanced settings > Opening Documents in the Browser to check if both sites have the same settings. also, maybe you miss click the open in word/
    open in excel button after open in brwser.
    Regards,
    Seven

  • Pages crashes when opening any document on iPad 3 Latest version.   I could find on the net and finally deleted Pages from my device and reinstalled it. Still when I try to create anew document or open a document it just cr

    Pages crashes when opening any document on iPad 3 Latest version. I tried everything I could find on the net and finally deleted Pages from my device and reinstalled it. Still when I try to create a new document or open a document it just crashes out.

    Try this:
    Make sure IOS is updated to latest version
    Reboot device by pressing both the home button and sleep/wake (power) buttons at the same time for 10-15 seconds until the apple logo appears on the screen, then let go.
    If that doesn't work then reset the device by going to settings/general/reset/reset all settings

  • Error when open fdf document from Safari

    Reproduced on
    * Adobe reader 9.1.0
    * Acrobat Pro 8.1.3
    NOT reproduced with Acrobat Pro 8.0.0( withou updates )
    have simple fdf document for example in root of disk c:
    =============
    %FDF-1.2
    1 0 obj
    <<
    /FDF
    <<
    /F (1.pdf)
    /JavaScript
    <<
    /After 2 0 R
    >>
    >>
    >>
    endobj
    2 0 obj
    <<
    >>
    stream
    endstream
    endobj
    trailer
    <<
    /Root 1 0 R
    >>
    %%EOF
    ================
    when open it with IE or FF, al works fine. but when try to open in safari  messagebox shown
    "There was an error when open this document. This file cannot be found."

    minified version of not worked fdf
    %FDF-1.2
    1 0 obj
    <<
    /FDF <</F (pdf.pdf) >>
    >>
    endobj
    trailer
    <<
    /Root 1 0 R
    >>
    %%EOF

  • Pages 5.5.1: When opening a document created with Pages '09 (Version 4.0) with Pages 5.5.1 the page header and the page footer are deleted. How can this be prevented? Or is this a bug in Pages 5.5.1?

    Pages 5.5.1: When opening a document created with Pages '09 (Version 4.0) with Pages 5.5.1 the page header and the page footer are deleted. How can this be prevented? Or is this a bug in Pages 5.5.1?

    Same problem here (no graphics in header or footer) and the problem has been reported months ago. It is another bug/feature lost when Apple moves from 09 to the iCloud-compatible versions.  Complain to Apple, you may have better chance than me and they may finally listen to their users....

  • InDesign cs3 crashes when opening CS2 documents

    ID cs3 crashes when opening CS2 documents, not when open dialog appears, but after I choose file and it "starts" opening it. (core duo, xp, clean install, all updates)
    If i open ID by opening file, it crashes with standard windows dialog, if I open ID first, it does not crash, but rather behaves strangely, nothing is opening, if I move a mouse it turns to sand clock.
    Same thing happens on all machines with ID cs3 in my office.
    All other apps works fine. I did read every single forum about ID crashing and nothing helps. Files resaved in interchange format opens well. There must be something in the files that ID cs2 did and what id cs3 cannot open :( Any ideas?

    1. Is there any reason to use eps? Avoid it use AI, PSD or PDF instead.
    2. Are all used fonts ok? What kind of fonts du you use?
    3. Which Mac OS X do you use?
    Does it crash with alwayst the same files?
    What does the file history tell you? Hold down the command key and got to InDesign > About InDesign… Does it tell you somewhat more specific, like missing plugins, severly damaged files and restored files, when (in which version) the files have been created first (helps often to export to IDML and open this again and save it as INDD and work with the new file.), has the problematic file been converted from another application (Quark Xpress or PageMaker), etc.

  • Why do I keep getting an error "insufficient data for an image" when opening a document

    why do I keep getting an error "insufficient data for an image" when opening a document in Adobe Reader XI 11.0.06

    I am also having this problem, especially with scanned documents. Since I need to download scanned documents in my work this is a big problem!Sometimes I can read but not save the document, sometimes one or two of the pages will be blank from the start. I have the latest version of Adobe Reader XI (11.0.10). I tried reducing the page zoom, a suggested workaround on this page: Acrobat: “Insufficient data for an image” error after updating to 10.1.4 or 9.5.2,  but that did not help at all. FWIW I use a Windows 8.1 PC with 4 GB RAM. I usually download PDFs from the internet using Firefox.

  • I'm getting an error message "There was an error when opening this document. Access denied" on some PDF's that I was able to open in past. Uninstalled XI and installed X but same problem. Any thoughts?

    I'm getting an error message "There was an error when opening this document. Access denied" on some PDF's that I was able to open in past. Uninstalled XI and installed X but same problem. How can I access these files?

    I have exactly the same problem. The interesting thing is that the file opens when I attach it to an email and open it out of the email. I already saw the advice you provided in  similar post from Aug last year and checked the security settings of the file and the folder. But according to that I have all rights.
    My OS is Windows 7 Enterprise.

  • Error message when opening a document "this document is being used by another user

    error message when opening a document "this document is being used by another user, do you want to make a copy?
    I select yes, then new message - word can not open this document.the document might be in use or it may not be an invalid document.
    Any suggestions?

    Hello MrNeuf,
    I would recommend releasing and renewing the IP lease on the affected computer. The following article provides further information and details the process of doing so.
    Mac OS: How to release and renew a DHCP lease
    http://support.apple.com/kb/TS1920
    Cheers,
    Allen

  • Sort order of files when opening a document within a program

    When opening Explorer, files are correctly sorted in alphabetical order.
    When opening a document (say within Word), if I search a folder then the files/folders are in a strange sort order - something like last used or modified. I don't know how this happened. I want them sorted alphabetically like in Explorer.
    What do I need to do? I'm fed up of having to sort every folder each time I open it within a program.

    > Is there a way to change the way DW sorts the dirs and
    files in the file list
    > window (other than reversing it)?
    have you expanded the Files Panel, made the sort by clicking
    on the
    headings, then collapsed it?
    Alan
    Adobe Community Expert, dreamweaver
    http://www.adobe.com/communities/experts/

  • How to stop the executable from starting when opened

    Hi Guys,
    I am building an exe with the application builder. I am not able to find a way to stop the exe from running when opened. I dont need the exe to run. I know I m missing a very basic step here but I m not able to do that.
    Could anyone explain me how to do this.
    Regards,
    Nitin

    Hello,
    This is Dominic L. from Applications Engineering at National Instruments. This was reported to R&D (CAR#41DAPUQU) and was fixed in LabVIEW 8.2.1. Here is a link to the current evaluation software download for LabVIEW:
    http://digital.ni.com/demo.nsf/websearch/14f9ce475127ade786256ac60070926c?opendocument
    This particular bug actually renders all the build options for source file settings unusable. While the other options can be set manually in the source VI properties, the start-up VI will always run when an executable is opened.
    Here are three different workarounds to this:
    Option 1 - Upgrade to 8.2.1. 
    Option 2 - Check "Enable debugging" and "Wait for debugger on launch" in the Advanced page of the build specification. One side effect is this will include the block diagrams of the VIs and extra code for debug tool support. Note that if you don't protect the source code (block diagram), it kind of defeats the purpose of creating an executable.
    Option 3 - Use a dummy startup VI to launch the desired startup VI.
    For the third workaround, the attached "Dummy Startup VI.vi" uses VI server to open the desired startup VI's front panel and then closes.  To use the Dummy Startup VI follow these steps:
    Add the Dummy Startup VI to the project.
    Open the Dummy Startup VI and change "Main VI.vi" to the VI you would like to open but not run in the project and save.
    In the source files page of the build, select the Dummy Startup VI as a startup VI and the VI you would like to open but not run as a support VI.
    Build and run.
    I hope this helps.
    Have a great evening!
    Best Regards,
    Dominic L.
    Attachments:
    Dummy Startup VI.vi ‏12 KB

  • Is there a way to filter a drop down list by using the result main data display from"GetUserProfileByName" when open the form.

    Hi 
    Is there a way to filter a drop down list by using the result main data display from"GetUserProfileByName" when open the form?
    The second source has a huge list of company names that can be narrrow by email work. 
    background:SP 2010 and Infopath 2010
    CRISTINA&amp MICROSOFT Forum

    I'm not sure if I understood your question clearly but here is a good resource on how to get attributes from "GetUserProfileByName" web services:
    http://blog.mangroveweb.com/pre-populating-an-infopath-from-with-mysql-data-using-a-net-web-service/using-sharepoints-getuserprofilebyname-web-service-to-retrieve-ad-account-information/
    Regarding filtering dropdown list then this could be done by applying form on-load rules. 
    Hope this helps

  • Error -2146960888 when opening excel from labview using active x

    attempting to open an instance of excel from labview using active x, I even tried using the "open excel and make visible.vi" found on this site. I get errors every time, Inserting a break right after the property node, I found that it does open excel with no active workbook. once the program runs to ompletion excel terminates. The error is on the line right after the property node executes.

    http://sine.ni.com/apps/we/niepd_web_display.DISPLAY_EPD4?p_guid=B45EACE3F15456A4E034080020E74861&p_node=DZ53003&p_submitted=N&p_rank=&p_answer=&p_source=External
    Attachments:
    XL97table.zip ‏29 KB

  • When Opening Excel file, there is a message

    Dear BPC Experts:
       When I open excel files in BPC NW 7.0, there is a warning message saying "Programmatic access to Visual Project in not trusted"
    Does anyone have suggestion for this message? Thanks in advance.
    -Fred
    Edited by: Fred Cheng on Jul 22, 2009 10:47 AM

    From MS Excel 2003 goto Tools > Macro > Trusted Publishers > check on the option Trust access to Visual Basic Project.  From the Security Level tab - click on the Medium option.
    From MS Excel 2007 click on Office button in the top-left corner, then click on the Excel options from the pop-up window.  Click on the Trust Center option > Trust Center Settings > Check on the option Trust access to the VBA project object model.  Also check the option Disable all macros except digitally signed macros.
    Best regards,
    [Jeffrey Holdeman|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/profile/jeffrey+holdeman]
    SAP BusinessObjects
    Enterprise Performance Management
    Regional Implementation Group

Maybe you are looking for

  • Oracle 10g Enterprise Edition user license in Standard Edition

    Hi, If I purchase Oracle 10g Enterprise Edition license (user or processor), and somehow if I decedided to downgrade the server from Enterprise Edition to Standard Edition, is these license still valid to apply to the Standard Edition server?? Thanks

  • Highlighting protected pdf on Reader for iOS (iPad4)

    I have a textbook pdf which allows me to highlight and add sticky notes on multiple versions of Windows, but does not seem to allow the same function on Adobe Reader for iOS (iPad4).  Is this function supported, and if yes, how do I troubleshoot? Tha

  • IPad or Notebook

    What would be better for college, ipad or mac notebook? For note taking and so on. I already have a Asus laptop, and I really want an iPad but the laptop I have isnt the best. So I unsure what to get.

  • Academia SAP Basis - Oficiais

    Olá pessoal, estou interessado em fazer a academia SAP Basis, gostaria de saber quais são as escolas que oferecem o curso oficial, quais são as escolas parceiras da SAP que tem os cursos oferecidas recolhecidos. A melhor opção é fazer diretamente pel

  • Sony NX5u with FCP - it will help me to compare what others are doing

    Earlier today I posted a topic regarding issues I'm having with SD footage shot on my NX5u cameras being very interlaced. Further, when viewing the footage on an SD tv (either via an external monitor through Firewire right off the timeline, or, expor