【发布时间】:2013-05-28 19:09:50
【问题描述】:
有没有办法使用 DXL 脚本将 Word 文档作为 OLE 对象插入到任何不同于 Object Text 的对象属性中?
DXL 函数oleInsert 允许这样做,但仅适用于属性对象文本。
谢谢
【问题讨论】:
标签: ibm-doors
有没有办法使用 DXL 脚本将 Word 文档作为 OLE 对象插入到任何不同于 Object Text 的对象属性中?
DXL 函数oleInsert 允许这样做,但仅适用于属性对象文本。
谢谢
【问题讨论】:
标签: ibm-doors
不幸的是,我无法直接执行此操作,但如果您的对象文本中还没有 OLE,这是一个很好的解决方法。
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"
}
oleInsert 和olePasteSpecial 中的true 是将OLE 作为图标插入。如果您不希望它作为图标,您可以将它们都更改为 false。
祝你好运!
【讨论】:
为了完整性:在 DOORS 9.5 中,oleInsert() 的签名发生了变化:
bool oleInsert(Object o,[attrRef],string fileName,[bool insertAsIcon])
有文档
如果指定了可选参数attrRef,那么OLE对象是 嵌入在用户定义的文本属性中。如果没有参数 指定,则 OLE 对象嵌入系统“对象文本”中 属性。
这使它更容易一些。
【讨论】:
感谢@Twonky!这对我太有帮助了。 此外,我添加了 dxl 参考手册中的示例代码。
/*
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"
}
【讨论】: