Jump to content

Recommended Posts

Posted

Hello,

 

is it possible to make a wordwrap in uniDBGrid ?

 

I think, something like dynamical heigh of a row .. depending on the content of a cell ...

 

i have 2 fields ..

 

the first field is a Integer to identivie the right Image ... the image is drawn per:

 

procedure TUniMainModule.ZQuery3ID_PERSONGetText(Sender: TField;
  var Text: string; DisplayText: Boolean);
begin
...
DisplayText:=true;
text:=sender.AsString;
....
text:='<img width=16 height=16 src="'+uniservermodule.FilesFolderURL+'/'+image+'"/>';
end;

the second field is a String with different lenght ..

 

 

AND the Grid is very small .. so i prefere a dynamic wordwrap of every row

 

Thanks for help

 

Posted

I usually use calculated fields...

 

procedure TUniMainModule.dtFamiliaCalcFields(DataSet: TDataSet);
begin
  dtFamilianombre.AsString := '<p class="x-p-infofam">' + dtFamiliafamilia.AsString + '</p>';
end;

and css...

 

.x-p-infofam {
word-wrap: break-word;
white-space: pre-line;
padding: 2 5 2 5;}

 

  • Upvote 1
  • 7 years later...
Posted

Hello!

I've tried this code, but without success.

In my case the grid shows nothing in the string column (I use the mobile grid version TUnimDBGrid).

I've set "AllowHTML" to true.

What do I wrong?

Regards

Mike

Posted
2 hours ago, likemike said:

Hello!

I've tried this code, but without success.

In my case the grid shows nothing in the string column (I use the mobile grid version TUnimDBGrid).

I've set "AllowHTML" to true.

What do I wrong?

Regards

Mike

Hello,

 try something else:

1. uniDBGrid is render html in column data

2. if you make sql select with adding html then you will get what you want.

like this: 

Add ('Select Name from Mytable '), replace with this : Add ('Select ''<H1>'' + Name + ''</H1>'' from Mytable)

If You want to wordwrap, then just use: Add ('Select Replace (Name,'' '',''</br>'') as wwName from Mytable ');

 

Posted

Thank you for your answer, but this will not work for me, because I want to wrap a long string with a lot of words.

It should be wrapped, when the string reaches the end of the column.

This CSS operator should do this 

word-wrap: break-word;

but it won't work.

Posted
1 hour ago, likemike said:

Thank you for your answer, but this will not work for me, because I want to wrap a long string with a lot of words.

It should be wrapped, when the string reaches the end of the column.

This CSS operator should do this 



word-wrap: break-word;

but it won't work.

Did You try like this:

word-wrap: break-word !important;
Posted

I use this in my mssql script to manipulate text in column:

SELECT ('<H2 style="color:blue;text-align:center;">'+ Products."Name" + '</H2>' 
        +  CASE 
            WHEN CONVERT (varchar (250)
                , STUFF (
                        (SELECT CHAR (10) + '|||' + REPLACE (ParamName,'-','') + CHAR (10) + ParamValue
                        FROM OderDataArt
                        WHERE OderDataArt."ID_Art"=Products."ID"
                FOR XML Path ('')),1,1,'')) <> ''
            THEN '<h3>' 
                + REPLACE (CONVERT (varchar (250)
                , STUFF (    (SELECT  CHAR (10) + '|||' + REPLACE (ParamName,'-','') + CHAR (10) + ParamValue 
                        FROM OderDataArt
                        WHERE OderDataArt."ID_Art"=Products."ID"
                FOR XML Path ('')),1,1,''))
                ,'|||','</br>')
                + '</h3>'

            ELSE ''
            END
        + '<ul><ul><h3 align="right">Price: '
        + CAST (ROUND (Products."Price",2) as varchar (20))
        + ', ' + lower (Products."Val") + '</h3></ul></ul>'
'......

Maybe You can insert standart css format in column data

Posted

The error was made by me. 

Maybe it helps to prevent this for other users:

When you add a new calculated string field in a firebird database the length is set to 20 characters by default. Of course this wasn't enough to save my string + the html commands. So the solution is to set the length to 200 or more characters.

And it's necessary to set the CSS to "important" (otherwise it won't work):

word-wrap: break-word !important;
  • Like 1
Posted
9 hours ago, likemike said:

Of course this wasn't enough to save my string + the html commands. So the solution is to set the length to 200 or more characters.

just for information: In my example i use html manipulation in SQL query and not needed extend in database field.

 

Posted
1 hour ago, irigsoft said:

just for information: In my example i use html manipulation in SQL query and not needed extend in database field.

 

Yes I know, but firebird SQL isn't that powerful. There are not enough commands available to do what I want in SQL.

Posted
49 minutes ago, likemike said:

but firebird SQL isn't that powerful. There are not enough commands available to do what I want in SQL.

Hello,

If I understand you correctly, then you can also use stored procedures.

Posted
1 hour ago, Sherzod said:

Hello,

If I understand you correctly, then you can also use stored procedures.

This in another option, but the solution with calculated fields fit the best for me, because the database is used in common with other applications. So it's better not to change anything in the stored procedures of the database.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...