다음을 통해 공유


Word Quick Tip: Automatically adding a page to odd page-number document

Scenario

When publishing documents, you might need the last page that forcibly must be on the outside of the book or publication for esthetical or layout reasons.

Eg, company logo or contact details that should not be held at the 'inside' page of a book.

But from the simple mathematical point of view, as soon as you have more than 2 pages in a book or leaflet, page 1 and the last even page are on the outside.

So if your last "printed" page is odd, it's sitting at the inner side of the last leaf.

How do you solve this?

Word has an interesting function to use "field codes" that can solve the issue for you by adding a page break to an odd-paged document.

This function has been discussed before in many blog posts, but from the descriptions, it might not be too easy to get it working. Because there are some tricky things to fix.

So this article goes a step further

  • you can download a template document to play around with it, and experience yourself how it works
  • below, you'll find some very helpful tips, tricks and shortcuts to help you
  • some other references and articles

Option 1: Conditional page break

Credits

Basic steps described here: https://wordmvp.com/FAQs/TblsFldsFms/InsEvnPgEndChap.htm

Steps

Code to use in the document, to add a page BEFORE the last (not ON the last) is: 

{ IF{ =MOD({PAGE \* Arabic},2)}= 0 "<text if true>" "<text if false>[page break]<text after page break if false>" }

Where [PAGE BREAK] must be replaced with CTRL+ENTER.

Note

Do NOT copy and paste the entire code block, this will fail.
You need to create the code block first and then add the sections into it, manually.

Detailed steps

  1. Push the CTRL+8 shortcut, to show the layout codes and unprintable characters

  2. Push the ALT+9 shortcut to show the field codes

  3. On the page, before the last, hit 3x CTRL+F9, to add a 3-level nested field code, it looks like

    {{{}}}

  4. Then enter text on the right positions in the field code

    Location Text
    Between first { and second}  IF
    Between second { and 3rd {  =MOD(
    Between 3rd { and 1st }  PAGE \* Arabic
    Between 1st } and 2nd } ,2) 
    Between 2nd } and 3rd} = 0 "option true" "option false"
  5. Both in "in option true" as in "option false, you add the text you like

    1. You can leave the option true blank
  6. In option false you have a few options

    1. Enter text (can be blank) + break line at the end (no text on new page)
    2. Enter text (can be blank)+ break in the middle (also text on new page)

Visual Result

The result is :

Explanation

The page number of the before-last page is checked to be an odd number. (So last page must be even.)

To check for an odd number, use the modulo function and check

  • = 1 (uneven) or

  • = 0 (=even)

Then use the IF for adding action:

  • First option, if = true

  • Second option if = false

If before-last is odd, then add a message then add a page break.

You might recognize this method, where documents have added a "note" page, just before the last page (remember the last page on the strong>inside of the book).

 

Note

To add a break line, don't type the text, but use the CTRL+ENTER function.

Suggestion

Make sure that that the "heading 1" is set to use a "page break before" paragraph setting.

If not using the "page break before" in the heading, you'll need to add an additional page break manually to keep the last page separate.

Very famous example

The most well known phrase for this function is "This page intentionally left blank"

Option 2: Section break (even page)

The field codes allow to add a "conditional page break", so you ONLY add a page break IF you need to.

When using a section break (odd or even page) you ALWAYS add a page break, but you might end up adding 2 pages to the next odd or even page.

Check the download section below, you can find a sample in the TN Gallery.

Advantage

The configuration is simple, add a section break (even page) before the last page.

Disadvantage

The section break is

  • less flexible (no conditions)
  • less configurable (no conditional text to display)

Useful Word functions

Below you'll find some additional tips, you might need to get the field code in place.

*In document editing

Show/Hide Formatting controls (shortcut CTRL+8)

Use CTRL+8 to hide or show formatting symbol.

This method is usefull to see layout and non-printable context, like page breaks.

Update Field Codes – shortcut key F9

Function key F9 is used to update field codes, like the Table of Contents...

To update a section of specific field code, select the section to update

  • Select Eg TOC
  • Hit F9

If you want to update the entire document

  • Select all (ctrl+a)
  • Then hit F9

You'll get a question to update the numbers only or to update the entire content...

Of course , the answer depends on what you want to update

Show/hide ALL field codes (-ALT+F9)

Use the <ALT+F9> shortcut to show or hide the Word field codes functions, it shows "the source" code.

You'll need a view on the source code to edit it.

Toggle field code and value (Shift+F9)

Use the <ALT+F9> shortcut to show or hide the word functions and their value.

This function can show you the value of functions, sub-functions or entire field codes.

Page Break (CTRL+ENTER)

To add a page break (manually), use the CTRL+ENTER short cut.

Also when you need to add a conditional page break, you'll need this short cut, because adding the text [page break] won't work.

This is where a lot of people fail to implement the conditional page break function.

Printing setting

Make sure to update the calculation functions when printing. You can set this option in the Word options.

It's important to update the TOC and the conditional page break to be updated before printing.

You can update the fields manually, but it's way easier to have it done automatically.

An additional advantage is that the page preview will be showing you the final result, so it's a pretty handy function to test the code.

References

For this doc

For this document we used: https://wordmvp.com/FAQs/TblsFldsFms/InsEvnPgEndChap.htm

But also

Random and Lorem Ipsum random function: https://support.microsoft.com/en-us/help/212251/how-to-insert-sample-text-into-a-document-in-word

Other

Download

You can download the 2 template files from TN Gallery here: