Export to Excel from Report region (pl/sql returning sql query)

Hello all,
I have encountered an interesting problem. I have an HTMLDB application with a lot of sql reports coded straight inside the report region. In order to better organize my reports, I decided to
1. make all my report regions of type "Pl/Sql function returning SQL query"
2. create a package inside my database schema which houses all reports as pl/sql functions returning VARCHAR2, the string returned being the report query
3. just calling "return package_name.function_name" from inside my report region of type "Pl/sql function returning SQL query".
This technique seemed to work perfectly. The reports were being returned as expected. I was then asked to provide the "Export to Excel" capability to all my reports. This seemed like a piece of cake using HTML DB's "Export to Excel" extension. However, the "export to excel" does not function correctly when my reports are inside a package in the database. HTML DB tries to export but inside the excel spreadsheet, instead of seeing row data, I see:
<pre>failed to parse SQL query:
ORA-00936: missing expression
<!-- select a.username, b.table_name, 'View Row Data' from schema_browser_user_list a, all_tables b where a.user_id = and a.username = b.owner order by b.table_name asc
--!>
</pre>
I am building my query string inside of my package functions by using a combination of literal strings and concatenating them with some parameter values being passed in. It seems that the HTML DB engine which exports the report to excel does not properly understand the concatenation of variables as can be seen by the empty space to the right of the equal sign in the "a.user_id = " clause. Does anybody have any input as to whether this is a known issue or if I am doing something wrong? Thanks a lot for your time.
- Kenny R.

James,
Thanks for the quick reply. I think you mis-understood what I'm doing. All I'm doing is creating packaged functions which return VARCHAR2. The VARCHAR2 that they return is the report query. With this technique, I no longer have to type the query into the HTML DB report region. Instead, I make the report region a "Pl/sql function returning sql query" and make the following call: return package_name.function_name(some_application_items passed in as parameters)
This makes for a much more organized html db app. The problem is that the "export to excel" function does not correctly interpret the VARCHAR2 that my packaged functions are returning. Is this a better explanation? Thanks again for your time.
- Kenny R.

