-




- 2


procedure WriteStream(var f: Text; var Stream: TMemoryStream);

const

LF = #10;

BufSize = 8192; { bigger memos are chopped off!! }

var

Buffer: Array[0..Pred(BufSize)] of Char;

i: Integer;

begin

Stream.Seek(0,0);

if Stream.Size > 0 then

begin

Stream.Read(Buffer,Stream.Size);

for i:=0 to Pred(Pred(Stream.Size)) do

begin

{ empty line converted to <P> break }

if (Buffer[i] = LF) and (Buffer[i+1] = LF) then writeln(f,'<P>');

{ strip multiple spaces (are ignored anyway) }

if not ((Buffer[i] = ' ') and

(Buffer[i+1] = ' ')) then write(f,Buffer[i]);

{ start new sentence on a new line (but only in HTML doc itself }

if (Buffer[i] = '.') and (Buffer[i+1] = ' ') then writeln(f)

end;

writeln(f,Buffer[Pred(Stream.Size)])

end

else writeln(f,' ') { empty memo }

end {WriteStream};

procedure WriteMemo(var f: Text; Field: TField);

var Stream: TMemoryStream;

begin

Stream := TMemoryStream.Create;

(Field AS TMemoField).SaveToStream(Stream);

WriteStream(f,Stream);

Stream.Free

end {WriteMemo};