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)
dynamical theme does not work
XFabien
<p>Hello,</p><p> </p><p>I want to change the report theme according to the report output format.</p><p>So I added the below script to the beforeFactory of the report design :</p><p> </p><p>
</p><p><span>importPackage </span><span>(</span><span>Packages</span><span>.</span><span>org</span><span>.</span><span>eclipse</span><span>.</span><span>birt</span><span>.</span><span>report</span><span>.</span><span>model</span><span>.</span><span>api</span><span>);</span></p><p> </p><p>rpt = <span>reportContext</span><span>.</span><span>getDesignHandle</span><span>()</span>;
<span>lh </span><span>=</span><span> rpt</span><span>.</span><span>findLibrary</span><span>(</span><span>"myLibrary.rptlibrary"</span><span>);</span>
<span><span>theme</span></span><span>1 </span><span>=</span><span> lh</span><span>.</span><span>get</span><span><span>Theme</span></span><span>s</span><span>().</span><span>get</span><span>(</span><span>0</span><span>);</span>
<span><span>theme</span></span><span>2 </span><span>=</span><span> lh</span><span>.</span><span>get</span><span><span>Theme</span></span><span>s</span><span>().</span><span>get</span><span>(</span><span>1</span><span>);</span>
<span>if</span><span> </span><span>(</span><span>reportContext</span><span>.</span><span>getOutputFormat</span><span>()</span><span> </span><span>==</span><span> </span><span>"xlsx"</span><span>){</span>
rpt<span>.</span><span>set</span><span><span>Theme</span></span><span>(</span><span><span>theme</span></span><span>2</span><span>);</span>
<span>}</span>
<span>else</span><span>{</span>
rpt<span>.</span><span>set</span><span><span>Theme</span></span><span>(</span><span><span>theme</span></span><span>1</span><span>);</span>
<span>}</span></p><p>
</p><p> </p><p>But when I export the report to excel, it does not change my theme to theme2.</p><p> </p><p>My birt version is 2.6.3. Does anyone has some ideas?</p><p> </p><p>Thanks for the help.</p>
Find more posts tagged with
Comments
micajblock
<p>Check out this DevShare</p><p> </p><p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/devshare/_/designing-birt-reports/1436-dynamic-theme-example'>http://developer.actuate.com/community/devshare/_/designing-birt-reports/1436-dynamic-theme-example</a></p>
;
XFabien
<blockquote class="ipsBlockquote" data-author="mblock" data-cid="122795" data-time="1386000037"><div><p>Check out this DevShare</p><p> </p><p><a data-ipb='nomediaparse' href='
http://developer.actuate.com/community/devshare/_/designing-birt-reports/1436-dynamic-theme-example'>http://developer.actuate.com/community/devshare/_/designing-birt-reports/1436-dynamic-theme-example</a></p></div></blockquote><p> </p><p>Hello
mblock,</p><p> </p><p>Thanks for the reply. I have checked your post, but it does still not work if I use the getOutputFormat as the condition.</p><p>The really output format can be fetch when the report is the render phase but not before.</p><p>To change the theme, we have to do it before the render phase.</p><p> </p><p>So is there any other workaround for this?</p>
micajblock
<p>So you want to change the theme based on render format?</p>
micajblock
<p>I think the issue is that libraries are not available at render time, so you might need to change styles or have the them in the report.</p>