Similar Messages

  • SSRS exporting to excel from Report Viewer is not respecting boolean critera

    Symptom:
    What's happening is that we are selecting a 
    set of criteria eg: start date,  drop down filter and a bit field.
     After running the report against this criteria it comes up in the report viewer with the correct results.
    However after we export the current results to Excel the results in Excel are different because it seems
    that exporting
    re-ran the report without the selected bit field when SSRS should have taken the current run and converted it. This isn't happening on all bit fields either 
    which is the oddest part. However all of the bit parameters are setup the same in the RDL.
    We're Loading the report into and rendering it in the Report Viewer control and then leveraging the Report Viewer's Render Routine to export on a button click.
    The result to Excel.
    <asp:imagebutton
    ImageUrl="/Images/excel.png"
    id="btnExportExcel"
    runat="server"
    ToolTip="Export to Formatted Excel"
    Height="20"
    Width="20"
    />
    ...logic to setup the out parameters in the Render routine.
    bytes = ReportViewer1.ServerReport.Render("EXCEL",
    Nothing, mimeType, encoding, extension, streamids, warnings)
    Response.Buffer =
    True
    Response.Clear()
    Response.ContentType = mimeType
    Response.AddHeader("content-disposition",
    "attachment; filename=" & ReportViewer1.ServerReport.ReportPath.Split("/")(2) &
    "." + extension)
    Response.BinaryWrite(bytes)
    Response.Flush()
    Response.End()
    I wanted to know if anyone has seen this odd behavior and if there's situation where the server would re-render the report when exporting to a particular format? I would also like to add that no errors
    came up either.

    Report Viewer 2008
    ProductVersion  
    FileVersion      FileName
    10.0.30319.1    
    10.0.30319.1     ...\Microsoft.ReportViewer.Common.dll
    10.0.30319.1    
    10.0.30319.1    ...\Microsoft.ReportViewer.WebForms.dll
    Report Server
    SQL Server 2008 R2 
    Report Server Version
    Microsoft SQL Server Reporting Services Version 10.50.2769.0 
    2008 RDL's
    <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition"
     xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">

  • Export to Excel from Reports produces corrupt file format

    Whenever I choose to export to excel results of custom reports I am unable to open the file as I am told the file format is corrupt. The contents show as containing xml data and even changing the extension from xls to xml does not get me anywhere.
    If I save the report and then download I am still informed the file format does not match the extension but the fie will open in Excel.

    Hi,
    Please raise a ticket or provide the URL if the issue is still there.
    Kind Regards,
    Alex

  • ORA - 01031: insufficient privileges from report region

    Hi All,
    I'm getting below error from report region query (2 on a page and both return same error):
    failed to parse SQL query
    ORA - 01031: insufficient privileges
    When I refresh page, it does not throw error and displays proper data. Can anyone please advice what could have gone wrong here?
    Thanks.

    Hi
    It would be easy to help you if you please provide the details about your environment like Database & Apex version.
    Is the query in your report region is using tables? Are they in the same schema which your application's workspace is based on? Or are you using some DB Link or views or querying data from some other schema?
    Also trying using Debug option in Apex to get some idea what's actually executing behind it? Try that query in SQL Plus/SQL Developer and see what you are getting?
    Zulqarnain
    MaxApex Hosting
    http://www.maxapex.com

  • Exporting to Excel from Aria People Search

    Is it possible to export to Excel from Aria People Search.
    I would like to output the Org Chart (built in) and the Tree (I created) to an Excel file.
    Does anyone know how to do this?
    Thanks,
    Tom

    Hi,
    If you are using 10g, then OLE2 is supported. However, it will be executed in the App Server Machine.
    If you want to do the operation in the Client machine (as how it was done in the Client / Server), you need to use Client_OLE (Which is part of WebUtil).
    Look at
    http://www.oracle.com/technology/products/forms/htdocs/webutil/webutil.htm
    for more details on WebUtil.
    HTH.
    Regards,
    Arun

  • Any method to Import & Export to Excel from Client Side

    Hi,
    Is there any method to Import and Export to Excel from the Client side. I have one procedure to export to Excel , but the excel file will be opened in the Application Server only, even if it executed from the client side. Also this procedure will not work if OLE2 chnaged CLIENT_OLE2. I am writing my procedure, Is there any idea to get it in the client side.
    PROCEDURE pr_Forms_to_Excel(p_block_name IN VARCHAR2 DEFAULT NAME_IN('system.current_block')) IS
    -- Declare the OLE objects
    application OLE2.OBJ_TYPE;
    workbooks OLE2.OBJ_TYPE;
    workbook OLE2.OBJ_TYPE;
    worksheets OLE2.OBJ_TYPE;
    worksheet OLE2.OBJ_TYPE;
    cell OLE2.OBJ_TYPE;
    range OLE2.OBJ_TYPE;
    range_col OLE2.OBJ_TYPE;
    -- Declare handles to OLE argument lists
    args OLE2.LIST_TYPE;
    -- Declare form and block items
    form_name VARCHAR2(100);
    f_block VARCHAR2(100);
    l_block VARCHAR2(100);
    f_item VARCHAR2(100);
    l_item VARCHAR2(100);
    cur_block VARCHAR2(100) := NAME_IN('system.current_block');
    cur_item VARCHAR2(100) := NAME_IN('system.current_item');
    cur_record VARCHAR2(100) := NAME_IN('system.cursor_record');
    item_name VARCHAR2(100);
    baslik VARCHAR2(100);
    row_n NUMBER;
    col_n NUMBER;
    filename VARCHAR2(100);
    ExcelFontId OLE2.list_type;
    BEGIN
    -- Start Excel
    application:=OLE2.CREATE_OBJ('Excel.Application');
    OLE2.SET_PROPERTY(application, 'Visible', 'True');
    -- Return object handle to the Workbooks collection
    workbooks:=OLE2.GET_OBJ_PROPERTY(application, 'Workbooks');
    -- Add a new Workbook object to the Workbooks collection
    workbook:=OLE2.GET_OBJ_PROPERTY(workbooks,'Add');
    -- Return object handle to the Worksheets collection for the Workbook
    worksheets:=OLE2.GET_OBJ_PROPERTY(workbook, 'Worksheets');
    -- Get the first Worksheet in the Worksheets collection
    -- worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Add');
    args:=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, 1);
    worksheet:=OLE2.GET_OBJ_PROPERTY(worksheets,'Item',args);
    OLE2.DESTROY_ARGLIST(args);
    -- Return object handle to cell A1 on the new Worksheet
    go_block(p_block_name);
    baslik := get_block_property(p_block_name,FIRST_ITEM);
    f_item := p_block_name||'.'||get_block_property(p_block_name,FIRST_ITEM);
    l_item := p_block_name||'.'||get_block_property(p_block_name,LAST_ITEM);
    first_record;
    LOOP
    item_name := f_item;
    row_n := NAME_IN('SYSTEM.CURSOR_RECORD');
    col_n := 1;
    LOOP
    IF get_item_property(item_name,ITEM_TYPE)<>'BUTTON' AND
    get_item_property(item_name,VISIBLE)='TRUE'
    THEN
    -- Set first row with the item names
    IF row_n=1 THEN
    ------updated by faisal-to give Bold font-----
    --FOR k IN 1 .. 3 LOOP
         args := OLE2.create_arglist;
         OLE2.add_arg(args, 1);
         OLE2.add_arg(args, col_n);
         cell := OLE2.get_obj_property(worksheet, 'Cells', args);
         OLE2.destroy_arglist(args);
         --cell_value := OLE2.get_char_property(cell, 'Value');
         ExcelFontId := OLE2.get_obj_property(Cell, 'Font');
         OLE2.set_property(ExcelFontId, 'Bold', 'True');
    --END LOOP;
    baslik:=NVL(get_item_property(item_name,PROMPT_TEXT),baslik);
    args:=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, row_n);
    OLE2.ADD_ARG(args, col_n);
    cell:=OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', args);
    OLE2.DESTROY_ARGLIST(args);
    OLE2.SET_PROPERTY(cell, 'Value', baslik);
    OLE2.RELEASE_OBJ(cell);
    END IF;
    -- Set other rows with the item values
    args:=OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG(args, row_n+1);
    OLE2.ADD_ARG(args, col_n);
    cell:=OLE2.GET_OBJ_PROPERTY(worksheet, 'Cells', args);
    OLE2.DESTROY_ARGLIST(args);
    IF get_item_property(item_name,DATATYPE)<>'NUMBER' THEN
    OLE2.SET_PROPERTY(cell, 'NumberFormat', '@');
    END IF;
    OLE2.SET_PROPERTY(cell, 'Value', name_in(item_name));
    OLE2.RELEASE_OBJ(cell);
    END IF;
    IF item_name = l_item THEN
    exit;
    END IF;
    baslik := get_item_property(item_name,NEXTITEM);
    item_name := p_block_name||'.'||get_item_property(item_name,NEXTITEM);
    col_n := col_n + 1;
    END LOOP;
    EXIT WHEN NAME_IN('system.last_record') = 'TRUE';
    NEXT_RECORD;
    END LOOP;
    -- Autofit columns
    range := OLE2.GET_OBJ_PROPERTY( worksheet,'UsedRange');
    range_col := OLE2.GET_OBJ_PROPERTY( range,'Columns');
    OLE2.INVOKE( range_col,'AutoFit' );
    OLE2.RELEASE_OBJ( range );
    OLE2.RELEASE_OBJ( range_col );
    -- Get filename and path
    args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG( args, p_block_name );
    OLE2.ADD_ARG( args,'Excel Workbooks (*.xls, *.xls');
    filename := OLE2.INVOKE_CHAR( application,'GetSaveAsFilename',args );
    OLE2.DESTROY_ARGLIST( args );
    -- Save as worksheet
    IF NVL(filename,'0')<>'0' THEN
    args := OLE2.CREATE_ARGLIST;
    OLE2.ADD_ARG( args,filename );
    OLE2.INVOKE( worksheet,'SaveAs',args );
    OLE2.DESTROY_ARGLIST( args );
    END IF;
    -- Close workbook
    --OLE2.INVOKE( workbook ,'Close');
    -- Release the OLE objects
    OLE2.RELEASE_OBJ(worksheet);
    OLE2.RELEASE_OBJ(worksheets);
    OLE2.RELEASE_OBJ(workbook);
    OLE2.RELEASE_OBJ(workbooks);
    --OLE2.INVOKE(application, 'Quit');
    OLE2.RELEASE_OBJ(application);
    -- Focus to the original location
    go_block(cur_block);
    go_record(cur_record);
    go_item(cur_block||'.'||cur_item);
    END;
    Thanks in advance.
    Rizly Faisal

    Alternatively you could use OLE2 to do the bulk of the importing and exporting and then use the webutil file transfer functions to move the file to the client and then simply open the file there...That might be more efficient in terms of performance as well.
    Regards
    Grant

  • I need to invoke Excel from Reports 3.0.

    I need to invoke Excel from Reports 3.0. I need to insert into
    Excel Data which is output of a report. Can someone help me with
    a sample code of how we can invoke Excel and Get data.
    Thanks in Advance
    Ravi

    Ravi,
    The Forms Demos include an example of how to do this.
    It will be easy to adapt to Reports (the OLE2 built-ins are the
    same).
    Also, Reports 3.0 is quite old and not supported anymore.
    Hope this helps,
    Pedro
    [email protected]

  • Help with PL/SQL returning SQL query for Report

    Hi
    I have got a report which I have formatted as PL/SQL function body returning SQL query.
    I have the following code
    declare
    q VARCHAR2(32000); -- query
    w VARCHAR2(4000) ; -- where clause
    begin
    q := 'select min(identified_date) first_identified,' ||
    ' max(actual_resolution_date) last_closed,' ||
    ' count("HELPDESK_CALL_ID) total_issues,' ||
    ' from tbl_helpdesk_calls';
    if :P9_call_type != '-1' then
    w := 'HELPDESK_CALL_TYPE_ID = :P9_call_type';
    end if;
    q := q || ' WHERE '|| w;
    return q;
    end;
    When I apply changes I get this error message
    Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing. ORA-00972: identifier is too long
    Any Idea where I maybe going wrong?

    thanks its compiling now but when I run the page I get this error message in the reports region
    failed to parse SQL query:
    ORA-00933: SQL command not properly ended
    This is my code that I have at the momment.
    declare
    q VARCHAR2(32000); -- query
    w VARCHAR2(4000) ; -- where clause
    we VARCHAR2(1) := 'N'; -- identifies if where clause exists
    begin
    q := 'select min(identified_date) first_identified,' ||
    ' max(actual_resolution_date) last_closed,' ||
    ' count(HELPDESK_CALL_ID) total_issues,' ||
    ' sum(decode(status,''Open'',1,0)) open_issues, ' ||
    ' sum(decode(status,''On-Hold'',1,0)) onhold_issues,' ||
    ' sum(decode(status,''Closed'',1,0)) closed_issues,' ||
    ' sum(decode(status,''Open'',decode
    (priority,''High'',1,0),0)) open_high_prior,' ||
    ' sum(decode(status,''Open'',decode
    (priority,''Medium'',1,0),0)) open_medium_prior, '||
    ' sum(decode(status,''Open'',decode
    (priority,''Low'',1,0),0)) open_low_prior '||
    ' from tbl_helpdesk_calls';
    if :P9_call_type != '-1' then
    w := 'where HELPDESK_CALL_TYPE_ID = :P9_call_type';
    we := 'Y';
    end if;
    if we = 'Y' then
    q := q ||w;
    end if;
    return q;
    end;
    I have a select list with a list of reports. what I am trying to do build an sql depending on what the :p9_call_type value is. -1 represents the display value of -All Reports- so if the user selects all reports it should display all results thus removing the where clause. However as my code stands when I user clicks on all reports he get the correct results for all reports. If the user selects anything else they get the error message above.

  • Export to Excel from PL/SQL Procedure

    Hello,
    I am creating a report using PL/SQL and html code. Once the report is display, I click on "Export to Excel" button. it should open the new window with Excel. The window opens in Excel, but no data. I have following code
    as the first statement in the procedure.
    OWA_UTIL.MIME_HEADER ('application/vnd.ms-excel', FALSE);
    and this is the script
    <script language="JavaScript">
    var param_list
    l_param_list := l_param_list || '&p_app_main_id=' || p_app_main_id;
         l_param_list := l_param_list || '&p_from_date=' || p_from_date ;
         l_param_list := l_param_list || '&p_to_date=' || p_to_date ;
    htp.prn('
    param_list = ''');
    htp.prn( l_param_list);
    htp.prn('''
    function NewWindow(mypage,myname,w,h,scroll){
    var win = null;
    LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
    TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
    settings = ''height=''+h+'',width=''+w+'',top=''+TopPosition+'',left=''+LeftPosition+'',scrollbars=''+scroll+'',resizable''
    win = window.open(mypage,myname,settings)
    win.focus();
    function ExportToExcel() {
    var wndname = ''ExpCodeMoveRep'';
    var wndw = screen.width-10;
    var wndh = screen.height-10;
    var wattr = ''scrollbars=yes,toolbar=yes,resizable=yes,menubar=yes'';
    var wndurl = ''pm_codemove_report?p_output=E'';
    wndurl = wndurl + param_list;
         NewWindow(wndurl,wndname,wndw,wndh,wattr);
    </script>
    My submit is
    htp.prn('
    <p align="center">
    <input type="button" class="printbutton" value="Close" class="button" OnClick="window.close();"> 
    <input type="button" class="printbutton" value="Export To Excel" class="button" OnClick="ExportToExcel();">');
    Can anyone tell me what is wrong.
    I have the same code in another schema and it is working fine. Both schema are on the same server. Do they have any set up on appserver in DAD file to be able to see the data in Excel?
    Thanks
    Yagna

    Thank you for your answer dccase!
    I decided to go with on demand process. I have trouble with calling procedure from (button URL - javascript:popupURL('#OWNER#.exportXML')) pop window which cause "Forbidden, The requested operation is not allowed" error. I read that this is because I'm using XE edition and there is no HTMLDB_PUBLIC_USER role in XE.
    Now, I use on demand process and button URL link:
    javascript:popupURL('f?p=&APP_ID.:0:&APP_SESSION.:APPLICATION_PROCESS=PLSQL_Export_XML:NO::')
    It is working. Now I have to find solution to automatically close popup window :-)
    Thanks!
    Marko

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

  • EXPORT EXCELL FROM REPORT

    Hi
    I want to be able to export the output of oracle*report in excell, but i want to export only some colunn/data not the entire data
    Can someone help me
    tks
    ale

    i've not to develop reports as new , my reports are already developed.
    I need a generic way to apply in oracle*report to choose data to be exported in excell. So i 've not to modify the source of my reports
    tks
    Ale

  • 2 Report -Regions combine in 1 Report-Region but 2 different SQL-Querys

    Hallo,
    I have a question.
    I have a page and within this page 2 different report-regions. Each of this regions has its own sql-query.
    Now I would like to concentrate them in 1 report with one title. But there are still 2 differnet sql-query
    that I can't combine. My issue is that I only want to show the result in one report.
    Does this work or is there a workaround I could do?
    Thanks, Jade

    Hi,
    As the report region's title is just whatever text you've entered, you can just put the title on the second report onto the first report and set the second report to use "No Template". You would probably need to remove the pagination settings for both reports - select No Pagination and set the row count to a high number.
    The final bit would probably require a new report template - you can create a copy of the existing report template that you're using - and remove the Column Heading Template setting. This is only necessary if you need to remove the column headings from the second report. There would be a gap between the two reports - not sure if you need to remove this as well? If so, you would have to adjust both templates to remove the this from the bottom of the first report and the top of the second report.
    I think that how you go about this will depend on exactly what you need to see between the two reports - if they need to look as though they are just a single report then you may have to complete all of the above steps.
    Andy

  • Connecting a report region and a PL/SQL region

    Hi,
    I have created a report region whith pagination that only show 1 row at a time. I can then navigate backwards and forwards through this recordset. The first reportcolum in this recordset contains a number.
    I have also, on the same page, created a PL/SQL procedure region. What I want is to use the number from the SQL region as an input to the PL/SQL region. So when I navigate through the report (Using the pagination arrows), the PL/SQL region is in sync with the record I'm currently seeing in the report.
    Is this possible or do I have to try something different?
    Regards
    Trond

    Hi Trond,
    If you only want to show one record in your first region, it might be best to work with page items, retrieve one record at a time and use that data as the source for your page items. It's easier to implement and easier to reference those values in your second region. Reports are great if you have more then one record.
    Having said that, there are ways to implement it the way you outlined it in your posting. Granted it's not very elegant but it serves its purpose. You could write your own PL/SQL package, use this to set a global to the current row's primary key value and reference that global in your second region.
    Create your package as follows:
    create or replace package md_sample as
    g_pk_value number;
    function set_value(p_value number) return number;
    end;
    create or replace package body md_sample as
    function set_value(p_value in number) return number is
    begin
    g_pk_value := p_value;
    return 1;
    end;
    end;
    Now you need to make sure that your report calls this package appropriately. Calling this as part of your SQL statement won't work properly as it would also be called for records not currently shown on your page. A better way would be to use it for a PL/SQL expression within your report template definition. Pick a custom report template for your report and edit that template. Scroll down to the condition for the first column template and pick “Use Based on PL/SQL Expression”. Then type in the following expression (this is based on a select deptno, dname, loc from dept report):
    md_sample.set_value(#DEPTNO#)=1
    After that you'll be able to reference the global md_sample.g_pk_value. You could e.g. use this as the source for page items shown in your second region.
    Hope this helps,
    Marc

  • Erratic Report Region Behavior with Dynamic SQL Queries

    I'm running HTMLDB v 1.5.1.00.12 and I've noticed some odd behavior with report regions using dynamic SQL queries. Every so often, our testers will run a page containing a dynamic sql report region and get the following error, (despite the fact the query was working only moments ago and no other developer has touched it):
    ORA-06502: PL/SQL: numeric or value error: character string buffer too small
    or sometimes
    failed to parse SQL query:ORA-01403: no data found
    The only solution I've found so far is to:
    1) Make a copy of the failed report region.
    2) Disable or delete the original failed report region.
    The new copy of the report region runs without issue.
    My search of the forums turned up the following two threads, but neither provided me with a clear explanation of the cause, and how to avoid it:
    ORA-06502:PL/SQL: numeric or value error: character string buffer too small
    Re: Import Export Error (ORA-06502)
    The columns being returned are below the 4000 character limit, and the rows being returned are far less than 32k in size.
    Could this have anything to do with the way HTMLDB is internally storing the PL/SQL used to generate the dynamic SQL Query? Is there any known issue related to this with that version of HTMLDB?
    This problem occurs without any discernable pattern or consistency, making it hard to determine where I should focus my efforts in tracking down the cause.

    Hi all,
    My report seems to be behaving correctly once i set it to "Use Generic Column Names (parse query at runtime only)" :)
    Cheers,
    Joel

  • Error while exporting to excel from a JSP page on Win XP

    Hi,
    I have used the below code to output the content from jsp to excel file, its working fine until we noticed an error on computers with Windows XP installed. The application is working fine on Win 2k systems. Please help.
    response.setContentType("application/vnd.ms-excel");
    response.setHeader("Content-disposition", "attachment;filename=Report.xls");

    My problem was somewhat similar....
    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...

Maybe you are looking for