Providing powerful reporting capabilities to Alfresco using Crystal Reports
Alfresco is a highly scalable content management system where you can store millions of documents and perform many workflow tasks. Alfresco provides a basic dashboard to list and track the tasks. You can also configure Alfresco to provide full audit trail information.
However, Alfresco does not provide a strong "Reporting" framework out of the box. We integrated Crystal report with Alfresco CMS for one of our customers and here is the information -
Brief Introduction about Crystal Report:
Crystal Reports is a business intelligence application used to design and generate reports from a wide range of data sources. It is an intuitive reporting solution that helps you rapidly create flexible, feature-rich, high-fidelity reports and integrate them into your web applications.
Benefits
- Leverage professional reporting
- Empower end users to explore reports with on-report sorting and parameters
- Minimize IT and developer effort
- Develop powerful data mashups
- Embed professional-looking reports in Java applications
- Tailor your solution by adding report management and viewing tools
Following are the steps to execute report in alfresco.
Create Report
First you need to create a report using Report Designer. Crystal report provides a flexible way to design a report using tool called Report Designer. You can download crystal report 30- day evaluation copy from following link, Download Crystal Report
Environment setup
Copy Java Reporting Component (JRC) and necessary support jars
Copy dependent directory (which includes UI related stuff)
Put the CRconfig.xml into your classpath
Calling a Report
Write one web page which will execute the report using Crystal Reports rendering engine.
- By
Tejas Kanani
Consultant at CIGNEX, India Office

















Comments
More details please
Hello,
Can you give more details how to get crystal report to work with Alfresco? Which version of crystal report do I download and where do I find the hars and all the other related files?
Thanks lots
RE : Crystal report integration with Alfresco Details
Hi Alex,
Thanks for showing interest in Crystal Report integration with Alfresco.
Regarding version of crystal report, you can download Crystal Report 11.
And for your second question Please find below steps in order to execute the report from any web application.
In this example, we’ll use Tomcat. We’ll assume the web application that
will host the reporting application is running already in a web application called
“CRStartupGuide”, and is already installed as per the Tomcat administrative interface.
1. Copy Java Reporting Component (JRC) and necessary support .jars from
C:\Program Files\Common Files\Business Objects\3.0\java\lib and C:\Program
Files\Common Files\Business Objects\3.0\java\lib\external into the “WEB-INF\lib”
folder inside the web application or .war file.
2. As our report was created off ODBC, which is not a pure Java database
connection type, we need to map the ODBC connection to JDBC using the JDBCODBC
bridge in order for the JRC to connect and query the database for report
data. To do this, include the following in the <env-entry> in the
CRStartupGuide’s web.xml file:
<env-entry>
<env-entry-name>jdbc/Xtreme Sample Database 11</env-entryname>
<env-entryvalue>!
sun.jdbc.odbc.JdbcOdbcDriver!jdbc:odbc:Xtreme Sample
Database 11</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry>
3. Copy the crystalreportviewers11 directory (found in C:\Program Files\Common
Files\Business Objects\3.0) to a subdirectory of the same name directly
underneath the CRStartupGuide directory (as a peer to WEB-INF). Ensure that all
contents, both files and subdirectories, are copied—there should be about 150
files in all. This name of this subdirectory in the CRStartupGuide directory is not
important, so long as it matches up when referenced in the web.xml file, which
must have the following block added:
<context-param>
<param-name>crystal_image_uri</param-name>
<param-value>crystalreportviewers11</param-value>
</context-param>
Generally, developers will leave the name as is (crystalreportviewers11).
4. Copy the CRconfig.xml file into the “WEB-INF/classes” subdirectory from
C:\Program Files\Common Files\Business Objects\3.0\java directory.
5. Copy the report file itself into the root of the webapp.
6. Write the JSP page (call it basic.jsp, in the root of the web application
subdirectory) that will ask the Crystal Reports rendering engine to take the
passed report and generate HTML from it, echoing it back to the webapp’s
current client. This takes two principal steps. First, we need to create a report
source that the report viewer will use as the input for generating the report, then
we need to create a report viewer to use to process the HTTP request. In Crystal
Reports XI, the report source is obtained from the ReportClientDocument, which
is used to open the RPT file, as shown here:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="com.crystaldecisions.reports.sdk.*" %>
<%@page
import="com.crystaldecisions.sdk.occa.report.reportsource.*"
%>
<%@page import="com.crystaldecisions.sdk.occa.report.lib.*" %>
<%
String reportName = "report1.rpt";
try
{
//check to see if the report source already exists
Object reportSource =
session.getAttribute("reportSource");
//if the report source has not been opened
if (reportSource == null)
{
//---------- Create a ReportClientDocument -----------
--
ReportClientDocument oReportClientDocument = new
ReportClientDocument();
//---------- Set the path to the location of the
report soruce -------------
//Open report.
oReportClientDocument.open(reportName, 0);
//Get the report source
reportSource =
oReportClientDocument.getReportSource();
//Cache report source.
//This will be used by the viewer to display the
desired report.
session.setAttribute("reportSource", reportSource);
}
//Redirect to the viewer page.
response.sendRedirect("CrystalReportViewer.jsp");
}
catch(ReportSDKException e)
{
out.print(e);
}
7. Create a second page, called CrystalReportViewer.jsp, this will contain the calls to
the Viewer SDK, as shown below:
<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="com.crystaldecisions.report.web.viewer.*"%>
<%@page import="com.crystaldecisions.reports.sdk.*" %>
<%@page
import="com.crystaldecisions.sdk.occa.report.reportsource.*"
%>
<%
//Get the IReportSource object from sesion and pass it to
the viewer
IReportSource reportSource =
(IReportSource)session.getAttribute("reportSource");
//create the CrystalReportViewer object
CrystalReportViewer oCrystalReportViewer = new
CrystalReportViewer();
//set the reportsource property of the viewer
oCrystalReportViewer.setReportSource(reportSource);
//set viewer attributes
oCrystalReportViewer.setOwnPage(true);
oCrystalReportViewer.setOwnForm(true);
//set the CrystalReportViewer print mode
oCrystalReportViewer.setPrintMode(CrPrintMode.ACTIVEX);
//refresh the CrystalReportViewer if necessary (only
required once)
if (session.getAttribute("refreshed") == null)
{
oCrystalReportViewer.refresh();
session.setAttribute("refreshed", "true");
}
oCrystalReportViewer.processHttpRequest(request, response,
getServletConfig().getServletContext(), null);
%>
8. Browse to http://localhost:8080/CRStartupGuide/basic.jsp to view the report:
I hope it helps.
Thanks,
Tejas Kanani