Word add-in - calculation reports in Word
The Struct4U Word add-in puts an XFEM4U calculation report straight into a Word document. You drop a saved model onto the Calculations pane, XFEM4U calculates it in the background, and the report is inserted at the cursor as a linked block. When the model changes later, the block can be brought up to date in place - the surrounding text, the page numbering, and any cross-references pointing into the report all stay as they were.
The add-in is shared by the whole Struct4U family. Besides XFEM4U models (.xfem, and the older .xfr3) it accepts XFrame2D (.xfr2), XBeam2D (.xbe2) and XConstruct (.xcst) models, so one Word document can hold reports from several programs.
The short video below shows a report being inserted. It uses an XFrame2D model; XFEM4U models work the same way.
Requirements
- Microsoft Word for Windows (the desktop version; Word on the web and Word for Mac cannot load it).
- XFEM4U 2027.5 or later. The
/reportbatch mode the add-in drives arrived in 2027.5. An older XFEM4U is refused with a message naming the version needed, rather than being started and left to time out. - A valid XFEM4U licence. The calculation is a normal XFEM4U run and is licensed as one.
- .NET Framework 4.8 and the Visual Studio 2010 Tools for Office Runtime. Both are installed by the XFEM4U installer if they are missing.
Installation
The add-in is part of the XFEM4U installation, as the Word Add-in feature. It is installed into a shared folder, C:\Program Files (x86)\Struct4u\Word Add-in, rather than into the XFEM4U program folder: XFrame2D, XBeam2D and XConstruct install the very same files there. Windows keeps one copy however many Struct4U programs you install, and removes it when you uninstall the last of them.
Word loads it for every user on the machine, under the name Struct4U Calculations. You can see it in Word under File > Options > Add-ins.
The Struct4U tab in Word
After installation Word has an extra ribbon tab, Struct4U, with two buttons:
- Calculations - shows or hides the Calculations pane. The pane is hidden every time Word starts, so this is how you open it.
- Info - the add-in version, and a list of the Struct4U calculation programs found on the machine with, for each of them, whether it can produce reports. This is the quickest way to check whether your XFEM4U is new enough.
The Calculations pane
The pane docks at the right-hand side of the Word window and holds three things:
- The drop zone at the bottom - Drop your models here. Drag one or more models onto it to insert their reports.
- The block list - one row per report block in the document, in document order, with the Model it came from and its State.
- The toolbar - six buttons: Insert..., Edit, Delete, Unlink, Update and Update all. The buttons show icons only; hover over one to see its name.
Inserting a report
- Open or create the Word document and put the cursor where the report should go.
- Open the Calculations pane with Struct4U > Calculations.
- Drag the model file onto the drop zone, or use Insert... to pick it from a file dialog.
XFEM4U is started in the background, calculates the model and writes the report; the report is then inserted at the cursor. A progress dialog with a Cancel button is shown while this runs, so you can stop a calculation that is taking too long. Stopping changes nothing in the document.
Several models dropped at once become several blocks, inserted in the order you dropped them. The insertion point is always the cursor, not the place in the page where you let go of the mouse.
Only one calculation runs at a time. Starting another while one is busy is refused with A calculation is in progress. Wait for it to finish.
What is in the report
The report is exactly the DOCX output XFEM4U itself produces, and it contains what the model's own output selection asks for - page header and footer, table of contents, drawing, layers, 3D views, and the result tables. See Output selection.
The add-in does not ask what to include: it uses the selection stored in the model. To change what a report contains, open the model in XFEM4U, set the output selection the way you want it, save the model, and update the block.
Keeping reports up to date
Every block remembers which model it came from and a fingerprint of that model's contents. Whether a report is still current is decided by that fingerprint, never by a file date - a model can be saved without anything in it changing, and a model can change without its date being helpful.
The State column says where each block stands:
| State | Meaning |
|---|---|
| Up to date | The report matches the model as it is now. |
| Out of date | The model has been changed since the report was inserted. |
| Model missing | The model file is no longer where the block recorded it. |
| Model locked | The model file is there but cannot be read - it is open elsewhere, or you have no access to it. |
| Needs attention | The block and its record no longer belong together. Almost always a report block that was copied and pasted inside Word: only the original can be updated, and the copy keeps the numbers it was pasted with. |
There are three ways a block is brought up to date:
- Update recalculates the selected block; Update all recalculates every out-of-date block in the document at once.
- Opening the document - if it holds out-of-date reports, Word asks once, naming the file and the number of blocks: 1 calculation in hal.docx is out of date. Update it now? Answering No leaves the document exactly as it was. Nothing is ever refreshed silently: a report that has been checked and signed must not change under its author.
- Editing the model - see below.
A refresh replaces the contents of the same block, so bookmarks and cross-references that point into a report survive it. If a refresh cannot finish, the existing report is left as it was rather than being blanked. When it does finish, the pane says how many blocks it updated, and names any it could not reach.
Editing, deleting and unlinking
- Edit opens the selected block's model in XFEM4U. Close XFEM4U again and the block is recalculated if you changed the model, and left alone if you did not. Double-clicking a row, or pressing Enter on it, does the same.
- Delete removes the block and its report from the document.
- Unlink keeps the report but turns it into ordinary text. It is no longer listed in the pane and will never be updated again, and you are free to edit it.
An inserted report is protected: you cannot type inside it, because anything you typed would be thrown away by the next update. Use Unlink when you want to edit the text of a report by hand.
Language
The add-in follows Word's own interface language, not Windows'. A Dutch Word shows a Dutch add-in, an English Word an English one. It has nothing to do with the language XFEM4U itself is set to; the report inside the block comes from XFEM4U and follows XFEM4U's language setting.
Limitations
- Blocks cannot be reordered from the pane. Move a report by removing the block and inserting it again at the new place.
- Copying and pasting a report block inside Word produces a second block that cannot be updated. It is listed as Needs attention, named as a copy of the original. Insert the model a second time instead.
- One calculation at a time, per Word session.
- A calculation that runs for more than ten minutes is stopped, and the document is left unchanged.
- Word for the web and Word for Mac are not supported.