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: Returning Rich Text In Layout View
Topic Summary: Unwanted RT Markup Returned
Created On: 14-Mar-2005 18:02
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 Wednesday, March 16, 2005 5:22 PM

Answer:
The diff function takes two input Buffers and computes some RTF which describes the differences as redlining. The inputs are treated as plain text, so if you pass in a buffer which is RTF, it just treats it as ordinary text which happens to have a lot of \ and {} characters in it. When it then wraps up the diffs in the RTF markup which describes the additions/deletions, it will escape the \, { and } characters in the original text by putting an extra \ in front of them. This is why you see them even if you use displayRich.

I don't see an easy solution to this. You could try attempting to remove the escape characters in the result string (i.e. look for \\ and replace it with \, so \\par becomes \par and is displayed correctly by displayRich). If you did this blindly, you'd most likely end up with a nested rich text string like
{\rtf1 ... {\rtf1 .....}} where the outer \rtf was generated by the diff function and the inner one was derived from the input. I don't know how well this would display, and I don't know what would happen if the RTF headers in your two inputs were themselves different...

Good luck
Judith
 14-Mar-2005 18:02
User is offline View Users Profile Print this message


Jeremy Eble

Posts: 30
Joined: 20-Sep-2002

I am trying to update some code which pulls object text from two different modules, runs the diff() function on it and puts the result in a column in one of the modules. Originally, any formatting (e.g. bold) was stripped, but now we want to keep it. No matter how I try to grab the original text and how I try to put it in the column with the displayRich function, I keep getting the RT header and /par markup. The underlining and strike throughs from the diff function look fine. Right now, I am still just testing it on plain text, so I don't have the issue of the bolding yet.

To get the richText string (which I am assigning to a buffer) I've tried:
- buf = richTextwithOle(obj."Object Text")
- buf = richTextNoOle(obj."Object Text")
- buf = richText(obj."Object Text")

To return the resulting buffer text I've tried:
- displayRich result
- displayRich stringOf(result)
- displayRich richTextFragment(stringOf(result))
- displayRich richTextFragment(result)

I've probably tried more things than that, but I can't remember them all.

If I get the text back, it invariably begins with some rict text header information, including the font table, and the paragraphs are separated by the /par markup. I'm trying to keep my formatting without seeing the extra markup.

-------------------------
Jeremy Eble
Software Engineer
Teragon Consulting LLC
jeremy.r.eble@lmco.com
Report this to a Moderator Report this to a Moderator
 15-Mar-2005 20:23
User is offline View Users Profile Print this message


Judith Underwood

Posts: 35
Joined: 25-Sep-2002

Answer Answer
The diff function takes two input Buffers and computes some RTF which describes the differences as redlining. The inputs are treated as plain text, so if you pass in a buffer which is RTF, it just treats it as ordinary text which happens to have a lot of \ and {} characters in it. When it then wraps up the diffs in the RTF markup which describes the additions/deletions, it will escape the \, { and } characters in the original text by putting an extra \ in front of them. This is why you see them even if you use displayRich.

I don't see an easy solution to this. You could try attempting to remove the escape characters in the result string (i.e. look for \\ and replace it with \, so \\par becomes \par and is displayed correctly by displayRich). If you did this blindly, you'd most likely end up with a nested rich text string like
{\rtf1 ... {\rtf1 .....}} where the outer \rtf was generated by the diff function and the inner one was derived from the input. I don't know how well this would display, and I don't know what would happen if the RTF headers in your two inputs were themselves different...

Good luck
Judith
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.