![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
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 |
![]() |
![]()
|
![]() |
|||
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
|
|||
![]() |
|||
![]() |
|||
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? |
|||
![]() |
|||
![]() |
|||
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.)
|
|||
![]() |
|||
![]() |
|||
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
|
|||
![]() |
|||
![]() |
|||
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 |
|||
![]() |
|||
![]() |
|||
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
|
|||
![]() |
|||
![]() |
|||
Thanks! This looks great. I'm going to play with it and see what I can do with it!
Mike
|
|||
![]() |
|||
![]() |
|||
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
|
|||
![]() |
|||
![]() |
|||
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. |
|||
![]() |
Telelogic DOORS
» DXL Exchange
»
Word Automation and DXL
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.