Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
Automatically export report to Excel
Erebel55
Hi, does anyone know if there is a way to force a report to automatically export itself to an excel file?
In other words, normally the user will have to run the report and then choose the export to excel options. However, I want to bypass this initial step so that the report will automatically export itself to excel.
I'm using Birt 2.6.2
Thanks
Find more posts tagged with
Comments
HPP
I have done in this way for an pdf.
what i did is "fileName.rptdesign&__format=pdf" I gave this in the place where I call my report its working for me.
Erebel55
Thank you HPP this was very helpful.
HPP
Always welcome,
pls post in the forum , if u have any further doubts,
madhavil
hi HPP,
Can you please tell me how to pass parameters in this case. We are displaying reports on jsf page using:
<birt:birtWrapper id="productReportId" reportDesign="/reports/warehouse_stock_qty.rptdesign">
<f:param name="StyleSheet" value="#{userLoginBean.productReportCssPath}" />
<f:param name="selectedDCName" value="#{userLoginBean.filteredDCName}" />
</birt:birtWrapper>
Also we need to export the reports as a pdf or excel file. Please suggest if you have solutions.
We are using Birt 2.6
Thanks in advance,
Madhavi.
Clement Wong
Madhavi,<br />
<br />
This probably warrants a new thread since you're trying to use JSF, and not a direct Viewer servlet URL to run/render your report.<br />
<br />
What parameters are you trying to pass? It appears that you are already passing two parameters: StyleSheet and selectedDCName to your report design.<br />
<br />
Since you are using JSF, you can use the available Javascript JSF4Actuate methods for displaying the report in PDF or Excel formats. Just make sure you have a FORM tag with an ID around the birtWrapper so that you can reference the item in the Javascript function.<br />
<br />
For example, if you had:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'><h:form id="yourForm">
<birt:birtWrapper id="productReportId" reportDesign="/reports/warehouse_stock_qty.rptdesign">
<f:param name="StyleSheet" value="#{userLoginBean.productReportCssPath}" />
<f:param name="selectedDCName" value="#{userLoginBean.filteredDCName}" />
</birt:birtWrapper>
</h:form></pre>
<br />
You could include the following links to export to PDF and Excel:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'><a href="javascript: void(0)" onclick="JSF4Actuate.pdf('yourForm:productReportId')">PDF</a><br/>
<a href="javascript: void(0)" onclick="JSF4Actuate.xls('yourForm:productReportId')">XLS</a></pre>
<br />
<br />
Regards,<br />
Clement Wong<br />
Actuate Corporation ? The BIRT Company?
madhavil
hi Clement Wong,
Thanks for your spontaneous reply. I tried to export the reports with your solution. But the generated xls file is not getting opened. Says some problem while opening. our reports are actually complicated that we have many cross tabs and charts.
We actually had tried the same solution earlier but then also we had the same problem and some times the file is downloaded as xhtml file with xml tags.
Other than using JSF4Actuate, is there any alternate way of doing this? I am very new to BIRT. even if it is very basic feature/solution please suggest.
I read some where that we can use a servlet and open the report directly in the required format(pdf/xls). May be i can create link on my jsf page and call to this servlet on click of this link.
Thanks a lot,
Madhavi.
Clement Wong
Regarding the resulting XLS not opening properly, do you have the same export issue in the Designer?<br />
<br />
Since you are new to BIRT, there are other Excel emitters available:<br />
- Tribix @ <a class='bbc_url' href='
http://sourceforge.net/apps/mediawiki/tribix/index.php?title=Main_Page'>SourceForge</a><br
/>
- Actuate's commercial version that includes pivot table, live formula export and other features (<a class='bbc_url' href='
http://www.actuate.com/resources/assets/?articleid=23373'>see
demo here</a>).<br />
- Spudsoft BIRT Excel Emitter @ <a class='bbc_url' href='
http://www.birt-exchange.com/be/marketplace/app-showcase/?app=102'>BIRT
Exchange Marketplace</a><br />
<br />
You can read more about replacing the default BIRT Excel Emitter @ <a class='bbc_url' href='
http://birtworld.blogspot.com/2011/07/replacing-default-birt-xls-emitter.html'>http://birtworld.blogspot.com/2011/07/replacing-default-birt-xls-emitter.html</a>.<br
/>
<br />
<br />
Regarding a servlet, you can use either the Frameset or Run servlet to execute and render the report. More information can be found here:<br />
<a class='bbc_url' href='
http://www.eclipse.org/birt/phoenix/deploy/viewerUsage2.2.php'>http://www.eclipse.org/birt/phoenix/deploy/viewerUsage2.2.phpMy
link</a><br />
<br />
As part of the parameters of the servlet (read more here<a class='bbc_url' href='
http://www.eclipse.org/birt/phoenix/deploy/viewerUsage2.2.php#parameters'>here</a>)
, you can pass "__format" and specify various output formats such as PDF or XLS.