rajesh Posted August 17, 2006 Share Posted August 17, 2006 Hi,I am using Ireport1.2.0.I want to change backcolor of my textfield dynamically at runtime.Please do some favour for me its urgent.thanx in advance:huh: :huh: Link to comment Share on other sites More sharing options...
smith Posted August 17, 2006 Share Posted August 17, 2006 hi, Selecting the textfield,rightclicking, u will get list, select properties and in that select common tab, which consists background option,u can select ur choice color and can apply.rgds,anu. Link to comment Share on other sites More sharing options...
smith Posted August 17, 2006 Share Posted August 17, 2006 hi, Selecting the textfield,rightclicking, u will get list, select properties and in that select common tab, which consists background option,u can select ur choice color and can apply.rgds,anu. Link to comment Share on other sites More sharing options...
JulEgner Posted August 18, 2006 Share Posted August 18, 2006 I think that rajesh thought of setting the background color at runtime.I have an idea for this: take 2 fields, one for each background color, and let the two field be displayed in change by setting the "display when expression" in a way that it is true every second time. Link to comment Share on other sites More sharing options...
rajesh Posted August 18, 2006 Author Share Posted August 18, 2006 thanx a lot my problem has been solved by using "print when expression".. Link to comment Share on other sites More sharing options...
rlacatus Posted August 25, 2006 Share Posted August 25, 2006 Hello all, The "printWhenExpression" is a good solution if you have 2 or 3 colors. What if I don't know my backcolor until runtime and it could be any color of the rainbow? Any solution for this problem? Many thanks, Remus EDIT: at runtime to until runtimePost edited by: rlacatus, at: 2006/08/25 14:30 Link to comment Share on other sites More sharing options...
Moniqa Posted September 1, 2006 Share Posted September 1, 2006 Hi, rajesh i have the same thing i need to do... can you tell me please how you succeeded with the printWhenExpression?It's kinda urgent, thanks a bunch. Monica Link to comment Share on other sites More sharing options...
darya Posted September 4, 2006 Share Posted September 4, 2006 rajesh wrote:thanx a lot my problem has been solved by using "print when expression".. It would be very nice when you share your wisdom here and show us how the "Print when expression" should look like ;) Regards,Darya Link to comment Share on other sites More sharing options...
Moniqa Posted September 4, 2006 Share Posted September 4, 2006 I've used 2 textfields on the same location with the same expression, each having its corresponding backcolor. Then, we have the variable in iReport called $VREPORT_COUNT} that is incremented at every record/line. So for the textfield with the backcolor that i want to display at the first line and then every 2nd alternation, i put in PrintWhenExpression:new Boolean($V{REPORT_COUNT}.intValue()%2==0) and for the textfield with the backcolor that i want to display at the 2nd line and then at every 2nd alternation, i put in PrintWhenExpression:new Boolean($V{REPORT_COUNT}.intValue()%2==1) Hope this helps for you. Monica Link to comment Share on other sites More sharing options...
darya Posted September 4, 2006 Share Posted September 4, 2006 Hi Monika, Thanks a lot for the tip. Can you tell me what iReport version you use? I use iReport-1.1.0 and there is no way to set the backcolor :unsure: . Regards,Darya Link to comment Share on other sites More sharing options...
darya Posted September 4, 2006 Share Posted September 4, 2006 Hi Monika, Thanks a lot for the tip. Can you tell me what iReport version you use? I use iReport-1.1.0 and there is no way to set the backcolor :unsure: . Regards,Darya Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted September 4, 2006 Share Posted September 4, 2006 The best solution is using a conditional stylesheet. Giulio Link to comment Share on other sites More sharing options...
darya Posted September 4, 2006 Share Posted September 4, 2006 What do you mean by conditional stylesheet :sick: . I could follow Monika. But I don't know how a conditional stylesheet works here. Isn't iReport creating the whole thing? Anyway Monika's way sounds good for me, I only have the problem that I don't know how to set the background color for my 2nd rectangle. At least not with iReport-1.1.0 :( Is it possible at all. Or do I have to add the background color by hand in iReports' created .jrxml file? I can't simply upgrade to iReports-1.2.5 because I depend on JasperReports jasperreports-1.1.1.jar JAR file and have no authority to change that :whistle: . Regards,Darya Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted September 4, 2006 Share Posted September 4, 2006 Simply pick a color for the background in the element properties window.Be sure the element is not set to be transparent. Giulio Link to comment Share on other sites More sharing options...
darya Posted September 4, 2006 Share Posted September 4, 2006 conditionalStyle sound more intelligent :woohoo: (sorry Monika ;) , I'll use your approach as fallback in case Giulio's apprach doesn't work for me.) Giulio, can you elaborate a little bit more what I need to do? Regards,Darya Link to comment Share on other sites More sharing options...
darya Posted September 4, 2006 Share Posted September 4, 2006 Giulio, you forgot that I stuck with iReport-1.1.0 What you say seems to work with the latest iReport-1.2.5 release and I am not sure whether I can use this latest release because I depend on jasperreports-1.1.1.jar. Anyway, I should give it a try first. Regards,Darya Link to comment Share on other sites More sharing options...
Giulio Toffoli Posted September 4, 2006 Share Posted September 4, 2006 I think you can use your reports with jr 1.2.5 without recompile your reports and/or your application. Anyway the steps are: 1. Be sure the background of your element is not set (if it is, you should see the background property displayed in bold in the element properties sheet: press the special button to reset this propety (it's the button with a lottle crown. 2. In the styles window, create a new style and set for this style the background property (this will be the default value for the background). 3. Drag and drop the style over your element 4. Back to the style, and add a condition in the conditions list. For each condition you can set a different value for the background property. Hope it's clear. Giulio Link to comment Share on other sites More sharing options...
darya Posted September 4, 2006 Share Posted September 4, 2006 Thanks Giulio, I'll give it a try and post my feedback later here. Regards,Darya Link to comment Share on other sites More sharing options...
rajesh Posted September 4, 2006 Author Share Posted September 4, 2006 new Boolean("OK".equalsIgnoreCase($P{execution}))use such type of expression in print when expression field. Link to comment Share on other sites More sharing options...
eco Posted November 28, 2006 Share Posted November 28, 2006 I want to change the background colour to show results of the search - for example, highlight all elements that contain the word "foobar". Is there something I can put into the conditional expression that applies to all fields? I mean, it is not very flexible to have something like Code:new Boolean($F{f1}.equals("foobar"«») for every field I have in the report. Plus, I want to include static field in the search too. If this is not possible, can I modify the style from Java of individual JRPrintElement contained in the JasperPrint object? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now