Si redefines el evento de dibujar las celdas en el DBGrid sí se puede mostrar el contenido de un memo.
Se puede acceder al campo utilizando un BlobStream:
var
P: array [0..50] of char; {array size is number of
characters needed}
bs: TBlobStream; {from the memo field}
hStr: String;
begin
with (Sender as TDBGrid).Canvas do
begin {Table1_NombreCampo es el TMemoField}
bs := TBlobStream.Create(Table1_NombreCampo, bmRead);
FillChar(P,SizeOf(P),#0);
bs.Read(P, 50); {Carga los 50 primeros caracteres}
bs.Free;
hStr := StrPas(P);
{cambia saltos de carro y final de linea por espacios}
while Pos(#13, hStr) > 0 do
hStr[Pos(#13, hStr)] := ' ';
while Pos(#10, hStr) > 0 do
S[Pos(#10, hStr)] := ' ';
// limpia la celda
FillRect(Rect);
// pinta el texto
TextOut(Rect.Left, Rect.Top, hStr);
end;
end;
|