Cannot paste a static metafile that has been copied to the clipboard

A given Word document has screen shots that were generated via Paste Special | Picture (enhanced metafile). This document was subsequently exported to DOORS 9.2 where attempts to open the picture result in the error message 'This OLE object is a static metafile and cannot be opened'. No problem with this so far.

dxl can successfully copy these static images from Object Text to the Windows clipboard, but cannot (apparently) copy them from the clipboard back to the object text of another object. It can be shown that the item has indeed been successfully copied to the clipboard by pasting it from the clipboard into Word.

Code below shows approaches that have been tried and found to fail (note that all indicators are that the static metafile is recognized as an OLE item). Hoping someone can provide a solution to pasting these items from the clipboard into Object Text. Note that this code successfully completes its mission when object 2028 is used as the source and fails when object 879 is used.
 

Module  mSource = edit("/Mod Nav/408032H  --   LN-100GT PIDS",false)
if (null mSource) warningBox("Source not open")
Module  mTarget = edit("/Mod Nav/Papa Bear",false)
if (null mTarget) warningBox("Source not open")
Object  oSource, oTarget, oNewTarget, o
 
//    oSource = object(877, mSource)  // plain text only
//    oSource = object(879, mSource)  // static metafile figure
    oSource = object(879, mSource)  // static metafile figure
//    oSource = object(2028, mSource)  // embedded Word document object
    oTarget = object(729, mTarget)  // plain text in object text
    oNewTarget = object(730, mTarget)  // empty object (null in heading and object text
 
//========================================================================================
void checkOLECopy(Object o, string attributeName)
  {
    RichText rtf
    string s = richTextWithOle o.attributeName
    for rtf in s do       {
      if (rtf.isOle)           {
        EmbeddedOleObject ole = rtf.getEmbeddedOle
        oleCopy(ole)
        print "Static metafile now on clipboard\n"
        break
      }
    }
  }
 
 
if (oleIsObject(oSource)) {
  print "DOORS recognizes object contents as OLE\n"
  }
else  {
  print "DOORS does not recognize object contents as OLE\n"
}
if (containsOle(oSource."Object Text")){
  checkOLECopy(oSource, "Object Text")
  if (olePaste oTarget == false){ // this  will cleanly paste a Word object
    print "Problem trying to paste object\n"
  }
  else {
    print "Object should have been successfully pasted\n"
  }
}
else {
   oTarget."Object Text" = oSource."Object Text" ""
}
copyPictureObject(oSource, oTarget) // static metafile is not copied into oTarget
if ((getPictFormat(oSource)) == formatUNKNOWN) then print "Picture format is unknown (but it is a picture?)\n"
bool Result = pictureCopy(oSource)  //  dxl error : error opening picture: This picture does not exist
refresh mTarget

 


Suspect this problem may somehow be related to a known import problem in which two copies of an OLE object show up in a given DOORS object; one which is visible, but which cannot be activated, and a second which is invisible and can be activated.

 


dedawson - Mon Apr 25 13:35:34 EDT 2011

Re: Cannot paste a static metafile that has been copied to the clipboard
dhars_priya - Tue Jun 23 04:36:33 EDT 2015

Could you found any solution to solve this problem.

I have a same problem , I am able to copy the static OLE objects but i am not able to Paste in the object text.

Is it possible to paste? The static OLEobjects is successfully copied , I used this command to paste.

string res=olePasteSpecial(o."Object text",false)

When i print res i am getting message as unable to paste.

Could any one tell me why?

 

Re: Cannot paste a static metafile that has been copied to the clipboard
woodpryan - Tue Jun 23 11:20:04 EDT 2015

I actually don't think the problem is your code. I think the problem is your data. You may need to do some cleanup work on those pictures. I've never dealt with this exact issue myself, but 'static metafile' error sounds like a problem. Your code looks just fine to me.