ENGFlow Toolkit
===============

Excel runs the offer: choose the options, press a button, get the Word file and the PDF.
One workbook, three jobs:

  GENERATE   the form on the Home sheet  ->  a finished Word offer (.docx) and a PDF
  UPDATE     an existing offer + a changed form  ->  the same file with every difference
             as a Word tracked change (accept or reject them in Word)
  EXTRACT    any Word file  ->  an Excel workbook with real Tables: requirements,
             fields, key facts, tables and the outline

The demo data is fictional (a palletizing cell offered by "Muster Maschinenbau GmbH").
The rules behind it are plain tables on the Rules sheet: change a price, a condition or a
requirement there, press a button, and the Word file follows.


WHAT YOU NEED
-------------
  - Windows with the desktop apps Microsoft Excel and Microsoft Word (Microsoft 365 or 2016+).
    Not for Mac, and not for the web versions: VBA needs the desktop apps.
  - Permission to run macros in this file (see the next section).


FIRST START (once)
------------------
  1. Right-click the downloaded ZIP  >  Properties  >  tick "Unblock"  >  OK.
     Do this BEFORE unzipping. Windows marks downloaded files, and Office blocks macros in
     marked files until you unblock them. (If you already unzipped: unblock
     ENGFlow_Toolkit.xlsm the same way, then open it.)
  2. Unzip, keep the folder on a local drive (not a network share or a synced web folder),
     and open ENGFlow_Toolkit.xlsm. If a yellow bar appears, click "Enable Content".
  3. On Home press "Run self-test". It checks the rules, Word and Excel on this PC with one
     real round trip in a temporary folder and ends with a pass/fail report.

The file is not digitally signed. Your IT department can sign it or trust its folder.
All the code is readable: press Alt+F11, or open the text files in the Source folder.


HOW TO USE
----------
  Generate offer   Fill in the project fields, pick the options (drop-downs), press the button.
                   The Word file and the PDF are saved in the Output folder.
  Update offer     Paste the path of an existing offer into "Update: file" (or leave it empty
                   to choose the file), change the form, press the button. A new file ending
                   in _tracked.docx is saved in Output. Optional: write a change note.
  Extract to Excel Paste the path of a Word file into "Extract: file" (or leave it empty to
                   choose the file), press the button. An .xlsx with one Excel Table per kind
                   of data is saved in Output.
  Log sheet        One line per run, errors included.

The toolkit starts its own hidden Word and quits it again, so documents you have open are
never touched. If Word is already open, close it before you press a button.


WHAT IS INSIDE
--------------
  ENGFlow_Toolkit.xlsm                  Home (form and buttons), Rules (the rule tables), Log
  Templates\offer-pack-template.en.docx the Word template: fields, conditional chapters and
                                        tables are Word content controls with tags
  Output\                               everything the toolkit creates
  Source\                               the VBA modules as text files (import with Alt+F11)

Rules in one minute: a condition is key=value or key!=value, joined with AND / OR (AND binds
tighter), for example  robots=2 AND gripper!=vacuum . Chapters, paragraph groups and
requirements appear only when their condition holds. Numbering and the table of contents
follow automatically.


GOOD TO KNOW
------------
  - UPDATE uses Word's own Compare. "Accept all" gives exactly the new version. "Reject all"
    brings the old text back; Word may leave a few empty content-control shells behind
    (cosmetic). The update refuses files that still contain tracked changes: accept or
    reject them first.
  - Fields in the Word template are rich-text content controls. Do not delete the tagged
    controls (customer, total_price, ...) or the tbl:/sec:/blk: groups when you edit the
    template.
  - This version ships the English template only.
  - Demo data only. Fictional companies, a fictional product, no real prices.
  - ENGFlow is independent and not affiliated with Microsoft. Microsoft, Excel and Word are
    trademarks of Microsoft.

Questions or a version for your own documents: eyadhassanin@outlook.com
