COGNOiSe.com - The IBM Cognos Community

IBM Cognos 10 Platform => Cognos 10 BI => Cognos Administration => Topic started by: blom0344 on 16 Mar 2011 05:42:08 AM

Title: Global Report Styles
Post by: blom0344 on 16 Mar 2011 05:42:08 AM
According to IBM changing the GlobalReportStyles.css should still be a way to work with additional .css classes. I have added our own set of classes to the 4 occurences of GlobalReportStyles.css, but they do not show up in Report Studio (which always worked for me in 8.x versions) Changing existing classes in the .css does not seem to have any impact either..

http://publib.boulder.ibm.com/infocenter/cfpm/v10r1m0/index.jsp?topic=/com.ibm.swg.im.cognos.ug_cra.10.1.0.doc/ug_cra_id34923style_sheet.html

What am I missing?
Title: Re: Global Report Styles
Post by: blom0344 on 17 Mar 2011 03:39:08 AM
Well, this was one was easy  :)  The documentation mentions GlobalReportStyles.css, but Cognos 10 RS opens up by default with 10.x styling.
To use new global classes in both  8.x / 10.x styling, then modify both GlobalReportStyles.css and GlobalReportStyles_10.css files. 
Title: Re: Global Report Styles
Post by: bdbits on 23 Mar 2011 09:42:40 AM
Just a thought, if you want to keep custom css separate, you can create a css file on a web server (could be your cognos server). Then add a simple HTML item to the top of the reports.

<link href="http://host.example.com/css/reports.css" type="text/css" rel="stylesheet" media="screen,print">

You need to change the example href, of course. In my experience this gets loaded as the last css file so you can put in CSS to override Cognos defaults from the myriad of default stylesheets.

Actually, I put the HTML item in a report that acts as a 'library' of components and use a layout reference so if I have to change it, there is just one spot to do it. But that is a little outside the scope of this topic. :)
Title: Re: Global Report Styles
Post by: Ryan Snead on 11 Jun 2012 10:28:55 AM
Quote from: bdbits on 23 Mar 2011 09:42:40 AM
Just a thought, if you want to keep custom css separate, you can create a css file on a web server (could be your cognos server). Then add a simple HTML item to the top of the reports.

<link href="http://host.example.com/css/reports.css" type="text/css" rel="stylesheet" media="screen,print">

You need to change the example href, of course. In my experience this gets loaded as the last css file so you can put in CSS to override Cognos defaults from the myriad of default stylesheets.

Actually, I put the HTML item in a report that acts as a 'library' of components and use a layout reference so if I have to change it, there is just one spot to do it. But that is a little outside the scope of this topic. :)

I tried this in Cognos 10.1.1 to modify some List header row background elements. It worked for HTML output, but not for PDF output.  ??? Does this have something to do with the link element not being rendered for the PDF?
Title: Re: Global Report Styles
Post by: sir_jeroen on 11 Jun 2012 01:46:14 PM
Ryan you're right.. It only gets rendered in HTML.
You could try this... (I haven't tried it, so share the result)
Add to each of the stylesheets (i believe 4 GlobalReportStyles.css and 4 GlobalReportStyles_10.css) the following:
@import url(your.css);
It's the same technique used by cognos for the skins (take a look at the file <c10 install>\webcontent\skins\contemporary\portal\default.css
Cognos uses the same technique...
Title: Re: Global Report Styles
Post by: Ryan Snead on 26 Jun 2012 08:53:46 AM
Yes. I can verify that this works for HTML and PDF.

I had some trouble getting the CSS overlay precedence to work correctly, so I ended up commenting out the styles I was replacing. Given our project timelines, I had to settle for the  good enough solution. However, I see no reason the precedences could not be resolved with a little more effort.

Good thread. Thanks all!

Quote from: ReportNet Addict on 11 Jun 2012 01:46:14 PM
Ryan you're right.. It only gets rendered in HTML.
You could try this... (I haven't tried it, so share the result)
Add to each of the stylesheets (i believe 4 GlobalReportStyles.css and 4 GlobalReportStyles_10.css) the following:
@import url(your.css);
It's the same technique used by cognos for the skins (take a look at the file <c10 install>\webcontent\skins\contemporary\portal\default.css
Cognos uses the same technique...
Title: Re: Global Report Styles
Post by: sir_jeroen on 26 Jun 2012 03:31:30 PM
Thanks for mentioning this...