Jump to content
We've recently updated our Privacy Statement, available here ×

Field into static text


augarte

Recommended Posts

Hi everyone!

 

I want to link the values of some fields with static text. What I want to do is something similar to the following:

 

"Static text before the field " + F{FieldName} + "static text after the field"

 

I have tried it but without success. Did anybody have the same problem? Any solution please?

 

Thanks in advance,

 

Kind regards.

Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I was able to do it! I createf a new Text Field and insert this:

"This is one variable: " + $F{grp} + ". This is another one "+ $F{MtmRv} + ". An the last one : "  + $F{MtmRa}+ " to check how it works depending on the length of each variable"

grp, MtmRm and MtmRa are Fields that I have generated from my datasource.

Now I have another issue, I want the fields (grp, MtmRm, and MtmRa) to be "bold". Does anybody know how to set the fields as bold (only  the values of the fields, not all the text)

Thanks in advance!

Kind regards,

Aitor

Link to comment
Share on other sites

You can set the markup of the text field to HTML so you could put a strong tag around the locations.

Code:
"This is one variable: <strong>" + $F{grp} + "</strong>. This is another one <strong>"+ $F{MtmRv} + "</strong>. An the last one : <strong>"  + $F{MtmRa}+ "</strong> to check how it works depending on the length of each variable"
Link to comment
Share on other sites

Thanks for the reply dnewson. I have tried as you said but it is not working. What I see in my report is the following:

 

"This is one variable: <strong>"value of $F{grp}"</strong>. This is another one <strong>"value of$F{MtmRv}"</strong> And the last one : <strong>"value of $F{MtmRa}"</strong> to check how it works depending on the length of each variableI don't know if it is possible to mix formatting information and data in a textfield.

Link to comment
Share on other sites

Thanks rushit, but it seems I'm missing something. I've set the markup to html but the fields are not displayed as bold. It seems it undestands the "<strong>" tag but it is not applied. ¿Do I have to use any special encoding? ¿Does the font type have any effect on it?

Thanks.

Kind regards,

Aitor

Link to comment
Share on other sites

Finally I could solve it. I used <b> instead of <strong> and now the JasperPrint is visualized as I want.

But still have another problem: when exporting to pdf, the styles are lost. I know I can use a "Pdf Font Name" to set it as bold, but it is be applied to the entire textfield and not only to the values of the fields. I'm afraid there is no chance to achieve what I want. Thanks anyway to dnewson and rushit!!!

Kind regards,

Aitor

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...