Hello,
At this time there is not yet support for importing HTML with inline images, only export. Import is on our todolist though.
Thank you for the answer.
It's on our todolist.
Thanks a lot.
Hello,
this is about 5 yeras old, and I came over the same problem again. Are there any news on that? Can I load html with inline images into the rtfeditor? Now I am using the TTMSFNCRichEditor and the TTMSFNCRichEditorHTMLIO to save and load the HTML code. Unfortunately I cannot get it to load the images.
Are there any workarounds for the problem?
Another problem is, that I have to go the way over a temporary file, as it does not provide save to a stream and load from a stream. So besides the image problem, there is another problem, where the only (and ugly) workaround I found is over temporary files.
I have to store the text with all formating and images in a database and must load it from that database to edit it and/or send it via email.
I also tried the TTMSFNCRichEditorRTFIO, because save and load works pretty good, but did not get the email part to work.
Do you have any hints for me?
Best regards
Helmut
I retested this here with TTMSFNCRichEditorHTMLIO.InlineImages = true and couldn't see an issue.
With TTMSFNCRichEditorHTMLIO connected to a TTMSFNCRichEditor, it loads this file inline.html (2.3 KB) correct and shows the image.
If somehow a problem persists, please check with the latest version first and then isolate this and provide a sample source app + detailed steps with which the problem can be reproduced.
Thank you for your quick reply. I now managed to save and load the code with images to and from my database. TTMSFNCRichEditorHTMLIO.InlineImages = true did the trick. I must have overseen that.
I only have one problem, that still exists. I did not find a way to save and load HTML or RTF to or from a stream. I have to use a temporary file to accomplish it.
So a TTMSFNCRichEditorHTMLIO.savetostream and TTMSFNCRichEditorHTMLIO.loadfromstream would be great.
The same for TTMSFNCRichEditorRTFIO.
Is there something I missed, or is ther just no such method in these classes?
Is there an alternative way to do it without using a temporary file?
Now I found another problem. When I insert a JPG image, it allows me to convert it to HTML to store it in the database. When I try to load it from the database, I have to convert it back from HTML by saving the HTML to a file and loading it from there with the TTMSFNCRichEditorHTMLIO.load method. Unfortunately that raises an exception, that it is an invalid BMP image.
When I use a BMP Image it works.
Is there a way to use other image formats like JPG or PNG?
Why does it allow me to save it, but not to load it?
Just discovered, that the HTML File has "<IMG src="data:image/bmp;base64" for the JPG image. So it assumes it is a BMP when loading. Why is it saved with "<IMG src="data:image/bmp;base64" and not with "<IMG src="data:image/jpg;base64"?
Now I have a new problem. I discovered that the TTMSFNCRichEditorHTMLIO.load could also be called with a stream. That is great. Not so great is, that it does not work with.
The problem is, that I cannot call the load method with a stream and not passing a TEncode object to the method. If you don't pass a TEncode, you get a runtime error. If you pass TEncodUTF8, German Umlaute cause it to raise an exception. TncodeUnicode returns a total mess.
In the Unit TMSFNCRichEditorIO I found the method
procedure TTMSFNCRichEditorHTMLIO.Load(AStream: TStream{$IFNDEF LCLLIB}; Encoding: TEncoding = nil{$ENDIF});
and the line
ss := TStringStream.Create(''{$IFNDEF LCLLIB}, Encoding {$ENDIF});
causes the problem.
So I could see, that the encoder is not used, if I define LCLLIB. So I tried it, and it worked fine. However I do not know what sideeffects this could cause.
I could also just change the code in the source, but with the next update, I probably have to do it again.
I spent the whole day with this problem. Is there a fix from your side or do I have to fix it somehow for myself?
I cannot reproduce this.
I could load attached test HTML with a JPEG without issues:
riched.html (83.8 KB)
The browser nor TTMSFNCRichEditor really pays attention to the date:image/XXX specifier.
I could open a HTML file via a stream here with:
var
ms:TMemoryStream;
begin
ms := TMemoryStream.Create;
ms.LoadFromFile('e:\tms\temp\riched.html');
ms.Position := 0;
TMSFNCRichEditorHTMLIO1.Load(ms, nil);
ms.Free;
end;
and I could not see an issue. The file loads fine.
Thank you for your answers. As already mentioned in the other thread, I have to update my component pack. Such a shame, I missed a lot of updates. Will do it tomorrow.