Your Ultimate Information Platform

Methods to use fields to create a conditional header or footer in a Phrase doc

0

[ad_1]

In the event you run right into a conditional header or footer request that you could’t deal with, check out Phrase fields. They don’t seem to be magic, however it seems like magic once they do what you need.

word-illustration.jpg

Illustration: Lisa Hornung, Getty Pictures/iStockPhoto

If somebody requested you so as to add a conditional header or footer to a doc in Microsoft Phrase, would you panic? Some customers would possibly as a result of the interface gives no such possibility. You should utilize the Totally different Odd & Even Pages possibility, however that is not the identical factor. 

A conditional header or footer will show, or not, relying on whether or not an expression returns TRUE or FALSE. On this article, I am going to present you 3 ways to make use of fields to generate a conditional header or footer, though the examples will all be within the footer. 

SEE: 83 Excel ideas each consumer ought to grasp (TechRepublic)

I am utilizing Microsoft 365 on a Home windows 10 64-bit system, however you need to use earlier variations. Phrase fields have been round for a very long time. This text assumes you will have primary Phrase expertise, however even a newbie ought to have the ability to comply with the directions to success. You may obtain the demonstration .docx and .doc information, however I encourage you to observe getting into the fields your self. Phrase On-line would not show headers and footers; nor are you able to manipulate them. Nevertheless, they’re nonetheless there, and they’ll print.

What’s a discipline in Phrase?

In the event you’re conversant in Phrase fields, you are a step forward. If not, they don’t seem to be troublesome to make use of, however the course of would possibly really feel a bit odd at first. Fields are little applications that full a particular process, much like a macro, however you needn’t write any code. The whole lot the sphere must do its job is already there, aside from the knowledge you provide. 

You employ fields virtually each time you utilize Phrase, however you simply do not realize it. As an illustration, while you use the interface to show a web page quantity within the header or footer, you are utilizing a discipline! If you would like to see that at work, open a brand new doc and enter a web page quantity within the header. Then, choose the web page quantity and press Alt + F9. Phrase converts the web page quantity to its underlying { PAGE } discipline. On this mode, you may modify the sphere. Press Alt + F9, which acts as a toggle, once more to see the web page quantity. 

The expression to show on final web page of the Phrase doc

It is common to show a unique header or footer on the primary or final web page of a doc. You should utilize the built-in Totally different First Web page choice to show a unique header on the primary web page. There is not any such possibility for the final web page; figuring out the final web page requires a easy discipline expression within the type

{ IF {PAGE} = { NUMPAGES }, “true textual content” “false textual content”}

It is simple to decipher: If the present web page quantity, { PAGE } equals the whole variety of pages, { NUMPAGES } print “true textual content”. If the 2 web page numbers do not match, the expression prints “false textual content”.

Let us take a look at a fast instance utilizing a three-page doc:

  1. Open the header or footer by double-clicking within the high or backside margin.
  2. Phrase will place the cursor on the left margin, which is okay.
  3. On this subsequent half, we’ll be getting into the fields manually, which I feel is the best strategy to enter nested fields. To insert a clean discipline, press Ctrl + F9 and sort IF. (Case would not actually matter.) 
  4. Whereas nonetheless contained in the If discipline, press Ctrl + F9 a second time to enter a clean discipline and enter PAGE.
  5. Transfer the cursor to the correct of the closing } character within the { PAGE } discipline and enter =.
  6. Press Ctrl + F9 a 3rd time and enter NUMPAGES.
  7. Transfer the cursor to the correct of the closing } character within the NUMPAGES discipline and enter “Final web page” “Not the final web page”.

Determine A exhibits the nested fields. Don’t enter the {} characters from the keypad; it will not work. You could enter the clean fields utilizing Ctrl + F9 and enter the content material inside these brackets. Now, choose all the nested discipline expression and press Alt + F9 to guage the outcomes (Determine A). As you may see, the final web page is the present web page. 

Determine A

wordconditionalfooter-a.jpg

  Use a nested discipline expression to create a conditional header or footer.

I’ve proven you just one strategy to enter fields, however there are different strategies. Earlier than we proceed, I need to share one other strategy to enter nested fields that you simply would possibly discover simpler. You may sort the sphere identify, comparable to IF or NAME, choose that identify and press Ctrl + F9. Doing so will convert IF or NAME to a discipline and insert the brackets.  

