How to remove an unwanted hanging indent in a column

Hi,

I have cut and paste some text from a Word document into a DOORS module. The Word paragraph has a hanging indent, which has been honoured by DOORS. In DOORS I don't want this hanging indent, I just want everything left justified. I could format the paragraph as I want it in Word then copy and paste again, but is there a way I can reformat the paragraph alignment correctly in DOORS?

Pic related.

Nick,
http://www.akroyd-wallis.co.uk/
nick3216 - Wed May 18 04:17:02 EDT 2011

Re: How to remove an unwanted hanging indent in a column
SystemAdmin - Wed May 18 07:14:57 EDT 2011

Short answer - recommended that you copy and paste again but this time do not include the MSWord end-of-paragraph marker in the copy, only the text.

Longer answer - when you copy and paste text from MSWord to DOORS, you are also copying the hidden RTF code words\tags that define the font and paragraph style to be applied to the text. When you include the MSWord end-of-paragraph marker in the copy, this marker holds the RTF paragraph style info which in your case is the RTF code for a hanging indent - only problem is that DOORS does not support the modification of hanging indents - unless you want to modify down at the RTF code word level (not recommended).

DOORS will attempt to compile the RTF code and display accordingly. The problem is that DOORS does not provide tools to modify RTF defined character and paragraph styles like indented paragraphs, or coloured\highlighted text and so on. DOORS has basic RTF tools to apply fixed para indentation, unnumbered bullet symbols, Bold, Italic, Underline and Strike-through, but that's about all. This is frustrating because DOORS could really do with supporting a richer set of RTF features like hanging indentation, para & char spacing, custom tab positions, coloured text, auto-numbered bullets etc.


Paul Miller
Melbourne, Australia

Re: How to remove an unwanted hanging indent in a column
Peter_Albert - Wed May 18 07:28:18 EDT 2011

SystemAdmin - Wed May 18 07:14:57 EDT 2011
Short answer - recommended that you copy and paste again but this time do not include the MSWord end-of-paragraph marker in the copy, only the text.

Longer answer - when you copy and paste text from MSWord to DOORS, you are also copying the hidden RTF code words\tags that define the font and paragraph style to be applied to the text. When you include the MSWord end-of-paragraph marker in the copy, this marker holds the RTF paragraph style info which in your case is the RTF code for a hanging indent - only problem is that DOORS does not support the modification of hanging indents - unless you want to modify down at the RTF code word level (not recommended).

DOORS will attempt to compile the RTF code and display accordingly. The problem is that DOORS does not provide tools to modify RTF defined character and paragraph styles like indented paragraphs, or coloured\highlighted text and so on. DOORS has basic RTF tools to apply fixed para indentation, unnumbered bullet symbols, Bold, Italic, Underline and Strike-through, but that's about all. This is frustrating because DOORS could really do with supporting a richer set of RTF features like hanging indentation, para & char spacing, custom tab positions, coloured text, auto-numbered bullets etc.


Paul Miller
Melbourne, Australia

If you don't care about rich text formatting at all, and if there are no OLE objects in the Text, i.e. if it is o.k. to just keep the plain text content, then

Object o = current o.
"Object Text" = o.
"Object Text" 
""
removes all formatting, including the hanging indent.

If you want to preserve the rich text formatting which DOORS is able to handle, i.e. bold, underline, bullets, paragraph indent, then there is a kitchen script available which removes all other rich text (i.e. the things DOORS cannot handle).

This script removes OLE objects, but with a few extra lines it can be modified to keep OLE objects. Let me know if you need to preserve existing formatting, then I will post the modified script here.

Regards,

Peter

Re: How to remove an unwanted hanging indent in a column
llandale - Wed May 18 10:52:44 EDT 2011

Peter_Albert - Wed May 18 07:28:18 EDT 2011
If you don't care about rich text formatting at all, and if there are no OLE objects in the Text, i.e. if it is o.k. to just keep the plain text content, then


Object o = current o.
"Object Text" = o.
"Object Text" 
""
removes all formatting, including the hanging indent.

If you want to preserve the rich text formatting which DOORS is able to handle, i.e. bold, underline, bullets, paragraph indent, then there is a kitchen script available which removes all other rich text (i.e. the things DOORS cannot handle).

This script removes OLE objects, but with a few extra lines it can be modified to keep OLE objects. Let me know if you need to preserve existing formatting, then I will post the modified script here.

Regards,

Peter

