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: Exporting imported hidden text to RTF
Topic Summary:
Created On: 26-Nov-2003 14:51
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 Paul Tiplady, on Thursday, November 27, 2003 3:23 PM

Answer:
I've fixed it with a big hammer. Basically I check the richTextWithOle string for any occurrence of the 'start of hidden text' marker (\\v or \\v1) and strip out everything from there to the 'end of hidden text' marker (\\v0), wiping out both markers in the process.

The code looks like below (it may not be the quickest, but it works...)
 26-Nov-2003 14:51
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

I've created a dxl script that uses a common formal module to define the layout of an exported file, and then exports the current module as an RTF file and opens Word to view/print it. It handles pictures (mostly), rich text in objects, OLE objects, tables, multiple attributes in the view and is way quicker (and neater) than the Word exporter. So far so good. The problem is, it gets all confused when the object (or attribute) it's trying to export contains hidden text. Checking out the rich text for the object, there are \\v and \\v0 pairs in there, and attempting to extract the rich text chunks with a nested for loop (see below) leaves me with at best part of the unhidden text, and usually nothing.

I know the Word document that was imported should have had the hidden text deleted first, but it didn't (they were well down the document).

What it comes down to now is, does anybody have any experience with corrupted chunking of rich text, and is there a way around it?

Cheers chaps and chapesses,
Paul.



-------------------------


Paul dot Tiplady at TRW dot com
TRW Automotive
Report this to a Moderator Report this to a Moderator
 26-Nov-2003 15:47
User is offline View Users Profile Print this message


Dennis Lockshine

Posts: 113
Joined: 7-Apr-2003

Paul,

If you capture the current object text in a buffer, you can call the attached DXL function to reformat the rich text into a valid string that should not cause your RTF file to have invalid characters.

The function will work with DOORS 6, but because of bugs introduced in the rich text processing, you may get unexpected results. The function works fine with DOORS 5 and DOORS 7.

I am very interested in looking at your program and seeing how it works.

-Dennis
Report this to a Moderator Report this to a Moderator
 26-Nov-2003 16:04
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

Thanks for that Dennis. But that's the bit I can do. I didn't want to clog the post with the entire function I'm using, but what the heck, it's just down there... And I'm doing things in quite such a convoluted manner because it's the only way I can guarantee to extract all the pictures (and make them fit in the page/table I'm exporting to), and get the rich text out correctly.

The print commands are not normally there, they just aid debugging at the moment (although with 1300+ objects in the module, they're not actually that helpful!).

The problem comes when the rich text contains the 'hidden' marker (\v to turn on, \v0 to turn off). When these are encountered, the export of the object falls over. It doesn't ripple beyond the current object, but there are gaps in the exported document.

Ooh. I wonder. Having just attached the code below, and checked through it to make sure I'm not revealing trade secrets anywhere, I'm wondering whether my 'escape_it' function is messing things up. I'll try that and see what happens... [Edit: not causing any problem] In the meantime, any further advice will be appreciated.

Ta,
Paul.

[Edit]Debug output added...


-------------------------


Paul dot Tiplady at TRW dot com
TRW Automotive

Edited: 27-Nov-2003 at 15:26 by Paul Tiplady
Report this to a Moderator Report this to a Moderator
 27-Nov-2003 15:23
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

Answer Answer
I've fixed it with a big hammer. Basically I check the richTextWithOle string for any occurrence of the 'start of hidden text' marker (\\v or \\v1) and strip out everything from there to the 'end of hidden text' marker (\\v0), wiping out both markers in the process.

The code looks like below (it may not be the quickest, but it works...)

-------------------------


Paul dot Tiplady at TRW dot com
TRW Automotive
Report this to a Moderator Report this to a Moderator
 1-Dec-2003 15:43
User is offline View Users Profile Print this message


Dennis Lockshine

Posts: 113
Joined: 7-Apr-2003

Paul,

Now I see what you're trying to accomplish...

I took the liberty of writing this short function that will perform
the same action of removing everything between \\v and
\\v0 and also between \\v1 and \\v0. You need to pass in
a Buffer, but we all know strings and preserving memory
don't mix very well. Speed will be greatly improved over
the version you wrote, mainly because I don't use the sub-
string operator (buf[start 1:end1]) on the buffer.

Good luck. If you can post the RTF generator, I would
still love to try it out.

-Dennis
Report this to a Moderator Report this to a Moderator
 1-Dec-2003 16:04
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

Thanks Dennis. That's close, but it won't quite always work. You can't guarantee the space after the \\v1 or the \\v0 -- either could also be followed by a trailing brace ('}'), or even (legally, but not practically) the trailing 1 or 0 could be followed by regular text. However, I note the use of the combine function, which as a beginner I will put to use rather than the assignment to buffer using range, and I appreciate the time you've taken to point me down a faster path. I should be able to speed up my utility now.

As to posting it, I'll consider the request. I may have to do some further work to make it globally useable...

-------------------------


Paul dot Tiplady at TRW dot com
TRW Automotive
Report this to a Moderator Report this to a Moderator
 4-Dec-2003 11:12
User is offline View Users Profile Print this message


Paul Tiplady

Posts: 176
Joined: 28-Oct-2003

Just stumbled across another DXL function that might do the job for me:

string removeUnlistedRichText(string s)

Might try it (although my script is not currently broken, so I'm tempted not to fix it!).

-------------------------


Paul dot Tiplady at TRW dot com
TRW Automotive
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.