Export To Excel in new popup window

Hi all,
I am trying to implement the 'exportToExcel' functionality in which will open a XL file in a new window(which has to be the MS EXcel window,not the browser).My code snippet is as follows:
public ModelAndView exportToExcel(HttpServletRequest request,HttpServletResponse response, ReceivingExceptionVO command)
          throws Exception
          System.out.println("Inside exportToExcel method:Hurray!!");
          try {
               ReceivingExceptionVO commandObject = (ReceivingExceptionVO) command;
               response.setHeader("Cache-Control", "public");
               response.setHeader("Pragma", "public");
               response.setHeader("Expires", "0");
               response.setHeader("Content-disposition", "inline; filename=\""+ "receive" + ".xls\";");
               response.setHeader("Content-Type", "xls/csv");
               ServletOutputStream outputStream = response.getOutputStream();
               HSSFWorkbook workBook = buildExcelDocument(new HSSFWorkbook(), request, response, commandObject);//this buildExcelDocument mthod is defined in this controller.This is not the method of api.This returns a workbook with required data
               workBook.write(outputStream);
               outputStream.flush();
               outputStream.close();
          catch (IOException e)
               e.printStackTrace();
          catch (Exception e)
               e.printStackTrace();
          return null;
     }But i am getting the excel in the current page only,not in the new one and that also getting in the browser.Please help.
Edited by: amit.goenka on Jul 7, 2009 6:11 AM

Hey That did It!!!Whoa!
but what was the issue or trick here??
Thanks a lot

