Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353895 - CSS classes are not outputted to the HTML
Summary: CSS classes are not outputted to the HTML
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: BIRT (show other bugs)
Version: 3.7.0   Edit
Hardware: PC Windows Vista
: P3 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Birt-ReportEngine-inbox@eclipse.org CLA
QA Contact: Liwen Chen CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-04 10:32 EDT by Emílio Simões CLA
Modified: 2011-10-12 06:44 EDT (History)
4 users (show)

See Also:


Attachments
Screenshot of the output HTML with setEmbeddable setted to true and false (81.61 KB, image/jpeg)
2011-08-04 10:32 EDT, Emílio Simões CLA
no flags Details
reports and results (2.54 KB, application/x-zip-compressed)
2011-08-05 05:10 EDT, Jun Ouyang CLA
no flags Details
Report example that reproduces the problem (4.39 KB, application/zip)
2011-08-05 05:33 EDT, Emílio Simões CLA
no flags Details
Fix CSS class attributes in embedded reports (5.27 KB, patch)
2011-09-29 08:00 EDT, Samuel Santos CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Emílio Simões CLA 2011-08-04 10:32:20 EDT
Created attachment 200919 [details]
Screenshot of the output HTML with setEmbeddable setted to true and false

When using the "Use CSS File.." options from the report designer and checking the "Include CSS file at view time" check box the CSS classes from the external stylesheet are not outputted to the HTML by the report engine API if the HTMLRenderOption.setEmbeddable is setted to true.

In more detail, is the HTMLRenderOption is configure like this:

HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFormat(IHTMLRenderOption.OUTPUT_FORMAT_HTML);
options.setOutputStream(output);
options.setEmbeddable(false);

All is fine and the HTML contains all the defined classes as shown in the attached screenshot, but if the options are changed to this:

HTMLRenderOption options = new HTMLRenderOption();
options.setOutputFormat(IHTMLRenderOption.OUTPUT_FORMAT_HTML);
options.setOutputStream(output);
options.setEmbeddable(true);

The CSS classes from the external file disappear from the output as shown in the attached screenshot.
Comment 1 Jun Ouyang CLA 2011-08-05 05:10:35 EDT
Created attachment 200961 [details]
reports and results

I can't reproduce the bug using attached report.

The label in the report uses a css style from external file css/ATSStyles.css, report engine generates a corresponding style "style_2" and apply it to the label whether in non-embeddable and embeddable mode. See attached html files.
Comment 2 Emílio Simões CLA 2011-08-05 05:33:09 EDT
Created attachment 200962 [details]
Report example that reproduces the problem

The problem I'm reporting has a difference with your example. I'm not referring to the CSS classes generated by BIRT, I'm referring to the CSS class names that are present in the external CSS stylesheet. If you look at the attached report example I'm including in the XML view you will find this:

<list-property name="cssStyleSheets">
    <structure>
        <property name="fileName">WebContent/styles/custom.css</property>
        <property name="externalCssURI">BirtTest/styles/custom.css</property>
    </structure>
</list-property>

as in your example you will find this:

<list-property name="cssStyleSheets">
    <structure>
        <property name="fileName">css/ATSStyles.css</property>
    </structure>
</list-property>

The difference comes when you check the "Include CSS file at view time" checkbox, in this case BIRT uses the external class names and doesn't generate classes in the HTML has you can see in the attached example.

Take a look at the table header in the result HTML files.
Comment 3 Jun Ouyang CLA 2011-08-10 23:24:10 EDT
Do you expect class name outputted for report items( labels in your case) but
css links not outputted?
Comment 4 Emílio Simões CLA 2011-08-11 05:47:51 EDT
(In reply to comment #3)
> Do you expect class name outputted for report items( labels in your case) but
> css links not outputted?

Well, yes. If the outputted code is supposed to be embedded I believe this means that is supposed to integrate with the page where is going top be embedded. I think it makes sense for the class names to be outputted because the CSS links already exist in the header of the container page where the outputted HTML is going to be embedded.
Comment 5 Samuel Santos CLA 2011-08-30 11:46:46 EDT
I'm having the same issue here.

If I set the embeddable flag to true I can't use my application CSS classes.

Wasn't it the purpose of the embeddable flag to seamlessly embed a report in an existing application page?
Comment 6 Samuel Santos CLA 2011-09-27 11:25:22 EDT
This topic is also being discussed at http://www.birt-exchange.org/org/forum/index.php/topic/23368-does-anyone-has-this-problem/
Comment 7 Samuel Santos CLA 2011-09-29 08:00:36 EDT
Created attachment 204284 [details]
Fix CSS class attributes in embedded reports

The patch fix the following issues:

- Include CSS class attributes also in embedded reports;
- An option 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.
- A similar option to the previous one, but for the fix redirect script tag that was also included by default in all reports. By default it maintains the current behavior.
Comment 8 Samuel Santos CLA 2011-09-29 08:02:32 EDT
Note: This patch is for BIRT 2.6.2.
Comment 9 Jianchao Li CLA 2011-10-09 22:48:19 EDT
For embeddable mode, the correct logic should be:
   1. don't output css links;
   2. output css class for report items using style from external css files.
   3. external viewer should output the external css links.

This issue has been fixed in BIRT 2.6.3 branch.
Comment 10 Samuel Santos CLA 2011-10-10 07:56:18 EDT
Will you include the other fixes in the patch besides the line "hasCsslinks = true;"?
Comment 11 Jianchao Li CLA 2011-10-10 21:39:56 EDT
No. We just use the patch line that output the style names for external css.
Comment 12 Samuel Santos CLA 2011-10-10 21:48:52 EDT
Hi Jianchao,

Should I fill a separate issue for the other fixes proposed in the patch?

Thanks,
Samuel

(In reply to comment #11)
> No. We just use the patch line that output the style names for external css.
Comment 13 Jianchao Li CLA 2011-10-10 21:54:45 EDT
OK. Thanks for your work.
Comment 14 Samuel Santos CLA 2011-10-12 06:44:44 EDT
Hi Jianchao,

I created the issue 360640 for the other fixes on the patch.

Thanks,
Samuel