![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: WEXP: How to export a one cell DOORS table as paragraph Topic Summary: Created On: 2-Sep-2008 16:13 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() Answer: Ron, I have finished my work. I found you can run a macro inside the file wexpinit.inc, before the line where the script takes the final time (just after the process ended). In this place you have yet access to the object objWord. Here is an example: // The function which run the macro (the macro must be present in the word template) void runMacro(OleAutoObj WEXP_objWord, string macroName) { OleAutoArgs autoArgs string errorStatus noError autoArgs = create put(autoArgs, macroName) oleMethod(WEXP_objWord, "Run", autoArgs) errorStatus = lastError if(!null errorStatus) { ack errorStatus } } * * * // My code here if(isDLCModule WEXP_currMod) { runMacro(WEXP_objWord, "TableConverter") } // End of the process Date finTime = today() * * * You can run several macros. Thank for all your advices. Best regards, Ilma Orellana. | |||||||||
![]() |
|||||||||
Dear Fellows,
I have some objects which contains a one cell DOORS table and I want to export them like normal objects in paragraph style. But, despite that I set the attribute "Paragraph Style" as "Paragraph" and attribute "WEXP Export Style" as "Book" in the cells, the exporter creates a table in the Word document. I am working with Doors 8.0 and WEXP 11.4 Any suggestions would be appreciated. Best regards, Ilma Orellana. |
|||||||||
![]() |
|||||||||
![]() |
|||||||||
Daniel, I sit here and ponder why you have single cell objects and give up the benefits of object text.
Please enlighten me. |
|||||||||
![]() |
|||||||||
![]() |
|||||||||
Ron,
I am working with dynamic linked cells (an implementation of virtual objects in DOORS) presented by Michael Sutherland in the Telelogic Americas 2006 User Group Conference. This is the idea: DOORS has the ability to link an object in one module to an object in another module. The text and attributes from the other object can be viewed in a separate column via Layout DXL, but cannot be incorporated into the main column of the DOORS module. A technique called Dynamic Linked Cells allows the addition of Virtual Objects into the main column of a DOORS module. This technique has the following benefits: (1) Cell is automatically updated when the data is changed at the source. (2) Cell appears in main column, and so, data can be exported to Word. (3) Data is mastered in one location and can be referenced in multiple locations. So, Virtual Objects can be created and this objects dynamically update their content by following an out-link to a target object, and copying the data to a DOORS table cell in the DOORS main column. Here is an example: You write a requirement in some Common Requirements module like this: See attachment 1. Then, you insert a Dynamic Linked Cells in all the modules where you need to repeat the requirement and make a link between them. The cell shows a dxl layout and looks like this: See attachment 2. In each source module you have a new object (with their own identifier) which copy the original requirement. The problem is when I export this module. I obtain this: See attachment 3. And I want this requirements look like the others: See attachment 4. I can manage to set the paragraph style and I process the object in order to show the identifier in the end of the line, but I can not avoid the WEXP to create a table in the document. I asked to Michael but he does not use WEXP and could not help me. Sorry for all the attachments, but I did not find how to insert pictures in the message. Thanks and best regards, Ilma Orellana.
|
|||||||||
![]() |
|||||||||
![]() |
|||||||||
One potential solution is to write a word VBA that loops through each table in word document and if it has only one cell, then the VBA converts table to text and formats the text to your desired style.
The vba could be launched by WEXP or initiated manually. |
|||||||||
![]() |
|||||||||
![]() |
|||||||||
I though of that and I wrote this code (which works fine):
Sub TableConverter() Dim ATable As Table For Each ATable In ActiveDocument.Tables If ATable.Rows.Count = 1 And ATable.Columns.Count = 1 Then ATable.Select Selection.Rows.ConvertToText Separator:=wdSeparateByParagraphs, _ NestedTables:=False End If Next End Sub The difficulty is I actually execute a macro after the exportation (for other thing) and it seems that you only can launch only one macro. In the other hand, I want the users do not know about this macro, and the macro should be execute only in some modules (modules sets up for working with DLC). Do you know how I can invoke this macro from WEXP scripts? |
|||||||||
![]() |
|||||||||
![]() |
|||||||||
![]() |
|||||||||
![]() |
|||||||||
Ok, it is very strange why you would use a cell when you can use a regular object.
Here is a better solution: Have all dinamic cells be regular objects with the attribute Object Type set to Virtual. Then link them to the actual objects. Then run this script to update all virtual objects: --------------------------------------------------------- const string HEAD = "Object Heading" const string TEXT = "Object Text" const string PICT = "Picture" const string OT = "Object Type" void copyStandardAttr(Object tgt, Object src) { set(tgt.HEAD, src.HEAD) set(tgt.TEXT, src.TEXT) set(tgt.OT , src.OT) bool hasPicture = src.PICT if(hasPicture) { copyPictureObject(src, tgt) } } void updateContent(Module m) { ModuleVersion tgtVersion Module tgtModule Object t Object o for o in entire m do { if(o.OT "" == "Virtual") { Link l for l in all(o->"*") do { tgtVersion = targetVersion l if(null module tgtVersion) continue if(isDeleted module tgtVersion) continue t = target l if(null t) { tgtModule = read(fullName tgtVersion, false) if(isBaseline tgtVersion) { tgtModule = load(tgtModule, baseline tgtVersion, false) } } t = target l if(null t or isDeleted t) continue copyStandardAttr(o, t) } } } refresh m } updateContent current Module ------------------------------------------------------------------------- You can have whatever other attributes you will like, including paragraph style, with this method. And you can expand this script to handle different type of objects, and of course can be setup as a trigger also. |
|||||||||
![]() |
|||||||||
![]() |
|||||||||
Octavian,
Thanks for your script, I will study it. Ron, I could not access to the link, I obtained an error message. |
|||||||||
![]() |
|||||||||
![]() |
|||||||||
Try link now -- it should work.
If not, cut and paste this into your browser: https://forum.telelogic.com/customer/doors/messageview.cfm?catid=17&threadid=9428&highlight_key=y&keyword1=macro |
|||||||||
![]() |
|||||||||
![]() |
|||||||||
Ron,
I have finished my work. I found you can run a macro inside the file wexpinit.inc, before the line where the script takes the final time (just after the process ended). In this place you have yet access to the object objWord. Here is an example: // The function which run the macro (the macro must be present in the word template) void runMacro(OleAutoObj WEXP_objWord, string macroName) { OleAutoArgs autoArgs string errorStatus noError autoArgs = create put(autoArgs, macroName) oleMethod(WEXP_objWord, "Run", autoArgs) errorStatus = lastError if(!null errorStatus) { ack errorStatus } } * * * // My code here if(isDLCModule WEXP_currMod) { runMacro(WEXP_objWord, "TableConverter") } // End of the process Date finTime = today() * * * You can run several macros. Thank for all your advices. Best regards, Ilma Orellana. |
|||||||||
![]() |
|||||||||
![]() |
|||||||||
Make the Macro you invoke after export just a shell invoking a list of other macroes.
e.g. Sub A_Post_Export_Setup() ' Update_Properties Update_Fields Size_All_Tables Size_All_Figures Update_Indexes Final_Tidy End Sub |
|||||||||
![]() |
|||||||||
![]() |
|||||||||
Dear Robert,
Thanks for your suggestion, but I can not do that because I run the macros depending on the Word version installed or some settings in the module. It is easier to check it in the WEXP. |
|||||||||
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.