PDA

View Full Version : Multiline is not working properly



Anonymous
09-09-2002, 12:43 AM
Hi

first of all let me tell u that ur reporting tool is great and i am really enjoying using that but i encounter some problems please note that and try to give me solution.

1) I had made a report , it all way ok but there is a problem regarding multiline . i.e in <item> tag i had added the fields to be displayed , its simply a listing report. but now there is a product description field which is to long so i had increased the size of height in item tag to 30 from 10 , so it will go till 3 lines down , but now the problem i am facing is it leaves 3 lines space for all the rows of detail section. i.e item tag. what i want is not a single line should be wasted in a report , if description of particular product is too long it should wrap to next line and new row should be started from the next line itself. So please give me any solution , i had wasted 1 full day for this. i will be a greatfull to u


2) In my preview of report it shows me linewraped to next line but when i print it , it shows in the same line.

Thanks
Gaurav

Anonymous
09-09-2002, 09:13 AM
Hi,

Element heights are static in the current version, there exist a patch for text element heights to be dynamic, but this patch will cause the page-break algorithm to work incorrect.

For your second problem I'll need the version number you are working with.
The printing should work perfectly, maybe you can give the element tag you use in the definition?

Have more fun,
said Thomas

Anonymous
09-09-2002, 09:34 AM
Hi

I read in may of ur replies that multiline problem is solved by using Text Element by setting the dynamic properyty to " True" but i dont know why it didnt work .

More over there is Multiline-field tag which is not reacting in the way it should , i mean i didnt notice any difference in Multiline and String field.
as even string field when increaded the width it performs just like multiline.
I had read in ur replies that text elements is working properly but i didnt found the tag (used in XML file) for Text Element , can u please me how to specify text element tag in xml file.

I will be really gratefull if u provide me the perfect solution for this Multiline problem.

Please i again repeat the problem i am facing

1) Multiline is cooming in the report but unnecessary space are inserted (
Row are left blank) when description is not so long.

I can try later with printing issue but currently for me this is a hot problem,if this is not solved i have to go for java reports .

Anonymous
09-10-2002, 03:37 AM
In the current version, the "multiline-field" take the same effect as "string-field", I looked insight the source code and find the reasons. We can modify the code to solve the multiline problem.

(1) Modify the createMultilineTextElement() method of ItemFactory like the following. I added a "isDynamic" interface to the method.

public static TextElement createMultilineTextElement(String name,
Rectangle2D bounds,
Paint paint,
int alignment,
Font font,
String nullString,
String field,
boolean isDynamic)
{
// modify by leonlyong
/*
return createStringElement(name, bounds, paint, alignment, font, nullstring, field);
*/

TextElement element = new TextElement();
element.setName(name);
element.setBounds(bounds);
element.setPaint(paint);
element.setAlignment(alignment);
element.setFont(font);
element.setNullString(nullString);
element.setDataSource(new DataRowDataSource(field));
element.setDynamic(isDynamic);
return element;
}

(2) Modify the endMultilineField() method of ElementFactory like the following. I set the default "isDynamic" as true. We can do this job more flexible by XML.

protected void endMultilineField()
throws SAXException
{
// modify by leonlyong
/*
TextElement te = ItemFactory.createStringElement(textElementName,
textElementBounds,
textElementColor,
textElementAlignment,
textElementFont,
textElementNullString,
textElementSourceName);
*/
TextElement te = ItemFactory.createMultilineTextElement(textElementName,
textElementBounds,
textElementColor,
textElementAlignment,
textElementFont,
textElementNullString,
textElementSourceName,
true);
getCurrentBand().addElement(te);
}


Thus we can print mutiline text adjusting the height of ItemBand dynamically. But there are still some problems with ElementVisibilitySwitchFunction which can not adjust the height.

Anonymous
09-10-2002, 11:52 AM
Hi,

the ElementVisibilitySwitchFunction is working fine, but the modified height during the printing causes some lines to be no printed anymore.

To have a working example of this effect, modify the String-field named "Name Element" in the ItemBand of Report2.xml to the width of 70 and to make your patch work, change the element declaration from "String-field" to "multiline-field". You will notice missing lines as soon as such a dynamic linebreak is done.

The ElementVisibilitySwitchFunction is a simple function, it does not care about the height at all, and in case of the MultiLine element, at least one line is always printed.

The reason for the multiline element is historical, this elements functionality is completly implemented in the TextElement. You cannot find a difference between Text- and MultiLine elements, as the TextElement is now what the MultiLine element was once before.

The whole LineBreak/ElementHeight/Layouting issue is my current task for JFreeReport, everything gets completly rewritten for the next version. As the Dynamic-Height patch would also need many changes on even more places in the code (code which will be removed during the next days) and the patch will useless when the Layout-Stuff is done, I will not supply an official patch for that...

Anyway, Have more fun,
said Thomas