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: 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
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 Daniel Fernández Blanco, on Friday, September 5, 2008 1:25 PM

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.
 2-Sep-2008 16:13
User is offline View Users Profile Print this message


Daniel Fernández Blanco

Posts: 6
Joined: 20-Apr-2005

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.
Report this to a Moderator Report this to a Moderator
 2-Sep-2008 17:57
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

Daniel, I sit here and ponder why you have single cell objects and give up the benefits of object text.

Please enlighten me.
Report this to a Moderator Report this to a Moderator
 3-Sep-2008 12:43
User is offline View Users Profile Print this message


Daniel Fernández Blanco

Posts: 6
Joined: 20-Apr-2005

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.

attachment 1.bmp
attachment 1.bmp  (87 KB)
attachment 2.bmp
attachment 2.bmp  (166 KB)
attachment 3.bmp
attachment 3.bmp  (193 KB)
attachment 4.bmp
attachment 4.bmp  (114 KB)

Report this to a Moderator Report this to a Moderator
 3-Sep-2008 12:52
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

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.
Report this to a Moderator Report this to a Moderator
 3-Sep-2008 16:17
User is offline View Users Profile Print this message


Daniel Fernández Blanco

Posts: 6
Joined: 20-Apr-2005

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?
Report this to a Moderator Report this to a Moderator
 3-Sep-2008 16:22
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

Perhaps this will help: Macros

Edited: 4-Sep-2008 at 13:51 by ron lewis
Report this to a Moderator Report this to a Moderator
 3-Sep-2008 19:07
User is offline View Users Profile Print this message


Octavian Stanescu

Posts: 39
Joined: 28-Feb-2005

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.
Report this to a Moderator Report this to a Moderator
 4-Sep-2008 13:44
User is offline View Users Profile Print this message


Daniel Fernández Blanco

Posts: 6
Joined: 20-Apr-2005

Octavian,

Thanks for your script, I will study it.

Ron,

I could not access to the link, I obtained an error message.
Report this to a Moderator Report this to a Moderator
 4-Sep-2008 13:52
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

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
Report this to a Moderator Report this to a Moderator
 5-Sep-2008 13:25
User is offline View Users Profile Print this message


Daniel Fernández Blanco

Posts: 6
Joined: 20-Apr-2005

Answer 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.
Report this to a Moderator Report this to a Moderator
 8-Sep-2008 08:23
User is offline View Users Profile Print this message


Robert Swan

Posts: 86
Joined: 14-Apr-2005

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
Report this to a Moderator Report this to a Moderator
 9-Sep-2008 17:06
User is offline View Users Profile Print this message


Daniel Fernández Blanco

Posts: 6
Joined: 20-Apr-2005

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.
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.