... or get rid of all such rich text markup originally: copy from word, paste into Notepad, copy from Notepad and paste into DOORS. That particular sequence comes up for me lots of times not having to do with DOORS at all; at one point I had a Macro to copy the current selection, open Notepad, paste, select all, copy, and close notepad without saving; Called the macro "raw text copy". Used it for copying stuff into Emails where I didn't want the original Font type/size etc messing up the consistence of my emails.

Would not surprise me at all if someone figured out how to edit the rich text, look for the Indent tag, perhaps its "/indent4 ", and modify one character to make it unrecognizeable, perhaps "/indenX4 ", and store that back into the object. Perhaps something like this:



const string c_IndentTagYes = 
"//indent ",    
// Louie doesn't know the correct tag,  
//     but it starts with a slash and ends in a space c_IndentTagBad = 
"//indenX "     
// MUST be exact same length as TagYes 

const RegExp c_reIntent = regexp2(c_IndentTagYes)  
// Move RegExp outside of function, as its terribly slow   

void  DeleteIndentedText(Object in_obj) 
{     
// Remove any indentation from the Object Text 

if (

null in_obj) 

return 

int      iLoc, i bool    DoneOne = 

false Buffer  buf = create buf = richTextWithOLE(in_obj.
"Object Text")   

while(

true) 
{  

if (!(c_reIndent buf)) 

break   
// nothing left to do 
// Modify Buffer, inserting the bad tag: DoneOne = 

true iLoc = start(1)   
// Location in buffer where the match starts 

for (i = 0; i < length(c_IndentTagBad); iLoc++) 
{  set(buf, iLoc+i,  c_IndentTagBad[i]) 
} 
} 

if (DoneOne) obj.
"Object Text" = richText(tempStringOf(buf)) delete(buf) 
}     
// end DeleteIndentedText(obj)

Actually, I'd move the Buffer create as a global outside the function, in order to speed things up. OK, I've got a standard temp buffer in my library that I use for that purpose, so long as the function using it never calls any other function, who might also use it.

I'm wondering if the richText is needed for the tempStringOf command.
  • Louie

Re: How to remove an unwanted hanging indent in a column
SystemAdmin - Wed May 18 19:41:26 EDT 2011

llandale - Wed May 18 10:52:44 EDT 2011
... or get rid of all such rich text markup originally: copy from word, paste into Notepad, copy from Notepad and paste into DOORS. That particular sequence comes up for me lots of times not having to do with DOORS at all; at one point I had a Macro to copy the current selection, open Notepad, paste, select all, copy, and close notepad without saving; Called the macro "raw text copy". Used it for copying stuff into Emails where I didn't want the original Font type/size etc messing up the consistence of my emails.

Would not surprise me at all if someone figured out how to edit the rich text, look for the Indent tag, perhaps its "/indent4 ", and modify one character to make it unrecognizeable, perhaps "/indenX4 ", and store that back into the object. Perhaps something like this:




const string c_IndentTagYes = 
"//indent ",    
// Louie doesn't know the correct tag,  
//     but it starts with a slash and ends in a space c_IndentTagBad = 
"//indenX "     
// MUST be exact same length as TagYes 

const RegExp c_reIntent = regexp2(c_IndentTagYes)  
// Move RegExp outside of function, as its terribly slow   

void  DeleteIndentedText(Object in_obj) 
{     
// Remove any indentation from the Object Text 

if (

null in_obj) 

return 

int      iLoc, i bool    DoneOne = 

false Buffer  buf = create buf = richTextWithOLE(in_obj.
"Object Text")   

while(

true) 
{  

if (!(c_reIndent buf)) 

break   
// nothing left to do 
// Modify Buffer, inserting the bad tag: DoneOne = 

true iLoc = start(1)   
// Location in buffer where the match starts 

for (i = 0; i < length(c_IndentTagBad); iLoc++) 
{  set(buf, iLoc+i,  c_IndentTagBad[i]) 
} 
} 

if (DoneOne) obj.
"Object Text" = richText(tempStringOf(buf)) delete(buf) 
}     
// end DeleteIndentedText(obj)

Actually, I'd move the Buffer create as a global outside the function, in order to speed things up. OK, I've got a standard temp buffer in my library that I use for that purpose, so long as the function using it never calls any other function, who might also use it.

I'm wondering if the richText is needed for the tempStringOf command.
  • Louie

Louie wrote: "...at one point I had a Macro to copy the current selection, open Notepad, paste, select all, copy, and close notepad without saving"

Alternatively, most Windows applications have a "Paste Special" function which provides the option "Unformatted unicode text" or something similar. This cleans out the RTF real goooood! Pity that DOORS doesn't support this Paste Special option though (a hint for Mr IBM).


