Topic
  • 5 replies
  • Latest Post - ‏2014-03-21T18:29:29Z by rdratlos
rdratlos
rdratlos
17 Posts

Pinned topic OLE Automation Interface Disturbance to MS Word 2010

‏2014-03-19T12:42:53Z |

Dear all,

after upgrade to Office 2010 we experienced frequent but random null OLE object returns, when retrieving Word 2010 document objects via OLE automation interface from DOORS. Examples for such objects were AttachedTemplate, InlineShapes, Paragraphs and others. As these are all objects or collections that always exist within a Word document, we refrained from checking for null objects here. This has worked fine for Office 2007 and 2003.

We fixed the problem by forcing Word's Application.Visible property to false, i. .e by completely hiding Word 2010 during lifetime of the OLE automation interface.

Another issue was, that when being managed from DOORS Word 2010 may loose connection to Word document properties. This happened when e. g. closing activated InlineShapes or closing other documents. We could fixed this issue by reactivating the affected Word document using Document.Activate method.

Has anybody made similar experience? Any ideas why the OLE automation interface is severely harmed, when Word 2010 is visible?

Feedback is welcome. DOORS client is 9.4.

Best regards

Thomas

  • llandale
    llandale
    3035 Posts

    Re: OLE Automation Interface Disturbance to MS Word 2010

    ‏2014-03-19T17:57:02Z  

    I'm new to OLE Automation (haven't used it in Word 2007) but your symptoms sound familiar. So I suppose you are coding around it adequately and finding out the real cause isn't going to help your code.

  • rdratlos
    rdratlos
    17 Posts

    Re: OLE Automation Interface Disturbance to MS Word 2010

    ‏2014-03-19T18:11:20Z  
    • llandale
    • ‏2014-03-19T17:57:02Z

    I'm new to OLE Automation (haven't used it in Word 2007) but your symptoms sound familiar. So I suppose you are coding around it adequately and finding out the real cause isn't going to help your code.

    Yes, it seems there are still ways to code around the OLE automation problems.

    On the other hand, allowing Word 2010 to be visible can be of great help to locate own coding errors. Currently, the only chance is to guess the location, make Word visible there and pause code excecution to check the Word document.

    I was hoping that there are other OLE automation users that may have found a better solution to allow Word to be visible.

  • llandale
    llandale
    3035 Posts

    Re: OLE Automation Interface Disturbance to MS Word 2010

    ‏2014-03-19T19:52:16Z  
    • rdratlos
    • ‏2014-03-19T18:11:20Z

    Yes, it seems there are still ways to code around the OLE automation problems.

    On the other hand, allowing Word 2010 to be visible can be of great help to locate own coding errors. Currently, the only chance is to guess the location, make Word visible there and pause code excecution to check the Word document.

    I was hoping that there are other OLE automation users that may have found a better solution to allow Word to be visible.

    Keeping in mind I don't know what I'm doing (on this topic I just keep typing until it works then stop), I see that my create app function first creates the application, and then explicitely sets it either visible or invisible.  So perhaps while setting it invisible works, setting it visible works also, even if it is already visible.  And in fact I have dealt with visible Word automation.

  • rdratlos
    rdratlos
    17 Posts

    Re: OLE Automation Interface Disturbance to MS Word 2010

    ‏2014-03-21T18:15:46Z  
    • llandale
    • ‏2014-03-19T19:52:16Z

    Keeping in mind I don't know what I'm doing (on this topic I just keep typing until it works then stop), I see that my create app function first creates the application, and then explicitely sets it either visible or invisible.  So perhaps while setting it invisible works, setting it visible works also, even if it is already visible.  And in fact I have dealt with visible Word automation.

    The issue is, that one and the same visibility setting works for Word 2003 and Word 2007 but not for Word 2010. And as the returned null OLE object failure spreads randomly through the code, there was no chance to locate the root cause for this.

  • rdratlos
    rdratlos
    17 Posts

    Re: OLE Automation Interface Disturbance to MS Word 2010

    ‏2014-03-21T18:29:29Z  

    I have to correct my first post:

    Quote:

    Another issue was, that when being managed from DOORS Word 2010 may loose connection to Word document properties. This happened when e. g. closing activated InlineShapes or closing other documents. We could fixed this issue by reactivating the affected Word document using Document.Activate method.

    End Quote

    The fix could not solve the problem. Again: The code works perfectly, when using Word 2003 or Word 2007. But it fails (lost access to Word OLE objects like InlineShape, ...), when moving to Office 2010.

    Nearly on the verge of despair we added the line

    sleep_( 500 )

    before moving to the next InlineShape for activation. This simple 500 ms pause of the DXL script solved the issue.

    For us it seems that DOORS 9.3 and 9.4 clients and Word 2010 have a timing problem on the OLE automation interface. Word 2010 cannot follow the fast sequence of OLE commands.

    We haven't tested to what extend one can reduce the waiting time. For the time being we're glad that the script runs through without run-time errors.