![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: RichText and OLE Topic Summary: Created On: 2-Mar-2005 05:35 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() 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. | |||
![]() |
|||
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? ![]() |
|||
![]() |
|||
![]() |
|||
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 |
|||
![]() |
|||
![]() |
|||
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 ![]() |
|||
![]() |
|||
![]() |
|||
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 |
|||
![]() |
|||
![]() |
|||
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 |
|||
![]() |
|||
![]() |
|||
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) |
|||
![]() |
|||
![]() |
|||
Bruce,
Thee DXL is available here ------------------------- Michael Sutherland michael@galactic-solutions.com http://galactic-solutions.com |
|||
![]() |
Telelogic DOORS
» DXL Exchange
»
RichText and OLE
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.