Exporting Color from DOORS to Word

Does anyone know of a way to export colored text from DOORS into Word? I am trying to export the redline from the diff(buffer) function displayed in a dxl column to Word. The normal export script will keep the underline, strike, and bold formatting but I would like to keep the color as well. I could always export the RTF and write a macro in Word to 'interpret' the RTF, but I am a novice at VB, and it would be a learning experience. Any ideas before I head into uncharted waters?
HiLbiLy - Thu May 20 08:37:08 EDT 2010

Re: Exporting Color from DOORS to Word
kbmurphy - Thu May 20 12:52:57 EDT 2010

I just exported a view straight to Word that used the deltaText function, both in Table and Book views. The redlines and underlines and colors all came through. Using DOORS 9.2 and Word 2003. Hope this helps.

Re: Exporting Color from DOORS to Word
HiLbiLy - Thu May 20 15:03:46 EDT 2010

kbmurphy - Thu May 20 12:52:57 EDT 2010
I just exported a view straight to Word that used the deltaText function, both in Table and Book views. The redlines and underlines and colors all came through. Using DOORS 9.2 and Word 2003. Hope this helps.

What is the deltaText function? Is this new to DOORS v9.2? I have DOORS v9.1 and Word 2007.
Thanks

Re: Exporting Color from DOORS to Word
llandale - Thu May 20 17:01:33 EDT 2010

Simple answer:

const string    cl_fDiffColorTable =
                        "{\\colortbl ;\\red255\\green0\\blue0;\\red60\\green200\\blue60;\\red60\\green60\\blue200;}"
 
 
Buffer  bufTemp = create()
bufTemp += "{\\rtf1 "
bufTemp += cl_fDiffColorTable
combine (bufTemp, bufIn, 0)   // fDiff output buffer
bufTemp += "}"
 
now export bufTemp

 

  • Louie

 

Re: Exporting Color from DOORS to Word
kbmurphy - Thu May 20 19:37:25 EDT 2010

HiLbiLy - Thu May 20 15:03:46 EDT 2010
What is the deltaText function? Is this new to DOORS v9.2? I have DOORS v9.1 and Word 2007.
Thanks

The deltaText function is demonstrated below. I'm not sure if it's included with a default DOORS install or not, but here it is....this would be inserted in a layout column.

pragma runLim,0
        const int TOKSIZE = 4     // number of digits to use to count tokens
 
                const int BOLD  =  1
                const int ITAL  =  2
                const int UNDL  =  4
                const int STRK  =  8
                const int RED   = 16
                const int GREEN = 32
                const int BLUE  = 64
 
 
                ///////////////////////////////////////////////////////////
                //  Main function
 
                Buffer deltaText(Buffer oldText, newText, int oldFont, newFont)
                {
                        string deleteMarkup = " "
                        if ( oldFont&RED   != 0 ) deleteMarkup = "\\cf1" deleteMarkup
                        if ( oldFont&GREEN != 0 ) deleteMarkup = "\\cf2" deleteMarkup
                        if ( oldFont&BLUE  != 0 ) deleteMarkup = "\\cf3" deleteMarkup
                        if ( oldFont&BOLD  != 0 ) deleteMarkup = "\\b" deleteMarkup
                        if ( oldFont&ITAL  != 0 ) deleteMarkup = "\\i" deleteMarkup
                        if ( oldFont&UNDL  != 0 ) deleteMarkup = "\\ul" deleteMarkup
                        if ( oldFont&STRK  != 0 ) deleteMarkup = "\\strike" deleteMarkup
 
                        string insertMarkup = " "
                        if ( newFont&RED   != 0 ) insertMarkup = "\\cf1" insertMarkup
                        if ( newFont&GREEN != 0 ) insertMarkup = "\\cf2" insertMarkup
                        if ( newFont&BLUE  != 0 ) insertMarkup = "\\cf3" insertMarkup
                        if ( newFont&BOLD  != 0 ) insertMarkup = "\\b" insertMarkup
                        if ( newFont&ITAL  != 0 ) insertMarkup = "\\i" insertMarkup
                        if ( newFont&UNDL  != 0 ) insertMarkup = "\\ul" insertMarkup
                        if ( newFont&STRK  != 0 ) insertMarkup = "\\strike" insertMarkup
 
                        Buffer resText = create()
 
                        string errmsg = diff(resText, oldText, newText, deleteMarkup, insertMarkup)
                        if ( !null errmsg )
                        {
                                print "deltaText: " errmsg "\n"
                                return null
                        }
 
                        return resText
                }
 
 
                string deltaText(Buffer oldText, newText, int oldFont, newFont)
                {
                        Buffer b = deltaText( oldText, newText, oldFont, newFont)
                        string s = stringOf(b)
                        delete(b)
                        return s
                }
 
                Buffer o = create()
                o = "This is original text."
                Buffer n = create()
                n = "This is new text."
                if ( length(o) > 10000 || length(n) > 10000 )
                {
                        displayRich "{\\i (Text too big to compare.)}"
                } else if (o!=n)
                {
                        displayRichWithColour deltaText(o, n, 25, 69)
                }
                delete(o)
                delete(n)

Re: Exporting Color from DOORS to Word
Mathias Mamsch - Fri May 21 07:39:46 EDT 2010

llandale - Thu May 20 17:01:33 EDT 2010

Simple answer:

const string    cl_fDiffColorTable =
                        "{\\colortbl ;\\red255\\green0\\blue0;\\red60\\green200\\blue60;\\red60\\green60\\blue200;}"
 
 
