![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
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 |
![]() |
![]()
|
![]() 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...) | |
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
|
![]() |
|
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 |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
Exporting imported hidden text to RTF
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.