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)
How to prevent hidden charts and tables to be exported to PDF
Saroj1234
Hi,<br />
<br />
I have 3 charts and 3 tables bound to different datasets in my report.<br />
Based on user input, I'm showing any one pair of table and chart at any given time and hiding the other 2 pairs. There are no parameters in the report as the user selection drop downs are created by HTML data element.<br />
This means all the report elements are already rendered when the report is shown to the user (with all the graphs and tables hidden initially).<br />
<br />
I'm setting the display by using below in javascript if user selects "bar chart":<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>[b]
document.getElementById("BarChart").style.display="block";[/b]
document.getElementById("LineChart").style.display="none";
document.getElementById("PieChart").style.display="none";
</pre>
<br />
The problem is when I'm exporting the report as PDF, all the hidden charts are also getting exported.<br />
Is there a way I can avoid exporting hidden elements of the report?<br />
<br />
I did find below on some post in this forum to be put in beforeFactory:<br />
<strong class='bbc'>reportContext.getDesignHandle().findElement("mychart").setProperty("allowExport", false);</strong><br />
<br />
But where should I put this in my report which has no parameters? Also, can this be done in the same javascript in HTML text element where I'm hiding or unhiding tables/charts?<br />
<br />
Please help.<br />
Saroj
Find more posts tagged with
Comments
Saroj1234
Just to test, I set the allow export property in Advanced tab to "false" but still all the report charts and tables are getting exported.
mluggen
Hi Saroj,<br />
<br />
The script you are using is changing the HTML in the Browser when viewing. For the PDF output you need to change the report already in this generation phase. This you can do in the "Script" tab which is where also "Layout" and "Master Page" is.<br />
<br />
If you for example focus the whole page in the Layout and switch to Script you can choose the beforeFactory() function.<br />
<br />
To hide an element try this:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>reportContext.getDesignHandle().findElement("test").setProperty("display", "none");</pre>
<br />
HTH Michael