Similar Messages

  • Urgent help on opening a new popup window when clicking on h:comandButton

    Hi All,
    I am working on a JSF application.I got a requirement where i need to Open new popup window when the user clicks on <h:commandButton>. Here is my sample code.
    <h:panelGroup>
    <h:commandButton onclick="window.open('/gwp/pages/client/auto_id_card_proof.jsp','PrintIDCards','top=30,left=0,width=800,height=600, scrollbars=1')"
    value="#{ClientLabels['PrintAutoIdCard.PrintProofOfInsurance']}" immediate="true"/>
    </h:panelGroup>
    Iam getting an error message in the new popup window as below when i click on the commandButton.
    JSP Processing Error
    HTTP Error Code: 404
    Error Message:JSPG0036E: Failed to find resource /pages/client/auto_id_card_proof.jsp
    Root Cause:java.io.FileNotFoundException: JSPG0036E: Failed to find resource /pages/client/auto_id_card_proof.jsp     at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.findWrapper(AbstractJSPExtensionProcessor.java:293)     at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.handleRequest(AbstractJSPExtensionProcessor.java:266)     at com.ibm.ws.webcontainer.webapp.WebApp.handleRequest(WebApp.java:3129)     at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:238)
    Any help will be highly appreciated.
    Thanks
    Vijay

    Please, urgency is your own problem and thus irrelevant to us. This way you are seemingly putting pressure to us, which is rude.
    At any way, a 404 simply means that the URL is wrong.

  • 2013 Excel WFservlet.xls check exports to Excel and opens blank Windows 7 Ent

    HI All,
    I am trying to work through an issue involving an online check through Accounts payable downloading to a blank Excel document. If the user saves the file it opens as it should but if she chooses to open it, it opens blank. If I go to View>Arrange
    All> leave the Tile selected (basically do nothing but click OK) and click OK it opens. I have done an Office repair with no luck and also a complete uninstall then used the office removal tool then reinstalled with reboots in-between and still no change.
    This computer is on a domain and I can get the check to export to excel without any issues on another computer so I know it's not her roaming profile. I can get it to work on my machine and others as me, admin and her but on her machine no luck. I have opened
    IE settings on her machine and a working machine and matched the settings exactly as well as Excel settings. I have started Excel in safe mode and exported but no luck. I have disabled all add ins in excel and added the site to compatibility settings and trusted
    sites in IE. I reset the browser and deleted history with all options selected.
    In the beginning I was receiving the error "The file format and extension of ".xls" don't match. The file could be corrupted or unsafe. Unless you trust its source, don't open it. Do you want to open it anyway?" I checked the following
    In Windows Explorer Tools > Folder Options > View tab > made sure "Hide extensions for known file types" was unchecked.
    I also did
    Open your Registry (Start -> Run -> regedit.exe)
    Navigate to HKEY_CURRENT_USER\SOFTWARE\MICROSOFT\OFFICE\12.0\EXCEL\SECURITY
    Right click in the right window and choose New -> DWORD
    Type “ExtensionHardening” as the name (without the quotes)
    Verify that the data has the value “0″
    No luck.
    If I log into the computer as local admin or my domain account it still opens blank.

    HI All,
    I am trying to work through an issue involving an online check through Accounts payable downloading to a blank Excel document. If the user saves the file it opens as it should but if she chooses to open it, it opens blank. If I go to View>Arrange
    All> leave the Tile selected (basically do nothing but click OK) and click OK it opens. I have done an Office repair with no luck and also a complete uninstall then used the office removal tool then reinstalled with reboots in-between and still no change.
    This computer is on a domain and I can get the check to export to excel without any issues on another computer so I know it's not her roaming profile. I can get it to work on my machine and others as me, admin and her but on her machine no luck. I have opened
    IE settings on her machine and a working machine and matched the settings exactly as well as Excel settings. I have started Excel in safe mode and exported but no luck. I have disabled all add ins in excel and added the site to compatibility settings and trusted
    sites in IE. I reset the browser and deleted history with all options selected.
    In the beginning I was receiving the error "The file format and extension of ".xls" don't match. The file could be corrupted or unsafe. Unless you trust its source, don't open it. Do you want to open it anyway?" I checked the following
    In Windows Explorer Tools > Folder Options > View tab > made sure "Hide extensions for known file types" was unchecked.
    I also did
    Open your Registry (Start -> Run -> regedit.exe)
    Navigate to HKEY_CURRENT_USER\SOFTWARE\MICROSOFT\OFFICE\12.0\EXCEL\SECURITY
    Right click in the right window and choose New -> DWORD
    Type “ExtensionHardening” as the name (without the quotes)
    Verify that the data has the value “0″
    No luck.
    If I log into the computer as local admin or my domain account it still opens blank.
    The file will open in Chrome but I am wondering if that's because Chrome downloads the file as if I choose to save the file opens fine. I am going to run the OffCAT will post my findings.
    Thank you!

  • Open a new popup window in OTL Create timecard page

    I am have created a new item called button on the create timecard page in OTL. when i click on the button it opens up a new window which runs a function in it. I want to set the properties of the new window like remove toolbar,location and menubar. when i set the properties in Target Frame I dont see any change in window style.
    The proerties of the button are
    Item Style Button
    Property Value
    *ID BIO_PROJ
    Access Key
    Additional Text
    Admin Personalization truefalse
    Attribute Set
    CSS Class
    Comments
    Data Type VARCHAR2DATEDATETIMENUMBERBOOLEANCLOB
    Destination Function :BIO_PROJ_INFO
    Destination URI :OA.jsp
    Disable Server Side Validation truefalse
    Disabled truefalse
    Export View Attribute
    Extends
    Horizontal Alignment centerleftrightstartend
    Prompt
    Rendered truefalse
    Scope
    Target Frame =javascript:window.open("","Last 10 Projects","location=0,toolbar=0,menubar=no")
    View Attribute
    View Instance
    Warn About Changes truefalse
    Please help
    Thanks

    What I usually do in this case is place a javascript function at the end of the processRequest method:
    String function = "function openWindow(pageUrl,windowName){window.open(pageUrl,windowName,'width=725,height=520,menubar=no,location=no,toolbar=no,scrollbars=yes,resizable=yes');}";
    pageContext.putJavaScriptFunction("openWindow",function);
    The I can put the destination of a link or button as javascript:openWindow(url,name)

  • Export to Excel alignment off after Windows 2003 upgrade

    Hi All,
    I have an application that uses Crystal Reports 10(sp6) and VB6 that has worked fine for a few years and now that I have upgraded the server to Windows 2003 the alignment of the excel output is off.  All pages (45 of them) get printed on their own row in the output xls file.  The report gets filled in during the execution of the VB6 executable and then gets exported to PDF and then to excel.  PDF is fine but the excel output is unacceptable.  I've been playing with the different exportoptions and cannot seem to get the alignment I need.  Basically we need the rows and columns to align.
    In further testing I have exported the report with data (our original rpt file is just a shell that we fill in with data) to a crystal reports file.  I then have taken this report through the Crystal Reports 10 IDE and was able to export it and the output looks exactly like I need it to.  So I'm sure there is settings to accomplish the output.
    This is the original code:
    With My_Crystal_Report
        .ExportOptions.Reset
        .ExportOptions.FormatType = crEFTExcelDataOnly
        .ExportOptions.ExcelMaintainColumnAlignment = False
        .ExportOptions.ExcelUseFormatInDataOnly = True
        .ExportOptions.ExcelConstantColumnWidth = CDbl(800)
        .ExportOptions.DestinationType = crEDTDiskFile
        .ExportOptions.DiskFileName = filePath & ".xls"
        .Export (False)
    End With
    Here are the settings when I run the report through the Crystal Reports 10 IDE:
    - Custom: Data is exported according to selected options
    - Constant column width (in points): 36.0
    - Export object formatting
    - Maintain relative object position
    - Maintain column alignment
    One thing I was wondering is that there are different versions of Visual Studio including VS2008 and I was wondering if the Crystal Reports that gets installed with them could be interfering.
    Any help would be greatly appreciated.  Is there a setting that I'm missing in the code, registry, etc.
    Thanks in advance,
    Jim

    Hi,
    The only other difference I found as far as I could see was the following two files:
    CRXF_XLS.dll
    CRXF_XLS_RES_EN.dll
    Once loaded into the bin directory they are no longer a difference but output is still the same.
    There are other differences as far as Only In CRW32.EXE (only Crystal Reports differences by description)
    CRXF_HTML.DLL  10.0.5.75
    CRXF_HTML_RES_EN.DLL  10.0.5.75
    CRXF_RTF.DLL  10.0.5.604
    CRXF_RTF_RES_EN.DLL  10.0.5.604
    CRXF_WORDW.DLL  10.0.5.604
    CRXF_WORDW_RES_EN.DLL  10.0.5.604
    U2FCR.DLL  10.0.0.552
    U2FTEXT.DLL  10.0.5.604
    X3FCREN.DLL  10.0.0.552
    X3FTXEN.DLL  10.0.5.603
    Do you think that a possible way to fix this would be to I uninstall Crystal Reports and reinstall without the sp6 and then find out which sp was installed on current windows 2000 server and install that and see what I receive for output?
    I have been spending way to much time on this and really need to bring the customer in so that they know we have this level of an issue.  Do you also think maybe we should open a ticket? I don't know if this is feasible as you mentioned there is no support for Crystal Reports 10.
    Thanks,
    Jim

  • New popup window every time you click the link

    Hi
    here is the code iam using.
    function popupform(myform,windowname)
    if (! window.focus)return true;
    window.open('','_blank', 'width=500,height=400,left=0,top=0,resizable=yes,scrollbars=yes');
    myform.target='_blank';
    return true;
         <a class=search href="<%= rs.getString(1)%>"
    onclick=" return popupform(this,'Win1') ">
    I wnat to popup a new window Every time i click the link .ie. if I click ntimes,n windows should be opened in the screen.

    Boot the computer in Windows Safe mode with network support (press F8 on the boot screen) as a test to see if that helps.
    *http://www.bleepingcomputer.com/tutorials/how-to-start-windows-in-safe-mode/
    Do a malware check with several malware scanning programs on the Windows computer.
    Please scan with all programs because each program detects different malware.
    All these programs have free versions.
    Make sure that you update each program to get the latest version of their databases before doing a scan.
    *Malwarebytes' Anti-Malware:<br>http://www.malwarebytes.org/mbam.php
    *AdwCleaner:<br>http://www.bleepingcomputer.com/download/adwcleaner/<br>http://www.softpedia.com/get/Antivirus/Removal-Tools/AdwCleaner.shtml
    *SuperAntispyware:<br>http://www.superantispyware.com/
    *Microsoft Safety Scanner:<br>http://www.microsoft.com/security/scanner/en-us/default.aspx
    *Windows Defender:<br>http://windows.microsoft.com/en-us/windows/using-defender
    *Spybot Search & Destroy:<br>http://www.safer-networking.org/en/index.html
    *Kasperky Free Security Scan:<br>http://www.kaspersky.com/security-scan
    You can also do a check for a rootkit infection with TDSSKiller.
    *Anti-rootkit utility TDSSKiller:<br>http://support.kaspersky.com/5350?el=88446
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked
    *https://support.mozilla.org/kb/troubleshoot-firefox-issues-caused-malware

  • Open BW webreport via button on form in (new) popup window possible ?

    Hi,
    We need to give the opportunity to the end-users to launch a BW webreport to make a detailed analysis. I know how to do this via a button and a html iview but then the result is displayed in the same window overwriting the current content of the VC application.
    I thought to solve this by using a popup iview but I have just learned that this is not supported ?
    Can anyone give me a hint how to achieve this ? I searched for a "add hyperlink" function but didn't find that neither.

    Hi Double U,
    Ok i see, what do you mean. I thought I did a workaround and use a nested iView with a html view in a popup iView.
    Best Regards,
    Marcel
    Message was edited by:
            Marcel Salein
    A colleague told me that this is with this workaround not possible.

  • Need to close only the new popup window

    Could anyone please help me with this.
    From Main.java, the main user interface pops up, on clicking vf2vpExebut button, vf2vpExe.java's user interface pops up. After I process the vf2vpExe.java user interface and close it even my Main.java user interface closes.
    But on clicking the exitbut in vf2vpExe.java, I need to close only the vf2vpExe.java user interface and not Main.java user interface also.
    My code is:
    Main.java
    private void vf2vpExebutActionPerformed(java.awt.event.ActionEvent evt)
         try
              vf2vpExe vf=new vf2vpExe();
              vf.mainclass();
         catch(Exception e)
    } vf2vpExe.java
    private void exitbutActionPerformed(java.awt.event.ActionEvent evt)
         System.exit(0);
    }

    Please ignore this topic. I need to post this in New to Java

  • Popup window properties in OTL

    Hi
    I have created a new item called button on the create timecard page in OTL. when i click on the button it opens up a new popup window which runs a function in it. I want to set the properties of the new popup window like remove toolbar,location and menubar. when i set the properties in Target Frame I dont see any change in window style.
    The proerties of the button are
    Item Style Button
    Property Value
    *ID BIO_PROJ
    Access Key
    Additional Text
    Admin Personalization truefalse
    Attribute Set
    CSS Class
    Comments
    Data Type VARCHAR2DATEDATETIMENUMBERBOOLEANCLOB
    Destination Function :BIO_PROJ_INFO
    Destination URI :OA.jsp
    Disable Server Side Validation truefalse
    Disabled truefalse
    Export View Attribute
    Extends
    Horizontal Alignment centerleftrightstartend
    Prompt
    Rendered truefalse
    Scope
    Target Frame =javascript:window.open("","Last 10 Projects","location=0,toolbar=0,menubar=no")
    View Attribute
    View Instance
    Warn About Changes truefalse
    Please help
    Thanks

    Hi,
    Maybe you can use a modal dialog.
    There ia an example here http://zone.ni.com/devzone/cda/epd/p/id/3602
    It for TestStand ver 1.01 but you should be able to modify the DLL project for a later version of Teststand.
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • Export to Excel issue after upgrading to IE11

    Hi All,
    Our organization recently upgraded our Internet Explorer browser from 8 to 11 on Win7, still in pilot phase.
    One of the issues that we are currently experiencing is that after the upgrade  the Export to Microsoft Excel is no longer functioning as expected. This was working fine on IE8.
    What happens now on IE11 is that when you select a table on a web-page and do an Export to Excel, a new window pops up and the address bar stays blank with just http:/// and "Page cannot be displayed" error. What's seems to be happening is that for
    some reason, it is not populating the address bar with the URL.
    Anyone experienced similar issues and got a fix? Much appreciated.
    Regards,
    Ochen

    Hi Ochen,
    Since this is an Internet Explorer related issue, I suggest you refer to the dedicated IE forum below to get more professional support:
    Internet Explorer 8, 9, 10, 11 Forum
    https://social.technet.microsoft.com/Forums/en-US/home?forum=ieitprocurrentver
    Best Regards,
    Amy

  • Popup window

    Why is it that  I can't reuse a popup window whenever I open a portal window from javascript as follows?
    < script >
    var popWin = window.open("http://copdev01.lds.com:50000/irj", "PopupWindow");
    popWin.focus();
    < / script>
    If I include the "irj" in the path, it opens up a new popup window everytime I invoke this code. If I exclude the "irj", a new instance of the window is opened everytime.  
    Vijay

    Hi,
    I'm assuming your button Edit Entry is part of Grid (within ItemTemplate).
    So write method, where for each row you write javascript onclick event on button.
    foreach (GridViewRow row in grid.Rows)
    btnAdd.Attributes.Add("onClick","return eventName();)");
    That's it, write eventName() function which will open window.
     function eventName() {
            var link = <urltowindow>;
            var options = {
                title: 'Title',
                url: link,
                allowMaximize: false,
                width: 600
            SP.UI.ModalDialog.showModalDialog(options);
            return false;
    Thanks,
    Vivek
    Please vote or mark your question answered, if my reply helps you

  • Exporting Into Excel from Crystal Reports 8.0.1.0

    Post Author: Manoj
    CA Forum: Exporting
    Hi, I am using Seagate Crystal Reports 8.0.1.0 along with my VB application. System was exporting into Excel on Older Versionsof Windows like 98 and all. But in XP, after exporting if i open the exported file, either i get a message like Cannot Read From Fileor A Blank Sheet in the Excel. I have already tried copying the U2*.dll from the crystal folder to System/System32 folder but it is notexporting. Somebody please help... RgdsManoj

    Sage is an OEM partner. For any database issues please ask Sage for assistance.

  • DateNavigator in a popup window

    Hi All,
    <b> I am developing a portal application using JspDynPage </b>
    <b> I want to put an Icon
    and whenever i click that icon a Date Navigator should be opened
    in a new popup window using which i should be able to select the date
    </b>
    <b>
    How to do this?????
    please give some insight about this..........
    </b>
    regards
    Brahmachaitanya

    Hi,
    (a) Please mark questions as questions! By that, you are also able to reward points for helpful answers (you still can do that).
    (b) See http://help.sap.com/saphelp_nw04/helpdata/en/94/8f8441fd86030de10000000a1550b0/frameset.htm - use an input field with "help" value.
    Hope it helps
    Detlev

  • SAP Portal - POPUP window issue

    Hi All,
    I'm just new in SAP Portal and I want to ask an assistance regarding the issue our team is currently handling.
    When user open a workitem in Engineer's Desktop (under Assembly Manager), a new popup window appears. When the user tries to open another workitem without closing the first one, the first popup window closes which should not be the case. If the user opens 2 workitem, there should be 2 popup window. There are no current changes done on Portal except the EHP upgrade.
    Can you please help me on this? ANy idea is appreciated.
    Thanks,
    Arlene

    Hi Padman,
    Pls. install JVM on you local machine..
    Regards
    Pramod

  • af:showPrintablePageBehavior problem against af:treetable on Popup window

    I just used <af:showPrintablePageBehavior> for <af:treetable>, but got a wrong printable page. I faced this problem on new popup window, which is a browser popup window rather than adf faces inline popup.
    After treating <af:treetable> using <af:showPrintablePageBehavior> in popup window, I just found all cells in the table was gone on the printable page while the table header was preserved. It seems like this:
    Item | Col1 | Col2 | Col3 | Col4 | Col5 |
    Rows 1-0 of 4
    Such effect is kinda like the situation when u configure *<output-mode>printable</output-mode> in trinidad-config.xml*, which simply truncates the treetable.
    Such effect is gone when you are not using popup window. In other words, you won't face this problem and will get a normal treetable with full data when using tab or browser window.
    But currently the requirement needs that this is be done in popup window.
    Anyone give me a hint on solving this?

    I am able to get the details by designing the screen in jsp page instead of jspx page.

Maybe you are looking for

  • Problem with a link that repeat between al pages

    I do something wrong with my book , now i have alink between each page that start from page 3 and also when i delet a page it will be move to another page . this is the screen shot of my problem , how can i remove this link (line)

  • How to create SynBO with  BAPIs from R/3 server?

    Hi, Can I get any documents or links regarding Syncbo creation with BAPIs from another R/3 server. I think I have to create RFC destination for this. The steps for creating RFC destination in Netweaver 2004s is also helpful for me. Also I need the re

  • Is it possible to unload a class thru the standard Classloader

    is it possible to unload a class thru the standard Classloader, I mean during runtime..

  • Adobe printing issues

    We have a situation in which we need our adobe program to default to a different printer than the windows default printer. Example: We have a dot matrix printer set as windows default printer. We have to keep this as the default printer because we us

  • Opening a project originally created in Pre2 issues

    Hello, I had started a project in Elements 2 about 6 months ago.    Now, I'm using Elements 9, to opened this project.   When I open this project in Elements 9, what happens is that every image, sound and video appears correctly with all transitions