Jump to content

Referencing .CSS file as a parameter value


openxadmin

Recommended Posts

Hi All,

I need to use CSS file of our application for reports (for headers and footers in the report, to be precise).

Using :


 

 

 

Code:
JRHtmlExporter exporter = new JRHtmlExporter();        exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);        exporter.setParameter(JRExporterParameter.OUTPUT_WRITER, resp.getWriter());        exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imagesMap);        exporter.setParameter(JRHtmlExporterParameter.HTML_HEADER, HTML_HEADER);
Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Teodor,

 

Apologies for the incomplete query! I'm under the gun - I searched topics w.r.t to my requirement related to CSS in the forum but in vain!!

 

Well, in the above code: exporter.setParameter(JRHtmlExporterParameter.HTML_HEADER, HTML_HEADER);

 

1) I passed the resource path of my .css file that I want to be used in my report's header as a value for HTML_HEADER:

exporter.setParameter(JRHtmlExporterParameter.HTML_HEADER, "context.getPath("/css/stylesheet.css")"). But, no effect of .css is seen in my generated report???

 

What's the correct way of referencing .CSS file in java code and hence, have that reflect in my generated report?

 

When I passed pure text, header part of my report is using that. But, not otherwise.

 

2) What all/types of values can take? Could you please give some examples?

 

3) How do I actually use elements like, say, HEADER & FOOTER styles of my host application's CSS file in all my reports (40 of them) using my above code?

 

4) Could you please point me to some code used to incorporate .CSS file for all my reports?

 

Thanks in advance.

 

-Sanjeev

 

 

Link to comment
Share on other sites

Teodor,

My previous post looks scary and is difficult to make out the query from. So, here's the same content in easily readable form...

Apologies for the incomplete query!

I'm under the gun - I searched topics w.r.t to my requirement related to CSS in the forum but in vain!!

Well, in the above code:

exporter.setParameter(JRHtmlExporterParameter.HTML_HEADER, HTML_HEADER);

1)  I passed the resource path of my .css file that I want to be used in my report's header as a value for HTML_HEADER: exporter.setParameter(JRHtmlExporterParameter.HTML_HEADER, "context.getPath("/css/stylesheet.css")"). But, no effect of .css is seen in my generated report???

When I passed pure text, header part of my report is using that. But, not otherwise.

What's the correct way of referencing .CSS file in java code and hence, have that reflect in my generated report?

2)  What all/types of values can take? Could you please give some examples?

3)  How do I actually use elements like, say, HEADER & FOOTER styles of my host application's CSS file in all my reports (40 of them) using my above code?

4)  Could you please point me to some code used to incorporate .CSS file for all my reports?

Thanks in advance.

-Sanjeev

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...