Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Wrap text in a cell(Wrap text in a cell)
Wrap text in a cell [message #736212] Thu, 13 October 2011 20:11 Go to next message
Amitava  is currently offline Amitava Friend
Messages: 15
Registered: September 2011
Junior Member
I have a report layout which contains a whole bunch of columns some of which might contain big data. As a result I need wrap text feature inside a cell but there is none in BIRT that I can find. I find BIRT is actually truncating the cell data.
Re: Wrap text in a cell [message #736222 is a reply to message #736212] Thu, 13 October 2011 20:37 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Can you try using a dynamic text element instead of a data item?

Jason

On 10/13/2011 4:11 PM, Amitava wrote:
> I have a report layout which contains a whole bunch of columns some of
> which might contain big data. As a result I need wrap text feature
> inside a cell but there is none in BIRT that I can find. I find BIRT is
> actually truncating the cell data.
Re: Wrap text in a cell [message #737135 is a reply to message #736222] Fri, 14 October 2011 17:48 Go to previous messageGo to next message
Amitava  is currently offline Amitava Friend
Messages: 15
Registered: September 2011
Junior Member
No change; it is truncating both.
Re: Wrap text in a cell [message #737145 is a reply to message #737135] Fri, 14 October 2011 18:01 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Any way you can write a report that uses the sample db or a scripted
data set that shows the issue, that I can run?

Jason

On 10/14/2011 1:48 PM, Amitava wrote:
> No change; it is truncating both.
Re: Wrap text in a cell [message #739502 is a reply to message #737145] Mon, 17 October 2011 14:44 Go to previous messageGo to next message
Amitava  is currently offline Amitava Friend
Messages: 15
Registered: September 2011
Junior Member
Please find attached the report file containing the columbs which may contain big data. The report uses Oracle 10g DB and sql to get the data. I'm not sure what do you want to re-create the scenario.Do you want the table desc also.
Re: Wrap text in a cell [message #739635 is a reply to message #739502] Mon, 17 October 2011 17:22 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Which columns?

Jason

On 10/17/2011 10:44 AM, Amitava wrote:
> Please find attached the report file containing the columbs which may contain big data. The report uses Oracle 10g DB and sql to get the data. I'm not sure what do you want to re-create the scenario.Do you want the table desc also.
Re: Wrap text in a cell [message #739684 is a reply to message #739635] Mon, 17 October 2011 18:42 Go to previous messageGo to next message
Amitava  is currently offline Amitava Friend
Messages: 15
Registered: September 2011
Junior Member
Sender Reference Number
Debit Business Unit Name
Credit Business Unit Name
Re: Wrap text in a cell [message #739723 is a reply to message #739684] Mon, 17 October 2011 19:40 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

None of those are dynamic text elements.

Jason

On 10/17/2011 2:42 PM, Amitava wrote:
> Sender Reference Number
> Debit Business Unit Name
> Credit Business Unit Name
Re: Wrap text in a cell [message #739739 is a reply to message #739723] Mon, 17 October 2011 20:06 Go to previous messageGo to next message
Amitava  is currently offline Amitava Friend
Messages: 15
Registered: September 2011
Junior Member
I mentioned earlier that changing them to dynamic text does not solve the issue of truncating really long text.
Re: Wrap text in a cell [message #739784 is a reply to message #739739] Mon, 17 October 2011 21:21 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Is there spaces in the text?

Jason

On 10/17/2011 4:06 PM, Amitava wrote:
> I mentioned earlier that changing them to dynamic text does not solve
> the issue of truncating really long text.
Re: Wrap text in a cell [message #740464 is a reply to message #739784] Tue, 18 October 2011 14:40 Go to previous messageGo to next message
Amitava  is currently offline Amitava Friend
Messages: 15
Registered: September 2011
Junior Member
No; they are mostly system generated long reference numbers, names etc.
Re: Wrap text in a cell [message #740650 is a reply to message #740464] Tue, 18 October 2011 18:46 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Take a look at this thread:
http://www.birt-exchange.org/org/forum/index.php/topic/19827-how-do-i-use-word-wrap-in-report-design/page__s__173b4ad992e47395e2c8b9070c2d3cce

Jason

On 10/18/2011 10:40 AM, Amitava wrote:
> No; they are mostly system generated long reference numbers, names etc.
Re: Wrap text in a cell [message #740689 is a reply to message #740650] Tue, 18 October 2011 19:40 Go to previous messageGo to next message
Amitava  is currently offline Amitava Friend
Messages: 15
Registered: September 2011
Junior Member
Thanks Jason. I found the wrap() function inside the thread you recommended. That solved the wrap issue.
Re: Wrap text in a cell [message #900633 is a reply to message #740689] Tue, 07 August 2012 21:17 Go to previous messageGo to next message
Manikandan Krishnan is currently offline Manikandan KrishnanFriend
Messages: 2
Registered: August 2012
Junior Member
No need to write wrap() function. We have the properties available in Birt design template for wrapping the text.

1. Once you placed the dataset column element inside table / grid / cell. Select the dataset column element from table / grid and go to properties.
2. Under General pane in properties window, make sure it displays "Properties - Data" on that top. This is to make sure you are in dataset element properties.
3. Update "Whitespace" properties as "Auto". It will be there in General pane.
2. DO NOT go to table / grid properties.

Please refer the attachment.

Note: I have faced the same issue, "wrap text is not working in my excel". After 1 week, i found this option. Now word wrap is working fine.

Thanks,
Mani
  • Attachment: Birt.jpg
    (Size: 83.29KB, Downloaded 2581 times)
Re: Wrap text in a cell [message #938683 is a reply to message #900633] Wed, 10 October 2012 04:12 Go to previous messageGo to next message
Jeff Stouse is currently offline Jeff StouseFriend
Messages: 28
Registered: May 2012
Junior Member
Using BIRT Indigo 3.7.2

I have a table where I have dragged a data item from the Data Set list into a cell. The cell's properties (Whitespace) is set to Auto. Text will not wrap until I set the line height tall enough for the text (usually 3-4 lines deep, with each line having 3-4 words - column width is about 2")

I've tried placing the data as data and dynamic text -being sure to set the whitespace option to Auto, and the line height option (Advanced/Text) to Auto.

None of the above scenarios work, so I'm forced to have a lot of wasted whitepace in my report, especially when the data is only one word. Looks pretty bad.

I thought BIRT should do this (automatically increase the line height to accommodate the necessary number of lines when the wrap function dictates.) In my case, the wrap function works until the allocated line height is enough. If the line height is not enough to see all of the data, then whatever the line can display is the limit - all following data gets truncated.

Help!
Re: Wrap text in a cell [message #939196 is a reply to message #938683] Wed, 10 October 2012 14:14 Go to previous messageGo to next message
Manikandan Krishnan is currently offline Manikandan KrishnanFriend
Messages: 2
Registered: August 2012
Junior Member
I understand your issue. You have 2 options.

Option 1: If you are using scripts in birt design template, you can process row data within scripts using the below example:

Example:
Script on row.onCreate:
if (this.getRowData().getExpressionValue("row[QtyOrdered]") > 30){
this.getStyle().fontFamily = "Arial"
this.getStyle().backgroundColor = "Yellow"
}

Note: This is just an example, please find out the properties for row height and increase the size if the data size is big.

Option 2: If you are using Java, please following the below step


RowEventAdapter in Java:

Example:
public class RowEH extends RowEventAdapter {
public void onCreate(IRowInstance row, IReportContext context) {
IRowData data = row.getRowData();
double avgCreditLimit = ((Double) row.getParent().getNamedExpressionValue("total_limit_avg")).doubleValue();
try
{
if (((Double) data.getExpressionValue("row[\"CREDITLIMIT\"]")).doubleValue() > avgCreditLimit ) {
row.getStyle( ).setFontWeight( "bolder" );
row.getStyle( ).setFontSize( "larger" );
row.getStyle( ).setColor( "olive" );
}
} catch (Exception e) {
e.printStackTrace();
}
}

}

Note: The above code is just an example. You have to find out the properties for increasing the ROW height using IRowInstance instance.
Check the length of the DATA, if it has more words, increase the row height using ROW instance.

Adding the event handler to the Report
You should add event handler by selecting the row and entering my.test.events.RowEH in the Event Handler entry on the Properties tab

REFER the below link for more examples on Event Handlers:
http://www.eclipse.org/birt/phoenix/deploy/reportScripting.php

Thanks,
Mani
Re: Wrap text in a cell [message #958789 is a reply to message #938683] Fri, 26 October 2012 08:04 Go to previous messageGo to next message
Anna T. is currently offline Anna T.Friend
Messages: 4
Registered: June 2012
Junior Member
Hi Jeff,

I am trying to set the line height option as you mentioned to Auto, but when I select a table row and go to Properties > Advanced > Text > Line Height I am only allowed to specify a measure. How can I specify that I want the height to be Auto?
Re: Wrap text in a cell [message #959101 is a reply to message #958789] Fri, 26 October 2012 13:01 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Anna

What are you trying to accomplish? If you want the row height to be auto clear the value and do not set it to anything.

Jason
Re: Wrap text in a cell [message #959143 is a reply to message #959101] Fri, 26 October 2012 13:42 Go to previous messageGo to next message
Anna T. is currently offline Anna T.Friend
Messages: 4
Registered: June 2012
Junior Member
Well actually I have an issue when exporting my report to xls.

I have a table that has many columns. The text in the columns is quite big so it has to wrap in order to see everything.
The HTML, PDF and RTF exports look ok but in the excel export the row height is too small to accomodate the text so part of the text is not visible.

I thought maybe there is a property that I am not aware of.
Re: Wrap text in a cell [message #986328 is a reply to message #939196] Tue, 20 November 2012 02:32 Go to previous messageGo to next message
Jeff Stouse is currently offline Jeff StouseFriend
Messages: 28
Registered: May 2012
Junior Member
Mani,

You are talking to a complete rookie when it comes to scripting.

First of all, I cannot believe that BIRT FAILS to offer this functionality without resorting to writing an event handler. Why hasn't someone written a generic option that is a property for each cell in a table/grid?
As evidenced by the searches I spent hours going through, I am not the only one needing this functionality...

OK, so I have to write an event handler. Thanks for pointing me in that direction. I am reading the material that you linked to, but I have not a clue on how to calculate the need to increase the row height based on the amount of text left to display (I cannot figure out how to calculate that.) If I'm going to take the time to attempt this (no sleep tonight, or tomorrow, or the next night...) then shouldn't the plan be to create a script that looks at the size of the value to be displayed and then calculates how many rows (height of a standard row) it will need to display that amount of text, given the width of the cell?

Sign me,

Not a scripter (yet, apparently)

Thanks for your suggestions.
Re: Wrap text in a cell [message #986563 is a reply to message #986328] Tue, 20 November 2012 23:28 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Jeff,

Are you certain you don't have a height set on the actual grid or detail row that you're putting your text element into? It sounds to me that a value is set. If it is, BIRT will not expand or minimize that row to fit your data. Let me know.


Michael

Developer Evangelist, Silanis
Re: Wrap text in a cell [message #1385114 is a reply to message #986563] Wed, 04 June 2014 12:28 Go to previous message
Michelle C. is currently offline Michelle C.Friend
Messages: 8
Registered: June 2014
Location: Switzerland
Junior Member
Hello Amitava

How did you get the wrap() function to work? Where do I have to insert the script? Does this work also for crosstab?

Thank you for helping.
Michelle


Best regards
Michelle


Open Source BIRT V4.4.0
Elicpse Luna
Oracle
Previous Topic:create a report with 3 pages
Next Topic:hiding cross-tab level
Goto Forum:
  


Current Time: Thu Mar 28 15:44:54 GMT 2024

Powered by FUDForum. Page generated in 0.04996 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top