Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: RichText and OLE
Topic Summary:
Created On: 2-Mar-2005 05:35
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Judith Underwood, on Friday, March 11, 2005 4:49 PM

Answer:
You could search for the RTF markup for the objects themselves in your source string -- they will start with {\object (or possibly {\pict if they are static objects). You could find the beginning with a regular expression, but you would probably have to search for the matching closing brace yourself to make sure the braces balanced. Then you could add the object as RTF to the plain text in the appropriate place.

You might want to try building your final string as rich text, ie. beginning it with "{\rtf1" and ending it with "}". This would give you more control over newlines (you'd generate them with "\par") and whitespace shouldn't be a problem.

Judith

PS .. and while I was writing that reply, Jonathan Marshall posted a script which does exactly what I suggest.
 2-Mar-2005 05:35
User is offline View Users Profile Print this message


Chun Ho

Posts: 6
Joined: 21-May-2004

I have a rich text string in a Text attribute that contains both RTF text and OLE items. What I would like to do is to remove the RTF formatting (bold/italics/etc) from the text while retaining the OLE items.

However "for rt in string" does not appear to allow changing of the Rich Text (query only) and it also does not return the tagged chunk in RTF format for me to construct a RTF string with only the OLE objects tagged.

Another solution would be to just get the plain text from the Text attribute and then use oleCopy/olePaste to re-insert the OLE items after. However, I am looking to preserve the position the OLE items were stored in the Text attribute, and am facing difficulties doing so when using oleCopy/olePaste.

Does anyone have a better idea? Thanks in advance!!

Report this to a Moderator Report this to a Moderator
 3-Mar-2005 23:08
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

Select an object with Text and at least one OLE. Then run the attached DXL. It should get you started pretty well.

But WAIT!!! Doors v6 introduced a bug where "rt.newline" always returned true for the last RT chunk, even if it didn't have an EOL at the end. You may need to use "for RichTextParagraph Text" followed by rtp.text separated by EOLs, but then you cannot use get the OLEs.

So I'd use RichTextParagraphs to build the text only to find out if there is a trailing EOL. Then use the RichText chunks above to build your string, and remove a trailing "\n" of the RTP didn't have one; Yuuuck, good luck.

function to strip the Raw text from a richtext string:
string EOL = ""
for rtp in Text do
{ buffRaw += EOL
buffRaw += rtp.Text
EOL = "\n" // puts EOL before additionalRTP chunks
}
TextRaw = stringOf(buffRaw)

- Louie
Report this to a Moderator Report this to a Moderator
 7-Mar-2005 05:45
User is offline View Users Profile Print this message


Chun Ho

Posts: 6
Joined: 21-May-2004

Thanks a lot Louis, your sample code really helped!!!!

I have modified the code and come up with the following, which may be easier to describe what I am trying to do here. I am trying to copy a Text attribute from one object to another, but when copying I want to keep OLE items where they are and throw out any other RTF formatting.

There are still a few quirks - like the plain text version of the two objects (source and destination) may not match up exactly, with some extra spaces and newlines. This may be due to how I am concatenating rich text information chunks together.

Would appreciate any other ideas you have
Report this to a Moderator Report this to a Moderator
 7-Mar-2005 10:42
User is offline View Users Profile Print this message


Jonathan Marshall

Posts: 27
Joined: 10-Apr-2003

I have extended a script from Galactic Solutions which removes embedded rich text problems so that it can handle objects containing OLEs. As it stands it will leave simple rich text such as bold, italic, etc alone but you could easily modify it to remove these by clearing the corresponding markupPrefix and markupSuffix variables. You would probably want to also remove the section following rtfParaCount++ which deals with bullets and indents.

Jon




-------------------------
Jonathan Marshall
EADS Astrium
Report this to a Moderator Report this to a Moderator
 7-Mar-2005 10:45
User is offline View Users Profile Print this message


Judith Underwood

Posts: 35
Joined: 25-Sep-2002

Answer Answer
You could search for the RTF markup for the objects themselves in your source string -- they will start with {\object (or possibly {\pict if they are static objects). You could find the beginning with a regular expression, but you would probably have to search for the matching closing brace yourself to make sure the braces balanced. Then you could add the object as RTF to the plain text in the appropriate place.

You might want to try building your final string as rich text, ie. beginning it with "{\rtf1" and ending it with "}". This would give you more control over newlines (you'd generate them with "\par") and whitespace shouldn't be a problem.

Judith

PS .. and while I was writing that reply, Jonathan Marshall posted a script which does exactly what I suggest.

Edited: 7-Mar-2005 at 10:54 by Judith Underwood
Report this to a Moderator Report this to a Moderator
 18-Aug-2006 10:01
User is offline View Users Profile Print this message


Bruce Tuskey

Posts: 77
Joined: 2-Mar-2004

The DXL seems to be gone from the forum. Could you repost?

-------------------------
Bruce Tuskey
Sr. Principle Engineer
Tuskey@gmail.com

"All that is gold does not glitter, not all those who wander are lost:..." - Gandalf the Grey (JRR Tolkien)
Report this to a Moderator Report this to a Moderator
 30-Aug-2006 21:50
User is offline View Users Profile Print this message


Michael Sutherland

Posts: 248
Joined: 13-Sep-2002

Bruce,

Thee DXL is available here

-------------------------
Michael Sutherland
michael@galactic-solutions.com
http://galactic-solutions.com
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 0 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 0 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.