From WPRichText to Word

  • I can get text from WPRichText into a Word document, but the smazll graphic, which has been inserted is not copied. I am using the following code:
    RTFHeaderForm->WPRichText1->SelectAll();
    //copy it to clipboard
    RTFHeaderForm->WPRichText1->CopyToClipboard();
    //to allow first report to appear!!
    if(repNo > 0)
    WordDocument->Sentences->Last->Select();
    WordDocument->Sentences->Last->Paste();

    Using CBuilder6 and Word 2000

    Any help much appreciated

    Brian

  • Hi, Thanks for the suggestion. It was set to wobRTF, which is correct I think. I did try wobAccordingtoobject and I got umpteem Word docs, with all but the correct one saying "recovered word document"!!

    Brian

  • I did a copy/paste from wprichtext component into word using Ctl-C/Ctl-V. I looked at the clipboard contents (clipbrd.exe), and you will only see the text. If you save the clipboard contents and look at it's contents, you will see the binary info for the images.

    Are you able to do this? If not, check the ClipboardOptions (mine are all false) and WriteBitmapMode (wbmDIBBitmap).

    Alternative, could save richtext into temporary RTF file and read it back in to the word doc?

  • Thanks for your observations - you are quite right, the image doesn't apparently get copied to the clipboard although it is there after saving the clipboard - I don't understand this!

    The obvious kludge would be to save and then load the clipboard contents, but the TClipboard class doesn't seem to provide this.

    I have checked the clipboard settings in WPTools and they are all correct (all set to false)

    Any other ideas??

    Thanks very much for your time and trouble

    Brian

  • Is it possible to SaveToFile the RTF contents of the wprichtext to a temporary file and is there a Word method to Append the RTF file to the word component?

    Have you looked at LoadToStream and SaveToStream methods?

  • Hi,

    Thanks for the reply. No, I haven't used any stream functions, so I am not sure how to go about it!!

    I would still like to know why we can see the graphic in the rtf codes and yet Word fails to take any notice. I am beginning to wonder whether WPTools does not insert the graphic as it should, but has its own way - I can copy graphics from one instance of an editor to another within the WPTools environment.

    I'll have a look at streams though and see if I can get anywhere!!!

    Thanks

    Brian