Now that you have created your JSP-based Web report, which looks the same as your paper report, you will modify it further to display the report in Microsoft Excel in your Web browser.
First, copy myexcelreport_
your_initials
.jsp
to the deployment directory of your Application Server. For testing purposes, in this example, we will use the Oracle WebLogic Server instance shipped with the Oracle Developer Suite.
For more information on deploying a JSP-based Web report, refer to the section "Deploying Your Reports" in the chapter "Running Report Requests" in the Oracle Fusion Middleware Publishing Reports to the Web with Oracle Reports Services manual
To modify the report to display in Microsoft Excel:
In the Report Editor, click the Web Source button in the toolbar to display the Web Source view.
In the Web Source view, you will change the content type of the HTTP response using the JSP directive contentType
, so that the browser opens Microsoft Excel to display your report output.
In the Web Source view, find the following text:
<%@ taglib uri="/WEB-INF/lib/reports_tld.jar" prefix="rw" %> <%@ page language="java" import="java.io.*" errorPage="/rwerror.jsp" session="false" %> <%@ page contentType="text/html;charset=ISO-8859-1" %> <rw:report id="report"> <rw:objects id="objects"> </rw:objects> ...... ...... <!-- </rw:report> -->
and modify it to read as follows:
<%@ taglib uri="/WEB-INF/lib/reports_tld.jar" prefix="rw" %> <%@ page language="java" import="java.io.*" errorPage="/rwerror.jsp" session="false" %> <%@ page contentType="application/vnd.ms-excel;charset=ISO-8859-1" %> <rw:report id="report"> <rw:objects id="objects"> </rw:objects> ...... ...... <!-- </rw:report> -->
Save your report.
Copy the Web report (myexcelreport_
your_initials
.jsp)
into the following directory:
$DOMAIN_HOME\servers\MANAGED_SERVER_NAME\stage\reports\reports\web.war
Start your Oracle WebLogic Server instance to enable the deployment of your report.
On Windows, you can do either of the following:
From the Start menu, choose Programs > Oracle Classic Instance > Reports Services > Start WebLogic Server - WLS_REPORTS.
For example, the Oracle Classic Instance may be Oracle Classic Instance-asinst_1.
From the command line, run the following command:
cd $DOMAIN_HOME\bin\startManagedServer.bat WLS_REPORTS
On UNIX, start the shell script from the command line:
$DOMAIN_HOME\bin\startManagedServer.sh WLS_REPORTS
Tip:
The Oracle WebLogic Server instance starts once the containers for Java EE have been initialized.Type the following URL to display your report in Microsoft Excel in your Web browser:
http://your_computer:port/reports/yourexcelreportname.jsp?userid=hr/hr@db
In our example, we use:
http://mycomputer-pc:8888/reports/my_excel_report.jsp?userid=hr/hr@orcl
Note:
The connect string you type in the URL is for the database you used to create the data model in Section 29.2, "Create a Query and the Layout". For the purposes of this example, we have used plain text to pass the connect string. For information on using security, refer to the chapter "Securing Oracle Reports Services" in the Oracle Fusion Middleware Publishing Reports to the Web with Oracle Reports Services manual.The report runs, and the browser displays your report in Microsoft Excel.
Note:
If you want your report to display the same colors in Excel as in your report definition, you must use colors supported by the Excel color palette. Otherwise, Excel tries to match unsupported colors, but the match may not be what you expect.Your final report output should look something like this:
Figure 29-4 Microsoft Excel Output of Your Report