0

I am building report system which some part of code looks like this:

xmldoc := LoadXMLDocument(reportPath);
xsldoc := LoadXMLDocument(templatePath);
xmldoc.Node.TransformNode(xsldoc.Node, outputString);
stream := TStringStream.Create(outputString);
richedit.Lines.LoadFromStream(stream);

I am loading xml document and xsl document (which builds my RTF string from XML), and it works very well, but problem is with bitmap picture.

When I'm putting inside my RTF string element which contains bitmap data:

{\pict\wmetafile8\picw15300\pich9000\picwgoal15300\pichgoal9000\picscalex100\picscaley100
89504E470D0A1A0A0000000D49484452000003FC00000258080200000050397AE00000CBA54944415478DAECBDCFAB745B7ADFF75C8107F1386494B64C6CF93642131B0D820DE23409D68FE046A3E80AC26D68E2D644A0A0C41958CA7BDED3111A74C028A0494BA0D04D402D91414390841B9C3... etc.
}

it is ignored by my TRichEdit control (it is not loaded there from my stringstream - stringstream contains elements of picture, i'm sure). When I manually put inside my rtf document code which contains data of picture and open it in WordPad (windows 7) the bitmap is not visible, but when i'm open it in MS Word the picture is visible.

What I did wrong?

vBB
  • 215
  • 1
  • 3
  • 7
  • No, it is not duplicate, did you read those questions and mine? Pretty sure you didn't... – vBB Mar 23 '15 at 12:39
  • Yes it is a duplicate in so far that the method you seem to be using is unworkable **and** your question misses a lot of required information (what does the XML have to do with the RTF and the picture, that seems totally irrelevant). So it is better to put you on the right track by pointing to those solutions. – Jan Doggen Mar 23 '15 at 12:46
  • Do you want to display an image in a rich edit control? – David Heffernan Mar 23 '15 at 13:08
  • Yes, I want. But the code which I showed at OP is not working... – vBB Mar 23 '15 at 13:12
  • I have tried to load rtf file with picture to richedit and bitmap is not displayed. When I'm open THE SAME file with MS Word the picture is displayed. – vBB Mar 23 '15 at 13:17
  • `TRichEdit` in its vanilla form will not display images. The duplicate questions shows you how to do that. – David Heffernan Mar 23 '15 at 13:26
  • @David, that sounds weird. Why would then WordPad inline the bitmap data into the RTF file ? I think this might be something along the RichEdit control version that is being used by Delphi (but it's just a wild guess; I'm not so rich for this edit). – TLama Mar 23 '15 at 13:35
  • @TLama Does it? According to Q WordPad can't display the image either. – David Heffernan Mar 23 '15 at 13:36
  • @David, yes, my Windows 7 WordPad can save and display inserted bitmap (and looking at the RTF size and structure it really inlines the bitmap into the RTF). – TLama Mar 23 '15 at 13:40
  • Ok, so finally i have SOLUTION: default richedit CANNOT display images, but JVRICHEDIT (jedi) CAN. Thanks for right direction Guys :) – vBB Mar 23 '15 at 13:58
  • @vBB Guess how the JEDI control manages to do that? – David Heffernan Mar 23 '15 at 13:59
  • Don't know how, but I think it can be that way which was showed in "duplicate" threads... :-) – vBB Mar 23 '15 at 14:05
  • Yup. That's exactly it. – David Heffernan Mar 23 '15 at 18:22

0 Answers0