Adding Header/Footer to Word Documents
  • 02 Dec 2021
  • 4 Minutes to read
  • Dark
    Light
  This documentation version is deprecated, please click here for the latest version.

Adding Header/Footer to Word Documents

  • Dark
    Light

Article summary

Overview 

To better customize and append Word Documents via workflow, uses may utilize the Add Header/Footer to Word Document step. This step allows users to establish a Header and/or Footer for a Word Document, through a number of various ways at design time. The following document discusses this step's functionality and demonstrates how to utilize it within a Flow to update a Word Document.


Example 

Example Word Document 
Before proceeding with the following example, download the following .docx file.

To add a Header and Footer to a Word Document through the use of a Flow: 

  1. From the Flow Designer, attach a Create Data from the FAVORITE STEPS category of the Toolbox tab, to the Start step. 
  2. From the Properties tab of the Create Data step, under DATA > Data To Create, select SHOW EDITOR. 
  3. From the Data to Create window, provide a NAME, select File Data from the TYPE dropdown. Then Constant map the example file to the INPUT. Click DONE, then Save and close the Data via X
  4. From the Toolbox tab, navigate to DATA > MS WORD and attach an Add Headers and Footers To Word Document to the Create Data step. Then attach the Failed path to the End step.
  5. From the Properties tab of the Add Headers and Footers step, Select From Flow map the Output from the Create Data step to the FILE > Input File
  6. Select the desired option under INPUTS > Existing Headers/Footers.
    Additional Information on Existing Headers/Footers 
    This Input is used to dictate how to handle present Headers and Footers on the document. The options for handling these are as follows:

    • Clear All Headers and Footers: Deletes current Headers and Footers on the document. 
    • Clear Headers: Only clears out the Headers on the document.
    • Clear Footers: Only clears out the Footers on the document. 

    If Clear Headers or Clear Footers is selected, the additional option to Append New Headers/Footers is provided.

    Selecting Append To Beginning adds the Header or Footers before any preexisting headers or Footers.
    Selecting Append To End adds them after current Headers or Footers.

  7. If desired check the Different First Page or Different on Even/Odd Pages box.

    Additional Information on Different on Page Boxes
    The Different First Page checkbox allows users to provide a different Header/Footer on the First Page of the document. Selecting this option also allows the option to select Different First Page By Section (see respective section below for further information).

    The Different on Even/Odd Pages allows users to provide separate Headers/Footers for the Even and Odd Pages respectively. 

  8. Under INPUTS > Footers, select SHOW EDITOR. From the Merge Text Editor, utilize text input and the Data from the Data Tree on the left to define the Footer. Map [PageNumber] of [TotalNumberOfPages] then click SAVE. 

  9. Under INPUTS > Headers, select SHOW EDITOR; then, map the desired Header and SAVE. 

  10. From Toolbox > FAVORITE STEPS, connect a Show Form step to the Done path of the Add Headers and Footers step. From the Properties tab of the Show Form step select PICK OR CREATE FORM step and CREATE a new Form

  11. From the Form Designer, design a Form utilizing a Button and a File Download component from the FAVORITES category. Label the Button "Done. Then from the Properties tab of the File Download component, under Select Button Type, select Button; Save and close the Form Designer. 

  12. Back in the Flow Designer, map Output File to the Download component's Input, then connect the Download Form's Done path to the End step. 

  13. Save the Flow, then if desired, close via X. 


Debug

  1. From the Flow Designer, select the Debug link from the top Action Bar. Then click START DEBUGGING. 
  2. When the Flow reaches the Download Form, select the Download File button, then click Done
  3. Open the downloaded file to verify that the Header and Footer were applied as configured. 



Different First Page By Section 

Enabling the additional option to select Different First Page By Section allows the ability to edit Headers/Footers on more complex documents that contain multiple Section breaks.

To do so:

  1. From the Properties tab of the Add Headers and Footers To Word Document step, under INPUTS, check Different First Page, then check Different First Page By Section.
  2.  Select the Build Array mapping type on the Section First Page Header/Footer Input. Then set the mapping for Item 0 to Constant.
  3. From the Edit screen select SHOW EDITOR and define the desired Foot and Header. Map the desired Section Number to determine which section of the document receives the Header/Footer. 
    Additional Information on Section Numbers
    Note that Section Number values must start at 1 and cannot equal 0. 

  4. From the Section First Page Headers/Footers Input, ADD additional Sections to configure additional Headers/Footers as needed. 

  5. From the ERROR HANDLING section of the Properties tab, select the desired methods for Too Few Sections Entered, Extra Sections Entered, and Duplicate Sections.

    Additional Information on Error Handling 
    The Error Handling properties are used to determine what happens in the event that the Add Headers and Footers To Word Document doc is configured to handle less Sections than expected, more than expected, or duplicate Sections.

    Users are provided the option to either 
    • Ignore and Continue (add output message): Allows the user to output an error message. 
    • Ignore and Continue: Allows the Flow to continue and finish as usual. 
    • Throw Exception: Allows the Flow to throw an exception.

  6. Save the Flow, then Debug as usual.

  7. Download the file, then open it to verify that the Section Headers/Footers were properly applied. 


Was this article helpful?