Home
Analytics
BIRT Designer does not identify the jxl.jar
nbn
<p>I have been trying to implement a vanilla plain table displaying data from an excel worksheet into my report. I am using the scripted data source/data set to read from the excel file. I do this through the jxl api(jxl.jar) and handling events(<span style="color:#0000ff;"><strong>open, OnFetch, Fetch</strong></span> etc) on the data set through java script. </p>
<p> </p>
<p>The report, for some reason, is not able to pick the jxl.jar and fails on the first instance of the code where the jxl specific call is referenced. I followed the below steps to include the jar into my report. </p>
<p> </p>
<p>- Imported the jxl.jar into a "resources" folder created in same project where my report.rptdesign lies.</p>
<p>- <strong>Windows -> Preferences -> Report Design -> Resources -></strong> . configured the "<strong>resources</strong>" folder mentioned in the above step in the "Resource folder" text box.</p>
<p>- <strong>Right click on the report -> properties -> Resource (Menu on the left) -> Jar Files</strong>: Added the jxl.jar using "<strong>Add File</strong>" </p>
<p>- When it failed to identify the jar, I further configured the jar in <strong>Windows -> Preferences -> Report Design ->Classpath.</strong></p>
<p> </p>
<p> Sample Code as below.</p>
<p><strong> </strong>importPackage( Packages.jxl.*);</p>
<p>try {</p>
<p> myWorkBook = WorkBook.getWorkbook(inputWorkBook);// <strong><span style="color:#ff0000;">Fails to recognize Workbook which is jxl.WorkBook.</span></strong></p>
<p>}Catch(e) {</p>
<p>}</p>
<p> </p>
<p>Can someone please identify the problem for me ? I am newbie and have already spent 4 days trying to identify the problem</p>
<p> </p>
Find more posts tagged with
Comments
Clement Wong
<p>Does the out of the box BIRT Excel Data Source ODA not work for you?</p>
<p> </p>
<p>If you still need to use JXL, I just tested it with OS BIRT 4.5.0 and the latest jxl.jar. It works for me.</p>
<p> </p>
<p>1. Created a new report design in Project XYZ</p>
<p>2. Copied jxl.jar to root folder of Project XYZ</p>
<p>3. Added the JAR as a Jar Resource in the root component level of report design</p>
<p>4. Overwrote the beforeFactory event to test this code snippet:</p>
<pre class="_prettyXprint">
importPackage(Packages.java.io);
importPackage(Packages.jxl);
try{
var myFile = new File("C:\\temp\\test.xls");
var myWorkBook = Workbook.getWorkbook(myFile);
}
catch(e){
}</pre>
<p>As additional reference, <a data-ipb='nomediaparse' href='
http://birtworld.blogspot.com/2011/05/birt-using-xls-as-data-source.html'>here
is blog entry</a> about using JXL as a scripted data source.</p>