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)
Does anyone has this problem?
emilio
I'm having this problem with an embedded report and would like to know if anyone has the same problem and found a solution. Please check the bug report page:<br />
<br />
<a class='bbc_url' href='
https://bugs.eclipse.org/bugs/show_bug.cgi?id=353895'>CSS
classes are not outputted to the HTML</a>
Find more posts tagged with
Comments
JasonW
You may be able to just change this section of the HTMLReportEmitter.java class
if ( href != null )
{
boolean isEmbeddable = new HTMLRenderOption( renderOption ).getEmbeddable( );
if ( !isEmbeddable )
{// output the CSS link if it is not is embeddable
hasCsslinks = true;
writer.openTag( HTMLTags.TAG_LINK );
writer.attribute( HTMLTags.ATTR_REL,
"stylesheet" );
writer.attribute( HTMLTags.ATTR_TYPE,
"text/css" );
writer.attribute( HTMLTags.ATTR_HREF, href );
writer.closeTag( HTMLTags.TAG_LINK );
}
}
This is in the outputCSSStyles method.
Jason
Samuel Santos
Hello Jason,<br />
<br />
The page that will contain the embedded report will already contain the CSS file:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
<html>
<head>
<link rel="stylesheet" type="text/css" href="containsPageAndReportCSSClasses.css" />
</head>
<body>
<div>My embedded report...</div>
</body>
</html>
</pre>
<br />
I believe all you need to change in the section you refer to, is to set <span style='font-family: Lucida Console'>hasCsslinks = true;</span> even when <span style='font-family: Lucida Console'>isEmbeddable</span> is true. Otherwise, class attributes will not be set in the generated HTML.<br />
<br />
We may also need to remove the code at line 426 of the HTMLReportEmitter.java class (I'm not sure we can override this on our side):<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if ( isEmbeddable )
{
enableInlineStyle = htmlOption.getEnableInlineStyle( );
}
</pre>
<br />
We do not want to replace the class attribute with the style attribute.<br />
What we want to achieve, using an embedded report, is to use the same CSS classes used by the rest of the application, getting a consistent look without having to duplicate the CSS in the BIRT report.
JasonW
Sounds like that will work. Have you tried it?
Jason
Samuel Santos
No, we haven't.
We'll try it tomorrow and post our feedback here.
Samuel
Samuel Santos
Hello Jason,<br />
<br />
We have tried it and it works.<br />
You just need to move the line <span style='font-family: Lucida Console'>hasCsslinks = true;</span> outside the if condition:<br />
<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
if ( href != null )
{
boolean isEmbeddable = new HTMLRenderOption( renderOption ).getEmbeddable( );
+ hasCsslinks = true;
if ( !isEmbeddable )
{// output the CSS link if it is not is embeddable
- hasCsslinks = true;
writer.openTag( HTMLTags.TAG_LINK );
writer.attribute( HTMLTags.ATTR_REL,
"stylesheet" );
</pre>
<br />
Inside the patch, in attachment, we have also include two additional options:<br />
<br />
<ul class='bbc'><li>One to include or not the default style element that was always included whether it was an embedded report or not. By default it maintains the current behavior.</li><li>Another to do a similar approach but for the fix redirect script tag that was also included by default in all reports.</li></ul>
<br />
We'll also be adding this patch in the Bugzilla issue we created at <a class='bbc_url' href='
https://bugs.eclipse.org/bugs/show_bug.cgi?id=353895'>https://bugs.eclipse.org/bugs/show_bug.cgi?id=353895</a>.<br
/>
<br />
Note: This patch is for BIRT 2.6.2.
JasonW
Very nice. Thanks for adding it to the bug.
Jason
Samuel Santos
Jason, do you think this fix can be shipped in the next BIRT release?
Samuel
JasonW
I believe the dev team is looking at it. Hopefully it will get in 3.7.2.
Jason
Samuel Santos
<blockquote class='ipsBlockquote' data-author="'JasonW'" data-cid="83728" data-time="1317752225" data-date="04 October 2011 - 11:17 AM"><p>
I believe the dev team is looking at it. Hopefully it will get in 3.7.2.<br />
Jason<br /></p></blockquote>
<br />
Hi Jason,<br />
<br />
It seems that the fix for "hasCsslinks = true;" has been included in BIRT (<a class='bbc_url' href='
https://bugs.eclipse.org/bugs/show_bug.cgi?id=353895'>https://bugs.eclipse.org/bugs/show_bug.cgi?id=353895</a>).<br
/>
However, we may still need your help to add the other fixes available in the patch we have submitted into BIRT.<br />
<br />
Samuel
Samuel Santos
[Sorry, duplicated post.]