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 to String conversion (and OLE iconic)
Topic Summary:
Created On: 2-Aug-2004 20:50
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.
 2-Aug-2004 20:50
User is offline View Users Profile Print this message


Alan Wong

Posts: 11
Joined: 2-Aug-2004

I used richTextWithOle(o."Attribute") to grab a string that contained the richtext representation of an object, with the OLEs. I then use "for richtext in string do{}" to cycle through the string and return richtext chunks each loop. However, how would I access the string representation of each richtext chunk? The stringOf() function does not want to take the richText chunk as an argument, and it doesn't even take a string as an argument either. It does however seem to take richText(string) as an argument, but the odd thing is that richText(string) already returns a string. But if richText(string) returns a string, and stringOf() can take it as an argument, why can't it also take a regular string as an argument? Of course, stringOf(richText(string)) is also rather redundant.

So does there exist some function that will take richText from "for richText in string do{}" and return the string representation of the richText verbatim (tags and OLE hex data and everything else)? If there isn't, how would this be done without creating a new attribute and pasting the richText there only to extract it with another richTextWithOle(o."Attribute").

Also it has come to my attention that there doesn't seem to exist a simple function that checks if an OLE is iconic or not. I'm curious if anyone else has noticed this. I do have a solution, but without a simple RichText to String conversion, it will be slightly difficult to include into my current code, since there would be two conflicting loops (one using a regex to loop through the object and one using the for richtext in string do to loop through the object).

Edited: 2-Aug-2004 at 20:53 by Alan Wong
Report this to a Moderator Report this to a Moderator
 4-Aug-2004 15:01
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

After a "for rt in string do" loop, get the raw test with RawText = rt.text. And if all you are interested in is the raw text then I'd use the richTextNoOle command to save a little time.

Its a little better to use the RichTextParagraph function: for rtp in string do; RawText = rtp.txt. This works since the paragraphs are always separated by a Carridge Return. Consider the attached function "fStripRT" to extract the exact raw text from a v6 or better rich text string. It won't work in v5.

- Louie
Report this to a Moderator Report this to a Moderator
 4-Aug-2004 20:28
User is offline View Users Profile Print this message


Alan Wong

Posts: 11
Joined: 2-Aug-2004

"richText.text" only returns the text contained in the richText chunk. I need some way to grab all the tags and hex code as well as the text, just as richTextWithOle() allows you to do the same thing but for an entire attribute. The reason for this is so I can do looping based on the tags and hex code.
Report this to a Moderator Report this to a Moderator
 4-Aug-2004 23:02
User is offline View Users Profile Print this message


Louie Landale

Posts: 2070
Joined: 12-Sep-2002

The rich text chunks are not "sequencial" in the way you suggest. The tags for chunk #2 may be defined in chunk #1, such as if you start a BOLD chunk and then embed an italic chunk before ending the bold chunk.

You can query the chunk with the "rt.bold" and "rt.strikethrough" etc. commands, but that will ingore all the other non-standard stuff in the chunk; such as whether it has an OLE diagram.

Doesn't look hopeful, and even if it is it isn't going to be easy.

- Louie
Report this to a Moderator Report this to a Moderator
 5-Aug-2004 01:10
User is offline View Users Profile Print this message


Alan Wong

Posts: 11
Joined: 2-Aug-2004

Luckily, whether a chunk is nested or not won't be a problem in my case. Basically the reason I need to be able to somehow do this is for determining if an OLE is iconic or not. As far as I know, there doesn't seem to be a function in 7.0 that can quickly determine this. What I found was that the hex code in the rtf (the data after the /result tag) changes only in specific places if its iconic, and is very different from a non iconic.

However, I do another check through OLEs, using "for RichText in String do", while I run through the entire string with a regex. If I can convert the chunk into a string directly, I can cut the loop into just one (loop through chunk, do check one, use regex on chunk for check two).
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 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 1 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.