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?
|
Re: Exporting Color from DOORS to Word |
Re: Exporting Color from DOORS to Word kbmurphy - Thu May 20 12:52:57 EDT 2010 Thanks |
Re: Exporting Color from DOORS to Word 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
|
Re: Exporting Color from DOORS to Word HiLbiLy - Thu May 20 15:03:46 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)
|
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
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)
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Exporting Color from DOORS to Word 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)
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
|
Re: Exporting Color from DOORS to Word 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)
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()
|
Re: Exporting Color from DOORS to Word kbmurphy - Thu May 20 12:52:57 EDT 2010 Please can you give me more information about this. I am not sure how to do this. |
Re: Exporting Color from DOORS to Word SonaliAgrawal - Tue Sep 14 08:55:45 EDT 2010 |