| Summary: | CSS classes are not outputted to the HTML | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Emílio Simões <emilio.simoes> |
| Component: | BIRT | Assignee: | Birt-ReportEngine-inbox <Birt-ReportEngine-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | Liwen Chen <lchen> |
| Severity: | normal | ||
| Priority: | P3 | CC: | bluesoldier, jianchao.li, jouyang, samaxes |
| Version: | 3.7.0 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows Vista | ||
| Whiteboard: | |||
| Attachments: | |||
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.
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.
Do you expect class name outputted for report items( labels in your case) but css links not outputted? (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. 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? This topic is also being discussed at http://www.birt-exchange.org/org/forum/index.php/topic/23368-does-anyone-has-this-problem/ 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.
Note: This patch is for BIRT 2.6.2. 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. Will you include the other fixes in the patch besides the line "hasCsslinks = true;"? No. We just use the patch line that output the style names for external css. 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. OK. Thanks for your work. Hi Jianchao, I created the issue 360640 for the other fixes on the patch. Thanks, Samuel |
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.