Topic
  • 6 replies
  • Latest Post - ‏2014-03-14T11:49:25Z by KBSri
bphegstr
bphegstr
1 Post

Pinned topic DOORS ImportRTF function

‏2010-08-02T16:06:33Z |
I am attempting to import RTF files into a DOORS (v8.3) module (v8.3) using a DXL script, but the manual line feeds I want within an object are not being imported correctly. When I import using the File->Import->Rich Text File menu selection, it works properly. I have 405 files to import into a module, so doing it manually is not really an option (and the files are split out that way for a reason, so combining them is not a solution, either). I have posted my DXL script below:
string strCurDir = currentDirectory
string filename = strCurDir "\\SRDREV.LIS"
print "Reading from " filename "\n"
// Loads the contents of SRDREV.LIS into a stream for parsing.
Stream input = read filename
string str // do rest line by line
while (true) {
input >> str // read a line at a
// time
if (end of input) break //If the end of the file, then end.
string strRtfDocName = strCurDir "\\" str //concatinates the name with the path
importRTF(strRtfDocName, (current Module), true, true) // Imports into the current module
}
close input

--Brandon
Updated on 2010-11-26T12:37:50Z at 2010-11-26T12:37:50Z by SystemAdmin
  • Mathias Mamsch
    Mathias Mamsch
    1984 Posts

    Re: DOORS ImportRTF function

    ‏2010-08-10T20:37:00Z  

    The RTF import script is not encrypted. You can find it under dxl/standard/import/rtfim.dxl.

    Looking at it, I see it does a huge amount of preprocessing before really writing the RTF to the object. You not doing preprocessing is probably the reason why you get different results.

    Without knowing the reason for the newline failures I suggest you a different solution. Automate the RTF import script! This can be done the following way:
     

    // redeclare show to just do a realize! 
     
    DB diag = null
     
    void show(DB x) {
       realize x
       diag = x
    }
     
    string files[] = {"C:\\File1.txt", "C:\\File2.txt"}
     
    for i in 0:1 do {
     
    #include <standard/import/rtfim.dxl>
     
    // we can do something with the dialog now! 
    // Set the filename to what we want!
     
    set (impFileName, files[i])
     
    impFileImportCB(diag)
     
    hide diag
     
    }
    

     

     


    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

     

     

    Updated on 2013-12-19T21:44:26Z at 2013-12-19T21:44:26Z by iron-man
  • jpain
    jpain
    3 Posts

    Re: DOORS ImportRTF function

    ‏2010-08-12T17:56:28Z  
    I'm trying to achieve the same thing, only with each RTF imported as its own discrete module. I've tried running the above code (with a dummy rtf file in in the list for the files[] variable) and I get an error from the importif.inc script. "Null module parameter was passed into argument position 1." Not really sure how to approach this.

    Is there another, preexisting way to mass import rtf files? I'd be surprised if bghegstr and myself were the first ones to try.
  • Mathias Mamsch
    Mathias Mamsch
    1984 Posts

    Re: DOORS ImportRTF function

    ‏2010-08-13T19:49:01Z  
    • jpain
    • ‏2010-08-12T17:56:28Z
    I'm trying to achieve the same thing, only with each RTF imported as its own discrete module. I've tried running the above code (with a dummy rtf file in in the list for the files[] variable) and I get an error from the importif.inc script. "Null module parameter was passed into argument position 1." Not really sure how to approach this.

    Is there another, preexisting way to mass import rtf files? I'd be surprised if bghegstr and myself were the first ones to try.
    The above script will import the files into the current Module. You get the "null module" error, because you probably did not run the script from a module. To make it import into several modules, you will need to create a module in the loop, open it, and then call the import script. Regards, Mathias


    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
  • Giancarlo.Sellers
    Giancarlo.Sellers
    1 Post

    Re: DOORS ImportRTF function

    ‏2010-11-26T10:42:02Z  
    Mathias Mamsch wrote:
    The above script will import the files into the current Module. You get the "null module" error, because you probably did not run the script from a module. To make it import into several modules, you will need to create a module in the loop, open it, and then call the import script. Regards, Mathias

    <hr>
    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

    Now I got it, Thanks for your explanation! This is what I'm looking for.
  • SystemAdmin
    SystemAdmin
    3180 Posts

    Re: DOORS ImportRTF function

    ‏2010-11-26T12:37:50Z  
    Mathias Mamsch wrote:
    The above script will import the files into the current Module. You get the "null module" error, because you probably did not run the script from a module. To make it import into several modules, you will need to create a module in the loop, open it, and then call the import script. Regards, Mathias

    <hr>
    Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS

    Now I got it, Thanks for your explanation! This is what I'm looking for.
    I used this script a few times (run DXL on multiple modules). Maybe it helps too.

    http://www.smartdxl.com/downloads/dxltools16.html
  • KBSri
    KBSri
    104 Posts

    Re: DOORS ImportRTF function

    ‏2014-03-14T11:49:25Z  
    I used this script a few times (run DXL on multiple modules). Maybe it helps too.

    http://www.smartdxl.com/downloads/dxltools16.html

    I ran the script in the link it has great GUI to select different modules.

    On the IMportRTF Function part: I made changes and ran the script it worked brilliantly to run in the particular module. It may help!


    pragma runLim,0

    //#include <standard/import/rtfim.dxl>
    Module mod = current

    string strCurDir = currentDirectory

    string strRtfDocName = strCurDir "\\sample.rtf"
    importRTF(strRtfDocName, mod, true, true) // Imports into the current module

    print "Success!!\n"
    infoBox "Success!! Importing successful"