ibm-doors

DXL Script to Export DOORS Object Information to Microsoft Word - Randomly Dropping Information


I have a DXL script that is supposed to go through each object in the selected module and export various object information based on the object data to a Microsoft Word file. It generally works, but I am having a problem where at random points in the module the data doesn't get pasted into the Word document.

There are a few functions to perform the export of data, and they are called depending on the DOORS object:

Here are the functions:


/****************************************************************************************
* put_new_line_in_word
*****************************************************************************************/
void put_new_line_in_word()
{
    clear oleAutoArgs
    put(oleAutoArgs, 1) // 0=wdCollapseEnd, 1=wdCollapseStart
    oleMethod(objSel, "Collapse", oleAutoArgs)
    setRichClip(richText "\n" )
    oleMethod(objSel, "Paste")
}//put_new_line_in_word


/****************************************************************************************
* put_plain_text_in_word
*****************************************************************************************/
void put_plain_text_in_word(string s)
{
    clear oleAutoArgs
    put(oleAutoArgs, 1) // 0=wdCollapseEnd, 1=wdCollapseStart
    oleMethod(objSel, "Collapse", oleAutoArgs)
    copyToClipboard( s )
    oleGet(objSel, "Font", oleFont)
    olePut(oleFont, "Size", 11)
    oleMethod(objSel, "Paste")

}//put_plain_text_in_word

/****************************************************************************************
* put_heading_in_word
*****************************************************************************************/
void put_heading_in_word( string s )
{
    clear oleAutoArgs
    put(oleAutoArgs, 1) // 0=wdCollapseEnd, 1=wdCollapseStart
    oleMethod(objSel, "Collapse", oleAutoArgs)
    copyToClipboard( s )
    oleGet(objSel, "Font", oleFont)
    olePut(oleFont, "Size", 18)
    oleMethod(objSel, "Paste")
}//put_heading_in_word


/****************************************************************************************
* put_object_text_in_word
*****************************************************************************************/
void put_object_text_in_word(Object ob)
{
    clear oleAutoArgs
    put(oleAutoArgs, 1) // 0=wdCollapseEnd, 1=wdCollapseStart
    oleMethod(objSel, "Collapse", oleAutoArgs)
//  setRichClip(richText richText(ob."Object Text"))
    setRichClip(richText(ob."Object Text"))
    oleMethod(objSel, "Paste")

}//put_object_text_in_word

Here is an example of how they are used:

/****************************************************************************************
* Export_object
*   This is called for each object
*****************************************************************************************/
void Export_object (Module m, Object obj)
{

// allows the the use of attribute exists
current = m


    if ( isValidObject(obj))
    {
        temp_str = obj."Object Heading"
        if(!null temp_str)
        {
            put_plian_text_in_word("ID: ")
            put_plian_text_in_word(identifier(obj))
            put_new_line_in_word
            
            temp_str = number(obj)
            put_heading_in_word(temp_str)
            put_heading_in_word("  ")
            temp_str = obj."Object Heading"
            put_heading_in_word(temp_str)
            put_new_line_in_word
        
        
        }
        else
        {
        
        
            put_plian_text_in_word("ID: ")
            put_plian_text_in_word(identifier(obj))
            put_new_line_in_word
            
            temp_str = obj."Requirement"
            put_plian_text_in_word("Requirement: " temp_str)
            put_new_line_in_word
            
            temp_str = obj."Derived"
            put_plian_text_in_word("Derived: " temp_str)
            put_new_line_in_word
            
            temp_str = obj."DO-178 Level"
            put_plian_text_in_word("DO-178 Level: " temp_str)
            put_new_line_in_word
            
            temp_str = obj."Safety"
            put_plian_text_in_word("Safety: " temp_str)
            put_new_line_in_word        
            
            put_plian_text_in_word("Object Text: ")
            put_new_line_in_word
            put_object_text_in_word(obj)
            if(oleCopy(obj))
            {
                oleMethod(objSel, "Paste")
                put_new_line_in_word
            }
            
            temp_str = obj."Justify"
            put_plian_text_in_word("Justify: " temp_str)
            put_new_line_in_word    
        }

    }
}

My initial thought was that there were too many accesses to the OLE interface and things were getting dropped, so I created functions that used Buffer variables where I put the individual strings into the buffer and stopped using the "put_new_line_in_word" function and just placed '\n' in the buffer. Now I just lose bigger chunks of data, and it didn't seem to reduce the frequency of losing data.

Any ideas?


Solution

  • As far as I know, this is an unresolved issue with DOORS and Windows 10. The usual way to export to a Word document is using the Windows clipboard. The memory management seems to have changed in Windows 10, which throws OLE-Errors / OLE problems. That's also, why the issue is not reproducible all of the time.

    I have no actual solution for you. As a workaround, if you have the possibility to use Windows 7, I would suggest to use it, until IBM or Microsoft are fixing this issue, (in the IBM DOORS Release Notes, I have not seen a fix regarding this issue, until the current release 9.7.2.1).