Buffer  bufTemp = create()
bufTemp += "{\\rtf1 "
bufTemp += cl_fDiffColorTable
combine (bufTemp, bufIn, 0)   // fDiff output buffer
bufTemp += "}"
 
now export bufTemp

 

  • Louie

 

If exporting the colortable with the rtf is not enough I guess you need to use the perm
 

void setRichClipWithColour (RTF_string__, string, string, bool, bool)

 


which is only available since DOORS 9.2.

Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

Re: Exporting Color from DOORS to Word
HiLbiLy - Fri May 21 09:30:41 EDT 2010

Mathias Mamsch - Fri May 21 07:39:46 EDT 2010

If exporting the colortable with the rtf is not enough I guess you need to use the perm
 

void setRichClipWithColour (RTF_string__, string, string, bool, bool)

 


which is only available since DOORS 9.2.

Regards, Mathias

 

 


Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

 

I believe Mathias is right...I need v9.2. I tried what llandale stated and upon export I get something like "__This is the oldnew text" or "R__This is the oldnew text" (*bold* means strikethrough). The "__" or "R__" is added in front and I am guessing that the the rtf doesn't like having the color table.

Re: Exporting Color from DOORS to Word
llandale - Fri May 21 11:29:54 EDT 2010

kbmurphy - Thu May 20 19:37:25 EDT 2010

The deltaText function is demonstrated below. I'm not sure if it's included with a default DOORS install or not, but here it is....this would be inserted in a layout column.

pragma runLim,0
        const int TOKSIZE = 4     // number of digits to use to count tokens
 
                const int BOLD  =  1
                const int ITAL  =  2
                const int UNDL  =  4
                const int STRK  =  8
                const int RED   = 16
                const int GREEN = 32
                const int BLUE  = 64
 
 
                ///////////////////////////////////////////////////////////
                //  Main function
 
                Buffer deltaText(Buffer oldText, newText, int oldFont, newFont)
                {
                        string deleteMarkup = " "
                        if ( oldFont&RED   != 0 ) deleteMarkup = "\\cf1" deleteMarkup
                        if ( oldFont&GREEN != 0 ) deleteMarkup = "\\cf2" deleteMarkup
                        if ( oldFont&BLUE  != 0 ) deleteMarkup = "\\cf3" deleteMarkup
                        if ( oldFont&BOLD  != 0 ) deleteMarkup = "\\b" deleteMarkup
                        if ( oldFont&ITAL  != 0 ) deleteMarkup = "\\i" deleteMarkup
                        if ( oldFont&UNDL  != 0 ) deleteMarkup = "\\ul" deleteMarkup
                        if ( oldFont&STRK  != 0 ) deleteMarkup = "\\strike" deleteMarkup
 
                        string insertMarkup = " "
                        if ( newFont&RED   != 0 ) insertMarkup = "\\cf1" insertMarkup
                        if ( newFont&GREEN != 0 ) insertMarkup = "\\cf2" insertMarkup
                        if ( newFont&BLUE  != 0 ) insertMarkup = "\\cf3" insertMarkup
                        if ( newFont&BOLD  != 0 ) insertMarkup = "\\b" insertMarkup
                        if ( newFont&ITAL  != 0 ) insertMarkup = "\\i" insertMarkup
                        if ( newFont&UNDL  != 0 ) insertMarkup = "\\ul" insertMarkup
                        if ( newFont&STRK  != 0 ) insertMarkup = "\\strike" insertMarkup
 
                        Buffer resText = create()
 
                        string errmsg = diff(resText, oldText, newText, deleteMarkup, insertMarkup)
                        if ( !null errmsg )
                        {
                                print "deltaText: " errmsg "\n"
                                return null
                        }
 
                        return resText
                }
 
 
                string deltaText(Buffer oldText, newText, int oldFont, newFont)
                {
                        Buffer b = deltaText( oldText, newText, oldFont, newFont)
                        string s = stringOf(b)
                        delete(b)
                        return s
                }
 
                Buffer o = create()
                o = "This is original text."
                Buffer n = create()
                n = "This is new text."
                if ( length(o) > 10000 || length(n) > 10000 )
                {
                        displayRich "{\\i (Text too big to compare.)}"
                } else if (o!=n)
                {
                        displayRichWithColour deltaText(o, n, 25, 69)
                }
                delete(o)
                delete(n)

The old deltaText and deltaBuff functions became obsolete when they developed the superior diff. They are included as part of the install here:
c:\program Files\IBM\Rational\DOORS\9.2\lib\dxl\example\include delta.inc and detalbuff.inc

delta.inc needs the following inserted in the last function, before matchStrings()

if ( !null mapping ) delete(mapping)
mapping = create()

  • Louie

Re: Exporting Color from DOORS to Word
SonaliAgrawal - Tue Sep 14 08:55:45 EDT 2010

kbmurphy - Thu May 20 12:52:57 EDT 2010
I just exported a view straight to Word that used the deltaText function, both in Table and Book views. The redlines and underlines and colors all came through. Using DOORS 9.2 and Word 2003. Hope this helps.

Hi,

Please can you give me more information about this. I am not sure how to do this.

Re: Exporting Color from DOORS to Word
Mathias Mamsch - Tue Sep 14 13:58:04 EDT 2010

SonaliAgrawal - Tue Sep 14 08:55:45 EDT 2010
Hi,

Please can you give me more information about this. I am not sure how to do this.

How to do what exactly? Exporting color? Do you have DOORS 9.2? Regards, Mathias