Reputation: 115
Is there a way to insert, with a DXL script, a word document as an OLE Object into any object attribute different from Object Text?
DXL function oleInsert
allows to do it, but works only for attribute Object Text.
Thank you
Upvotes: 1
Views: 3259
Reputation: 1
Thanks @Twonky! That's too helpful to me. Additionally I added a sample code from dxl reference manual.
/*
this code segment embeds an existing word document into the current formal
object
*/
string docName = "c:\\docs\\details.doc"
Object obj = current
if (oleInsert(obj, obj."my_text", docName)){
print "Successfully embedded document\n"
} else {
print "Problem trying to embed document\n"
}
Upvotes: 0
Reputation: 806
Just for completeness: With DOORS 9.5 the signature of oleInsert()
changed:
bool oleInsert(Object o,[attrRef],string fileName,[bool insertAsIcon])
With the documentation
If the optional parameter attrRef is specified, then the OLE object is embedded in the user-defined text attribute. If no parameter is specified, then the OLE object is embedded in the system "Object Text" attribute.
This makes it a bit easier.
Upvotes: 0
Reputation: 1892
Unfortunately there is no way I can see to do it directly but this is a good work around if your object text doesn't already have an OLE in it.
Object o = current
string filename = "PATH_TO_FILE"
oleInsert(o, filename, true)
string err = null
if (oleIsObject o){
if (oleCut o){
err = olePasteSpecial(o."OTHER_ATTRIBUTE_NAME", true)
if(!null err)
print err
} else {
print "Problem trying to cut object\n"
}
} else {
print "Does not contain an embedded object in its object text\n"
}
The true
in oleInsert
and olePasteSpecial
are to insert the OLE as an icon. If you don't want it as an icon you can change them both to false.
Good Luck!
Upvotes: 1