buiquyduc Posted November 23, 2010 Share Posted November 23, 2010 Hi all,Does any one know how to create a combination of text and data fields to a report like below:..........The first parameterized is %1 and the second is %2..........Where %1 and %2 are merged fields that will be filled by data get from database. Thanks in adavance.Duc Bui Post Edited by buiquyduc at 11/23/2010 02:33 Link to comment Share on other sites More sharing options...
rajendratambat Posted November 23, 2010 Share Posted November 23, 2010 please elaborate more... Link to comment Share on other sites More sharing options...
buiquyduc Posted November 23, 2010 Author Share Posted November 23, 2010 I have two field1 and field2 and they hold data from database, for example their values are {"123", "sample"}. What I want is like below: ...........The first parameterized is 123 and the second is sample............ Bui Quy Duc Link to comment Share on other sites More sharing options...
rajendratambat Posted November 23, 2010 Share Posted November 23, 2010 do you mean that you have a static text in your detail band?if so it is very simpleadd static text field and text fields combined together check following code...I hope I am getting you in right direction. if not please share your jrxml and more detailsCode: <textField> <reportElement x="147" y="0" width="69" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{field1}]]></textFieldExpression> </textField> <staticText> <reportElement x="16" y="0" width="131" height="20"/> <textElement/> <text><![CDATA[The first parameterized is ]]></text> </staticText> <textField> <reportElement x="306" y="0" width="100" height="20"/> <textElement/> <textFieldExpression class="java.lang.String"><![CDATA[$F{field2}]]></textFieldExpression> </textField> <staticText> <reportElement x="216" y="0" width="100" height="20"/> <textElement/> <text><![CDATA[and the second is ]]></text> </staticText> Link to comment Share on other sites More sharing options...
buiquyduc Posted November 23, 2010 Author Share Posted November 23, 2010 Hi Rajendra Tambat, Thank you for your replies. Sorry for my very short description the issue. Actualy, my issue is have a text paragraph and somewhere in that paragraph, I need to fill data to that, for example, I have the sample letter below: Dear All,I’ve always believed that "Destiny is only by choice and not by chance" and I am glad that I chose to join %1. If I hadn’t I would’ve missed meeting so many wonderful people, building on both personal and professional relationships and getting once in a lifetime experience.The day has come when I have to say goodbye to a place which became my second home away from home. This eventful and joyous journey in company started on %2.The heaven called %3 where I had the best days of my life with some of the most wonderful people of %4 batch. My heartiest thank you to my friends whom I spent most of my time with be it arguing on some topic to pulling each other’s leg .. .......Where %1,%2,%3,%4 are places that I need to fill from fields get from database. I assumed have fields and values field1 = ABCfield2 = 22/12/2009field3 = Johnfield4 = DevelopmentThen the letter will be like: Dear All,I’ve always believed that "Destiny is only by choice and not by chance" and I am glad that I chose to join ABC. If I hadn’t I would’ve missed meeting so many wonderful people, building on both personal and professional relationships and getting once in a lifetime experience.The day has come when I have to say goodbye to a place which became my second home away from home. This eventful and joyous journey in company started on 22/12/2009.The heaven called John where I had the best days of my life with some of the most wonderful people of Development batch. My heartiest thank you to my friends whom I spent most of my time with be it arguing on some topic to pulling each other’s leg .. .......Thanks in advanceDuc BuiPost Edited by buiquyduc at 11/23/2010 08:08 Link to comment Share on other sites More sharing options...
rajendratambat Posted November 23, 2010 Share Posted November 23, 2010 Good,Still to achieive the same effect you can use textfield to draw a onle line of paragraph or a whole paragraph itselfand in expression of it you can simply use $F{Field1} which will automatically get replaced. try below code in your text field expression replace values of field1 and filed2 appropriatelyCode:"The heaven called "+$F{Field1} +" where I had the best days of my life with some of the most wonderful people of " + $F{Field2} +" batch. My heartiest thank you to my friends whom I spent most of my time with be it arguing on some topic to pulling each other’s leg " Link to comment Share on other sites More sharing options...
buiquyduc Posted November 23, 2010 Author Share Posted November 23, 2010 Hi Rajendra Tamba, Thank you very much about your replies. One more question related to this topic.In case of content is styled from RTF file, how do I fill values ? The content like below: Dear All,I’ve always believed that "Destiny is only by choice and not by chance" and I am glad that I chose to join ABC. If I hadn’t I would’ve missed meeting so many wonderful people, building on both personal and professional relationships and getting once in a lifetime experience.The day has come when I have to say goodbye to a place which became my second home away from home. This eventful and joyous journey in company started on 22/12/2009.The heaven called John where I had the best days of my life with some of the most wonderful people of Development batch. My heartiest thank you to my friends whom I spent most of my time with be it arguing on some topic to pulling each other’s leg .. Thanks,Bui Quy DucPost Edited by buiquyduc at 01/24/2011 04:06 Link to comment Share on other sites More sharing options...
rajendratambat Posted January 24, 2011 Share Posted January 24, 2011 there is a property called markup you set it as "RTF" it will treat your data as rtf and will try to apply same. Rajendra Tambat 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