How to Call Rep2excel

Rep2excel provides 2 user interfaces

  1. Command line interface
  2. Common Gateway Interface (CGI)

You can

Call Rep2excel through command line


Rep2excel support command line interface, you can call it through dos prompt, you can also call it by HOST built-in in Oracle Forms.

Test Rep2excel in dos prompt
  1. Click Start menu, click Run, input cmd and then click OK, start the dos prompt.
  2. Change current directory to the rep2excel installation directory.
  3. Please use rep2excel --help to get the usage .

The output of Rep2excel looks like:

For example, the file d:\working\rep\emp_list2.htm will be converted, see below

D:\working\Rep2excel111\Release>rep2excel -i:d:\working\rep\emp_list2.htm
Input file : d:\working\rep\emp_list2.htm
Output file: d:\working\rep\emp_list2.xls
Finish succefully!


Deploy Rep2excel in web server, call it through http link


Rep2excel supports CGI interface, you can install rep2excel on a web-server which supports CGI and invoke this program using WEB.SHOW_DOCUMENT built-in.[Demo Online]


First, you should install rep2excel as CGI service. See here.

Once rep2excel is installed, try your first conversion with rep2excel!

Please fill the full location of an oracle report output file into File Path box, then click Submit button.

The location of the file may be a URL, e.g.

IE will show you excel output

Integrate Rep2excel into your application



  1. Call Rep2excel through HOST built-in in Oracle forms.
  2. Call rep2excel from oracle forms from web.
  3. Call rep2excel from web page


Call Rep2excel through HOST built-in in Oracle forms.

Sample code

Call rep2excel from oracle forms from web.

You can call rep2excel from oracle forms using web.show_document built-in.
If you are now using web.show_document to open a HTML file generated by oracle report server, you can invoke rep2excel to get excel easily.

The following sample code demonstrates how to change your code to work with rep2excel.
Your original code:

v_url varchar2(1000);
v_url := 'http://SVR_NAME:7777/dev60cgi/rwcgi60?';
v_url := v_url || 'server=rep_svr&report=test_report.rdf&userid=scott/tiger@test&destype=cache&desformat=HTMLCSS';

Please change the first parameter of web.show_document, like this

v_url varchar2(1000);
v_url := 'http://SVR_NAME:7777/dev60cgi/rwcgi60?';
v_url := v_url || 'server=rep_svr&report=test_report.rdf&userid=scott/tiger@test&destype=cache&desformat=HTMLCSS';

--Modify begin
--v_url:=encode_url(v_url);--This step is optional
--Modify end

Sample code of Forms/Reports 10gR2.

v_rep VARCHAR2(100);
rep_status VARCHAR2(50);
v_url_to_access_rep2excel varchar2(200) ; -- The url that link to Rep2excel.
v_url_to_get_html_report varchar2(500) ; -- The url that is used to download report from the report server.
v_the_final_url varchar2(500) ; -- The url that call Rep2excel to download html report and convert to excel.


repid := find_report_object('REPORT6');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'HTML'); -- The Rep2excel support report in html or htmlcss format only.
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,'REP_192_ORACLEAS2'); --To be changed according to your environment.

v_rep := RUN_REPORT_OBJECT(repid);
rep_status := REPORT_OBJECT_STATUS(v_rep);

rep_status := report_object_status(v_rep);
IF rep_status = 'FINISHED' THEN

v_url_to_get_html_report := ''||
substr(v_rep,instr(v_rep,'_',-1)+1)||'?'||'server=rep_192_oracleas2'; --To be changed according to your environment.

v_url_to_access_rep2excel := '/cgi-bin/rep2excel.exe' ; -- We assume that you put the Rep2excel to the folder: ORACLE_HOME/Apache/Apache/cgi-bin

v_the_final_url := v_url_to_access_rep2excel || '?filepath=' || v_url_to_get_html_report ; -- See how to pass parameter to Rep2excel.
if :OUTPUT_TYPE ='excel' then
WEB.SHOW_DOCUMENT( v_the_final_url ,'_blank'); -- Call Rep2excel, and then Rep2excel will download the report output, and then serve back excel
WEB.SHOW_DOCUMENT( v_url_to_get_html_report ,'_blank'); -- Get original html output
end if;
message('Error when running report');

There is a example included in rep2excel installation patch. You can download the latest version

The URL encoding (optional).

In an encoded string, blanks are changed into + and special characters are made by the % symbol, followed by the hexadecimal digits of the ASCII code.
For example the character "-" is substituted by the string "%2d".

Note: The URL encoding is optional, actually Rep2excel can detect the correct URL.

The sample code of function encode_url is

Call rep2excel from web page

If you call oracle report server from a html form, you can also call rep2excel to convert the oracle report output. and you will have to do some coding, see the sample code:

function runReport()
// semi-constants for JavaScript 8-)
var cgiexe = "rwcgi60.exe";
var slash = "/";
var colon = ":";
var qmark = "?";
var paramsep = "&";
** URL parameter values
** We should check for nulls, http://, etc. but not for now ...
var WEBHOST = document.REPFORM.WEBHOST.value;
var WEBPORT = document.REPFORM.WEBPORT.value
var SERVER= document.REPFORM.SERVER.value;
var REPORT = document.REPFORM.REPORT.value;
var USERID= document.REPFORM.USERID.value;
var dtlist = document.REPFORM.DESTYPE;
var DESTYPE = dtlist.options[dtlist.selectedIndex].value;
var dflist = document.REPFORM.DESFORMAT;
var DESFORMAT = dflist.options[dflist.selectedIndex].value;
// construct the final URL given the parameters

//Leo Change begin
var URL = "http://" + WEBHOST + colon + WEBPORT + "/dev60cgi/"
+ cgiexe + qmark +
"server=" + SERVER + paramsep +
"report=" + REPORT + paramsep +
"userid=" + USERID + paramsep +
"destype=" + DESTYPE + paramsep ;
URL = URL + "desformat=HTML"
// URL = "http://localhost:7777/cgi-bin/rep2excel.exe?filepath=" + escape(URL);
URL = "http://" + WEBHOST + colon + WEBPORT + "/dev60cgi/rep2excel.exe?filepath=" + escape(URL);

if (document.REPFORM.mailto.value != "") //Send excel file
URL = URL + "&mailto=" + document.REPFORM.mailto.value;

URL = URL + "desformat=" + DESFORMAT;
// If you have any question about this form,
// please do not hesidate to contact .
//Leo Change End

runWindow =;

For more details, please refer to the example from