Label Text Formatting in Vaadin (word-wrap, line break)


I am trying to display a long description text in Vaadin window using a Label component. The problem is that, the text format in the interface is a single line, or a none structured text with paragraph, even though the original text in the database is structured.

public Component buildDescription(){
CssLayout descriptionLayout = new CssLayout();
descriptionLayout.addComponent(new Label(“


”, ContentMode.HTML));
descriptionLayout.addComponent(new Label(singlePatent.getDescription(), ContentMode.PREFORMATTED));
return descriptionLayout;


[/code]I have tried to use all the content modes, with no success, ContentMode.HTML, TEXT

In the css I have tried

/*word-break: break-word;*/ /*word-wrap: break-word;*/ with no success.
I have attached some text that I used for testing.

Please help me how to achieve the proper text formating in Vaadin.

18407.txt (17.1 KB)
18408.txt (32.1 KB)

You should try
white-space: normal;
in css which automatically wraps the text .

Before that the width of the label should be defined like
Otherwise it doesnt know when to wrap

Thanks for the reply,
I tried the suggestion, but still gets the same results. Refer to the current attachment, as shows that the text is in correct format when seen from Firebug window, but shows concatnated from the Vaadin Label on the interface.

Any ideas please.