Home Search

DriveWorks Pro 22
Word Document

Send Feedback

Word Document

This Document type is used to export data directly in to a Microsoft Word Document from the DriveWorks Project.

DriveWorks can attach to and extract bookmarks in a Word Document which can then be driven using rules.

Word
Document

DriveWorks can use .doc, .docx and .docm files.

Files saved as an .docx are the quickest to generate as DriveWorks does not need to open Word.

To Add A Word Document:

In DriveWorks Administrator open the Project the Document is to be add to and go to Stage4: Output Rules then Documents - Files

  1. Click the "Add" button on the command bar.
  2. Choose the Word Document from the list on the Add Document wizard.
  3. Give the new Document a name.
  4. Click "Next" and browse for the master Word Document, click "Open" and "Finish".

To Edit A Word Document:

  1. The Master Word Document Path is the location of the Word Document. If the location of the Document changes then it will need re-browsing to using the "Browse..." button.
  2. The Document Name is the name given to the newly created Document. Click the "Build..." button to give the Document a name.
  3. The Document Path is the location where the driven Document will be stored. Click the "Build..." button to set the Document Path.

    Please see Info: Where To Store DriveWorks Data for information on where to store the data associated to a DriveWorks implementation.

  4. To build a rule for a bookmark select a bookmark from the list and click the "Build..." button. If no bookmarks are present but the Document contains them click the "Refresh" button.
  5. The newly created Word Document can be created as a HTLM file, by checking the HTML Output option. This will enable the Document to be opened within a web browser.

    When using DriveWorks Live

    When creating HTML files ensure the created document is located in its own folder so access is only provided to the files used in the resulting document.

    Microsoft Excel and Word Document Generation

    Ensure the projects being specified through DriveWorks Live have any Microsoft Excel or Word documents generated by an Automatic State in the Specification Flow. This will allow these documents to be created by DriveWorks Autopilot and not DriveWorks Live (which it will not be able to do when running as a service through IIS).

    Services do not have access to many programs, especially COM programs such as Microsoft Word and Excel

    To maximize performance and for the best user experience, we recommend that as much processing as possible happens when in an Automatic state (Since the processing will be performed by DriveWorks Autopilot).

  6. The Document can also be hidden from the Document List in the Specification Explorer by checking the Hide from Document List option.

The Document can be Deleted if it is not required by making the result of the Document name return Delete.

The Document Name will need to be unique if the Document is created in the same location for each Specification, otherwise existing Documents will be overwritten.

If the Document Path is not set then the file will be created in the Specification folder.

At any point a HTML preview can be created by clicking the "Preview" button on the command bar.

How To Create A Bookmark In Word:

  1. Open the Word Document and highlight the section of text which is to be driven.
  2. Click Insert and click Bookmark from the list. This will link the bookmark to the text.
  3. Give the bookmark a unique name and click "Add".
  4. Save and close the Document.

When highlighting the text do not include spaces at the start or at the end of the text as this will result in the driven text merging with the static text.

To be able to drive Bookmarks for Headers or Footers you will need to make sure that the Word document is saved as .doc file. Bookmarks in Headers and Footers is not currently supported for .docx files.

Show Bookmarks

Once a bookmark has been created it may be difficult to see where the reference was made.

To display bookmarks select:

File > Options > Advanced tab

Under show document content > Show bookmarks

The bookmark will be displayed within [bookmark name] brackets.

Drive Arrays Into Tables In Word Document

Data arrays can be driven into tables in Microsoft Word Documents.

When a bookmark exists in a cell of a table (in Word), and the rule applied to the captured bookmark results in a data array, DriveWorks will drive each cell in the table to the corresponding value in the array.

If a bookmark is outside of a table, but has an array value applied, then this bookmark will be not be driven.

If a bookmark is within a table, but does not have an array value applied, then this value will be driven as normal into one cell.

Behavior

Bookmarks in Table cells will be driven slightly differently, depending on whether the bookmark is in a single cell, or if it spans multiple cells.

Single Cell Bookmark

If a bookmark is placed in a single cell then DriveWorks will:

  1. Drive from that cell until the end of the table.
  2. DriveWorks will only drive from the column/row the bookmark is in, onwards.
  3. DriveWorks will never add columns. If there are more columns in the array than in the table, DriveWorks will not drive the surplus array values into the table.
  4. DriveWorks will add rows. When the array data has more row values than the table has, rows will be appended to the table.
  5. Any existing data, in the driven cells, will be overwritten.

Multiple Cell Bookmark

Bookmarks that span multiple cells can be created in Word. If this is the case then we will:

  1. Drive from the cell that the bookmark starts in, until the cell it ends in.
  2. Drive from the column/row that the bookmark starts in, until the column/row the bookmark ends in.
  3. DriveWorks will never add columns. If there are more columns in the array than in the table, DriveWorks will not drive the surplus array values into the table.
  4. DriveWorks will insert rows. When the array data has more row values than the bookmark spans in the table, rows will be inserted after the row that the bookmark ends in.
  5. This means any rows below the bookmark end point will maintain any previous data.
  6. Any existing data, in driven cells, will be overwritten.

Preserving Formatting

To preserve any formatting applied to a table it is important to understand the Document Generation Types that DriveWorks uses.

There are two methods of driving Word documents:

  1. Through the Microsoft Word application (.doc files).

    This also applies to:

    • Previewing
    • Creating HTML File
    • Creating PDF File
  2. Using OpenXML (.docx and .docm files).

Table formatting is preserved when Documents are generated using the OpenXML method only.

Macro enabled Documents (.docm files) are driven using OpenXML and then opened in the application to run the macro. This is to maintain as much table cell formatting as possible.

The legacy .doc file format contains very little formatting information. This means that if there is more data in the array than there are rows in the table, those rows may not maintain the formatting that is expected. For example, adding rows into a table that has alternating row colors will cause a new row to be added with the same row color as the previous one.

Previewing a .docx file, which uses the same Document generation type as a .doc file, maintains alternate row colors. This is due to the .docx file format containing the required formatting information.

To have the best chance of preserving formatting it is recommended to either use a .docx or .docm file, or make sure there are enough rows for your data in the table in Word.

Overlapping Bookmarks

Overlapping bookmarks can be created in Word Documents. Although they will still be driven, it is not a supported scenario in DriveWorks and therefore the result may differ between the two Document generation types.

An entry into the specification report will be added if an overlapping bookmark is encountered when generating the Document through the Word application.

The scenario can arise where an overlapping bookmark is being found but there are no visibly overlapping bookmarks in the Document. This is a known issue with Word Documents reporting intersecting bookmarks incorrectly.

If this is the case, the entry in the report will detail the bookmarks that overlap. The recommended solution is to ensure that just the text that is to be replaced has been highlighted when creating the bookmark and not the whole line.

Running Macros On A Word Document

DriveWorks will automatically execute a macro called CreateReports, after driving all the captured cells and prior to the new Document being saved.

The CreateReports macro must exist in a module named DriveWorks, in the VBA Project for the Document.

The Word Document is triggered in the Specification Flow by the Release Documents task.