【问题标题】:DOORS DXL: insert OLE Object into any object attributeDOORS DXL:将 OLE 对象插入到任何对象属性中
【发布时间】:2013-05-28 19:09:50
【问题描述】:

有没有办法使用 DXL 脚本将 Word 文档作为 OLE 对象插入到任何不同于 Object Text 的对象属性中?

DXL 函数oleInsert 允许这样做,但仅适用于属性对象文本

谢谢

【问题讨论】:

    标签: ibm-doors


    【解决方案1】:

    不幸的是,我无法直接执行此操作,但如果您的对象文本中还没有 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"
    }
    

    oleInsertolePasteSpecial 中的true 是将OLE 作为图标插入。如果您不希望它作为图标,您可以将它们都更改为 false。

    祝你好运!

    【讨论】:

    • 谢谢史蒂夫,这也是一位顾问向我推荐的。
    【解决方案2】:

    为了完整性:在 DOORS 9.5 中,oleInsert() 的签名发生了变化:

    bool oleInsert(Object o,[attrRef],string fileName,[bool insertAsIcon])
    

    有文档

    如果指定了可选参数attrRef,那么OLE对象是 嵌入在用户定义的文本属性中。如果没有参数 指定,则 OLE 对象嵌入系统“对象文本”中 属性。

    这使它更容易一些。

    【讨论】:

      【解决方案3】:

      感谢@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"
      }
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2015-07-23
        • 1970-01-01
        • 2020-02-06
        • 1970-01-01
        • 2016-01-29
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多