I have a situation where I want to always show the header and footer (ie Layout mode set to wplayFullLayout), but when I save the document I want to embed the images in to the document. The only way I have been able to do this is to set the Layout Mode to wplayLayout and then Save the document.
So when I try to save a document I do this:
RTFText.LayoutMode := wplayLayout; //want to save the images
RTFText.SaveToFile(sFile, False, 'RTF-nomergefields'); //save the RTF doc
RTFText.LayoutMode := wplayFullLayout; //want to see the H + F info again
But the above does not seem to save the images in the document. It is almost like it doesn't recognize that the Layout mode has changed and needs to call OnPrepareImageForSaving etc.
Usually the images will always included. If thy are linked you might try 'RTF-AlwaysEmbed,-nomergefields' to make sure they are embedded with the binary data.
Also see the property WriteObjectMode. wobRTF should be used for best compatibility.
I was able to get it to work in the end. If I went into the RTFText property of the TWPRichText at design time and then click OK (entering no text), it seems to work from now on. Previously there was no document in design time so this has seemed to have fixed it.
Thanks, Luke.
#5♥ 0
This category is archived. No new posts are possible.