Hi
I'm using a TWPRichText with a TWPToolbar on a form.
I type in a text, for instance 'Hello world' in the WPRichedit using a font and saves the string in a file as HTML using Delphi's Indy component:
Code
var AStringStream: TStringStream;//Connect to FTPAStringStream := TStringStream.Create((GetHTMLFromEditor);WPRichText1.AsANSIString('HTML-usecr,-onlybody'));IdFTP1.Put(AStringStream, Filename);//Disconnect
The content of the file looks like this:
<div> <span style="font-family:''Arial Narrow'';font-size:12.00pt;">Hello world</div>
Then I reload the file into the WPRichEdit:
Code
function GetHTMLString(): string; //Reads HTML from file
var
AStringStream: TStringStream;
begin
if FTPConnect then
begin
AStringStream := TStringStream.Create('');
try
IdFTP1.Get(FileName, AStringStream)
IdFTP1.Disconnect;
AStringStream.Position := 0;
if AStringStream.Size > 0 then
Result := AStringStream.DataString
else
Result := '';
finally
AStringStream.Free;
Screen.Cursor := crDefault;
end;
end;
end;
procedure ReadPage; //Filling WPRichEdit by using HTML string
begin
WPRichText1.TextLoadFormat := 'HTML';
WPRichText1.AsString := GetHTMLstring();
end;
Alles anzeigen
I then select the text 'Hello world' and using the WPToolbar to change the font, but this has no effect on the HTML output, if I try to save the text with the changed font as described above.
Do I miss some options, or what is wrong?
Best regards
Kaare Christensen
AK Techotel