This straightforward expression works wonderful till you will have unnumbered pages in your doc. As an illustration, the doc may need a desk of contents or a title web page that you do not need within the web page rely. When this occurs, you should discover a strategy to accommodate these pages. 

SEE: Home windows 10: Lists of vocal instructions for speech recognition and dictation (free PDF) (TechRepublic)

In the event you’re excluding solely the primary web page, use the Totally different First Web page possibility. Doing so will inhibit a web page quantity, and Phrase will not embody that web page within the remaining web page rely. Excluding different pages would possibly require a piece break or an expression that evaluates these pages. The next expression excludes a two-page part originally of the doc that is not included within the whole web page rely:

{ IF {PAGE} = { NUMPAGES – 2 } , “Final web page” “Not the final web page”}

The expression is sort of the identical as the primary, however the -2 element subtracts 2, the whole variety of pages you need to exclude from the web page rely. 

If you need the expression to return nothing, use the empty string character, “”. For instance, the next nested discipline expression will return a string on the final web page and return nothing on all different pages:

{ IF {PAGE} = { NUMPAGES } , “” “Not the final web page” }

Now let us take a look at a situation that appears a bit extra advanced.

Methods to specify web page numbers in a footer in Phrase

What occurs when you will have a footer that you simply need to print solely on particular pages? You employ the identical fields to precise the particular web page numbers and use the suitable true and false textual content. Let’s suppose that you simply need to print a web page quantity solely on pages 5 and 6?

The issue solely appears extra advanced, however in reality, it is easier. As an alternative of a nested expression, use two expressions:

{ If {Web page } = “5” “Web page 5” “” }

{ If {Web page } = “6” “Web page 6” “” }

Determine B exhibits the web page quantity on web page 6.

Determine B

wordconditionalfooter-b.jpg

  Use two expressions to fulfill the pages 5 and 6 situation.

Each circumstances are easy to fulfill utilizing two totally different expressions as a substitute of a nested expression. Now, let us take a look at one thing you would possibly assume not possible utilizing fields.

Methods to show a picture in a header or footer in Phrase

If requested for those who can show a conditional picture within the header or footer, you would possibly reply, “No.” That is not appropriate. You deal with a picture the identical as some other textual content or worth. First, it’s good to insert the picture file into the doc and reserve it as AutoText. Then, you insert the AutoText into the footer or header. 

First, let’s add TechRepublic’s emblem to the doc as an AutoText aspect:  

  1. Insert the image into the physique of the doc (not a header or footer) as you’ll some other picture file. 
  2. Choose the picture and click on the Discover Fast Components dropdown. 
  3. Select Save Choice to Fast Components Gallery.
  4. Within the ensuing dialog, give the picture a reputation, comparable to TRLogo (see Determine C). 
  5. Click on OK. 

Determine C

wordconditionalfooter-c-e.jpg

  Identify the picture one thing significant so it is simple to recall.

Now that you’ve the picture as an AutoText merchandise within the doc, you may insert it into the header as follows: 

  1. Place the cursor within the header or footer the place you need it to look. 
  2. Utilizing Determine D as a information, enter the { IF } discipline as much as the primary ” character. 
  3. Click on the Insert tab. 
  4. From the Discover Fast Components dropdown (Textual content group), select AutoText. 
  5. Choose the picture (Determine E) and click on OK. 

Determine F exhibits the TechRepublic.com emblem within the footer, conditionally; it seems solely on the final web page due to the conditional discipline expression proven in Determine D.

Determine D

wordconditionalfooter-d.jpg

  Enter the sphere expression as much as the brand picture. 

Determine E

wordconditionalfooter-e.jpg

  Choose TRLogo, the picture AutoText you beforehand added. 

Determine F

wordconditionalfooter-c.jpg

Fields are so versatile that you could even show a picture conditionally.

This introduction to displaying conditional content material, together with pictures, in a doc’s header or footer is only the start. You should utilize the next comparability operators: =, <>, <=, and >=. You have discovered find out how to nest fields, which is extraordinarily helpful. Nevertheless, even when you could possibly use a nested expression, you do not all the time should, as proven within the second instance. Bear in mind to all the time use F9 to insert and modify fields. 

Keep tuned

I discussed earlier that there are extra methods to enter fields than the one I labored you thru within the first instance. A future article will embody the entire methods to enter Phrase fields. 

Additionally see

[ad_2]

Leave A Reply

Your email address will not be published.