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: Word Automation and DXL
Topic Summary: Accessing Word Template Header/Footer sections in DXL
Created On: 25-May-2005 01:59
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.
 25-May-2005 01:59
User is offline View Users Profile Print this message


Mike Klaene

Posts: 6
Joined: 24-May-2005

I've seen some samples of using MS Automation with Excel. Can't say I have fully digested them yet, but I wanted to know if there are limits to what you can do via Automation? Specifically, I really need the ability to access Word, create a document based upon an existing template, export a Module to this document, *then* modify the header and footer with information mined from various Doors objects. It's the last piece that has me stumped. Using Automation in my DXL (oWord = GetObject(, "Word.Application")....), Can I achieve something like modifying header/footer sections? I'd prefer not to do this in VBA. Any feedback is greatly appreciated. Thanks, Mike
Report this to a Moderator Report this to a Moderator
 25-May-2005 07:22
User is offline View Users Profile Print this message


Triet Truong

Posts: 4
Joined: 26-May-2004

I've asked Telelogic support the same question.
I too would like to automate the process of producing documents.
Here is an extract of the email I sent to Teleogic Support in Australia:

"When we create documents, we have to run Create Custom Report 3 times. Once for the title page, once for the header and once for the body of the document. When creating custom report for each of the 3 parts of the doument, we have to manually place the cursor at the correct position, choose the project, the module, the template to use and then click run. As you can imagine, for lots of documents, this takes some time. For example, it took me 2 hrs the other day to create 6 documents, and that is with me being familiar with the process and using a powerful machine. Is there a way to create a complete document in one hit? which includes title page, header footer and body? Is there a way to create documents in batches? through scripting perhaps? or through VBA macros (since DocExpress is integrated with word)?"

Anyone else having the same issues?
Report this to a Moderator Report this to a Moderator
 25-May-2005 08:09
User is offline View Users Profile Print this message


Robert Swan

Posts: 86
Joined: 14-Apr-2005

My (convoluted) way of setting up nheader/footer data is to export the required information to the target document, then from there run a macro to copy the information to document property fields, (then delete the text info if not needed again). The header and footer are set up to use the property fields. ( I also use WEXP which handles the open template and export data parts of the task.)
Report this to a Moderator Report this to a Moderator
 25-May-2005 13:29
User is offline View Users Profile Print this message


Mike Klaene

Posts: 6
Joined: 24-May-2005

Thanks for the replies. Not sure I entirely understand the custom report approach, but it seems cumbersome and far from ideal anyway. A little more background on my problem: My client has a header and footer than must accompany every report they print out of DOORS, and it contains both static and non-static data (which will come from data inside of DOORS). Today, they export to Word -using a specified template, then they must manually populate the header and footer in Word with the DOORS data they need, then they print to PDF. They ideally would like to automate the modifying of the header/footer, and possibly even do away with Word entirely (and print directly to PDF). My first thought was to write a DXL script to modify the header/footer data (by building a string with static/non-static data) of a PageLayout, essentially moving the header/footer from Word to DOORS. I was dismayed to discover that there is only a limited amount of things you can do here. For example, I could not discover how to add bold text, new line characters, etc., it would only take simple unformatted text and the DOORS-provided '&' codes. I never read any documentation that said I couldn't do this (ie. add \\n, \\b to PageLayout header/footer text), I simply gave up after repeated tries of doing so. My next thought was to have DXL write some kind of properties file, which a VBA macro would then use to replace the dynamic data holders in the Word header/footers with values from the properties file. The downside here is that they must still use Word in the process *and* everyone user must have this macro. My final thought was to somehow use MS Automation to modify the header/footer of a Word document but I don't know if I can even do something like that via DXL - the big benefit with this approach over the last would be that I wouldn't need a VBA macro. But again, I don't know if I can do anything like this via DXL. I need to come up with the best approach real soon, so if anyone has any ideas, I'd really appreciate them. Thanks, Mike
Report this to a Moderator Report this to a Moderator
 25-May-2005 15:13
User is offline View Users Profile Print this message


Martin Hunter

Posts: 86
Joined: 10-Jan-2005

My solution has been to export the required header/footer details into Word with a specific paragraph style, eg header1, footer1 into the main body of the document. To populate the header and footer with this information I use the styleref field in the header and footer of the Word template to call up the relevant paragraph style.

I also use WEXP to automate the whole document production process.

-------------------------
- Martin
Report this to a Moderator Report this to a Moderator
 25-May-2005 16:44
User is offline View Users Profile Print this message


Judith Underwood

Posts: 35
Joined: 25-Sep-2002

Here's some DXL for modifying Word headers using Automation from DXL. You can do something similar for footers. I think I posted this on this forum some time ago, but I'm getting an error when I try to view the thread.

It's not pretty, but that's mostly the fault of the Word object model.
-Judith


Report this to a Moderator Report this to a Moderator
 25-May-2005 18:45
User is offline View Users Profile Print this message


Mike Klaene

Posts: 6
Joined: 24-May-2005

Thanks! This looks great. I'm going to play with it and see what I can do with it! Mike
Report this to a Moderator Report this to a Moderator
 25-May-2005 20:24
User is offline View Users Profile Print this message


Mike Klaene

Posts: 6
Joined: 24-May-2005

Hi Judith, I've tried running your script. Looks like it might do what I want. However, I'm curious about your comment about the Word object model. I confess I'm very new to Automation, but I believe I should be able to add styles,etc. to the heading and footer after I write to it. However, I tried adding the line: olePut(objRange,"FontStyle","Bold") right after(and before) I assign text to the objRange and nothing happens(ie text appears, but not bold). I'm sure I'm just doing something wrong, I would think its possible to add rich text. Any ideas? Thanks, Mike
Report this to a Moderator Report this to a Moderator
 1-Jun-2005 22:11
User is offline View Users Profile Print this message


Judith Underwood

Posts: 35
Joined: 25-Sep-2002

The Range object doesn't have a "FontStyle" property (at least not in the version of Word VBA I have).

It does have a "Bold" property, so to set the whole thing bold you can add
olePut(objRange, "Bold", true)
to the original DXL.

The Range Object is documented here in MSDN.
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.