Paul Miller
Melbourne, Australia

Re: How to remove an unwanted hanging indent in a column
SystemAdmin - Tue Jun 07 09:27:59 EDT 2011

SystemAdmin - Wed May 18 19:41:26 EDT 2011
Louie wrote: "...at one point I had a Macro to copy the current selection, open Notepad, paste, select all, copy, and close notepad without saving"

Alternatively, most Windows applications have a "Paste Special" function which provides the option "Unformatted unicode text" or something similar. This cleans out the RTF real goooood! Pity that DOORS doesn't support this Paste Special option though (a hint for Mr IBM).


Paul Miller
Melbourne, Australia

When I found PureText (http://www.stevemiller.net/puretext/) my life changed :) No more copy formated text, paste to Notepad, copy from Notepad, paste to new application. Just copy, then paste using <Flag>-V!

Re: How to remove an unwanted hanging indent in a column
Bob_Swan - Thu Nov 24 04:54:29 EST 2011

SystemAdmin - Tue Jun 07 09:27:59 EDT 2011
When I found PureText (http://www.stevemiller.net/puretext/) my life changed :) No more copy formated text, paste to Notepad, copy from Notepad, paste to new application. Just copy, then paste using <Flag>-V!

There is also the "applyTextFormattingToParagraph" function, (see the DXL Help).
I have it in a script to remove leading indents after importing. My script includes some logic to check for indents that may need to be kept, (bullets etc) and some other tidy up routines.

Re: How to remove an unwanted hanging indent in a column
Matt_Eng - Thu Dec 04 18:51:48 EST 2014

Peter_Albert - Wed May 18 07:28:18 EDT 2011
If you don't care about rich text formatting at all, and if there are no OLE objects in the Text, i.e. if it is o.k. to just keep the plain text content, then


Object o = current o.
"Object Text" = o.
"Object Text" 
""
removes all formatting, including the hanging indent.

If you want to preserve the rich text formatting which DOORS is able to handle, i.e. bold, underline, bullets, paragraph indent, then there is a kitchen script available which removes all other rich text (i.e. the things DOORS cannot handle).

This script removes OLE objects, but with a few extra lines it can be modified to keep OLE objects. Let me know if you need to preserve existing formatting, then I will post the modified script here.

Regards,

Peter

I am new to DXL and do not know how to get your script to work to remove rich text.  Do you have a link to the other script you mentioned?  I am trying to remove rich text from all object headings.

Thanks

Re: How to remove an unwanted hanging indent in a column
Peter_Albert - Fri Dec 05 10:54:02 EST 2014

Matt_Eng - Thu Dec 04 18:51:48 EST 2014

I am new to DXL and do not know how to get your script to work to remove rich text.  Do you have a link to the other script you mentioned?  I am trying to remove rich text from all object headings.

Thanks

Oh, the forum upgrade a few years ago corrupted the code snippet above. It should read

Object o = current
o."Object Text" = o."Object Text" ""

In your case, it would be

Object o
for o in current Module do {
  o."Object Heading" = o."Object Heading" ""
}

Regarding the other script, the original kitchen script is buried somewhere, but I have attached the one I built for myself around it.  It gives you a dialogue box which allows you show the rich Text Elements of any attribute of the current Object, and to remove any unsupported rich text. Note that this preserves any rich text which is supported by DOORS (bold, italics, etc.) if you want to remove those, then stick to the code snippet above.

Peter

 

 

 


Attachments

exploreRichText.dxl

Re: How to remove an unwanted hanging indent in a column
Tony_Goodman - Mon Dec 08 10:37:46 EST 2014

Matt_Eng - Thu Dec 04 18:51:48 EST 2014

I am new to DXL and do not know how to get your script to work to remove rich text.  Do you have a link to the other script you mentioned?  I am trying to remove rich text from all object headings.

Thanks

There is a little trick if you want to remove all rich text from either Object Heading or Text then you can use the "Toggle Heading and Text" icon.

Just click it twice!

 

This also works with multiple objects selected.

Re: How to remove an unwanted hanging indent in a column
JWiseman - Mon Jan 12 17:29:38 EST 2015

Tony_Goodman - Mon Dec 08 10:37:46 EST 2014

There is a little trick if you want to remove all rich text from either Object Heading or Text then you can use the "Toggle Heading and Text" icon.

Just click it twice!

 

This also works with multiple objects selected.

I like this trick too. Just beware that a long paragraph can get truncated as the Object Heading doesn't allow as much text in it as the Object Text attribute. The good news is that you will get an "Are you sure" prompt if you text is too long.