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.
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
dedawson - Mon Apr 25 13:35:34 EDT 2011 |
Re: Cannot paste a static metafile that has been copied to the clipboard 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 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. |