Skip to Content
0
Former Member
Feb 21, 2014 at 10:09 AM

Use css to style report

204 Views

I don't get stylesheets to work with crystal reports for eclipse, 12.2.216.

I set the css class to "message" for a field in the report designer.

Then I added the css class to crystalreportviewers/js/crviewer/images/style.css:

.message {

color: red;

}

In the java code I added this line:

viewer.setStyleSheetFileName("style.css");

When displayed in the html viewer (or report part viewer), the css rules for this class are not applied.

When viewing the html response, I can see that the style.css gets included, but I don't see that a message class is set anywhere in the document.

This is the html part for the field where I have set the css class:

<div class="ad1392976915244-0" style="top:74px;left:340px;width:66px;height:15px;white-space:nowrap;">

<div align="left" style="position:relative;">

<span class="fc1392976915243-1">Hallo</span>

</div>

</div>

The classes that are applied are contained in the response directly (not in style.css):

<style type="text/css" id="bobjid_1392976915343_stylesheet">

div.crystalstyle div {position:absolute; z-index:25}

div.crystalstyle a {text-decoration:none}

div.crystalstyle a img {border-style:none; border-width:0}

.fc1392976915243-0 {font-size:10pt;color:#000000;font-family:Arial;font-weight:normal;text-decoration:underline;}

.fc1392976915243-1 {font-size:10pt;color:#000000;font-family:Arial;font-weight:normal;}

.ad1392976915244-0 {border-color:#000000;border-left-width:0;border-right-width:0;border-top-width:0;border-bottom-width:0;}

</style>

These classes are computed by the crystal reports engine considering only the format defined in the crystal report designer.

So my question is: How can I activate (or use) a stylesheet?

Added tag "crystal_reports_for_eclipse"