Everyday Documents

Home|Articles

Unlocking Larger Page Sizes in Microsoft Word

By editing width and height in the underlying xml data of a Word document we can unlock A1 & A2 page sizes. We tried A0 but Word doesn't play nice.

Sep 9, 2023 - 4 min read

Unlocking the secrets of pgSz

Maximum Page Size

As of 2023, the maximum allowable page size in Microsoft Word is 55.87cm x 55.87cm. Default page sizes up to A3 are available, suitable for most education and office tasks: assignments, letters, reports, memos, etc. Tasks involving A2, A1, and A0 are sadly out of reach (for instance, any type of large poster).

Zip files in disguise

Thanks to ThioJoe we know that Word documents are zip files in disguise.5490 Changing the extension from .docx to .zip allows us to open and view the inner file structure (mostly xml files). Interestingly, images pasted into a Word document actually live within one of the folders. Useful if you are trying to recover image files from a Word document.

Contents of a Word document in zip format

Within the document.xml file there is a piece of code <w:pgSz w:w="11906" w:h="16838"/>. You are correct, these appear to be page sizes, values for both width and height. Documents with section breaks will have multiple pgSz entries. An orientation value will be visible if the page has been set to landscape.

Page size stored in document.xml

Twips measurements

Twip is an abbreviation for "twentieth of an inch point", a screen-independent unit commonly used for Rich Text Format (RTF) applications, such as Microsoft Office, Open Office & Libre Office.2894 One twip is defined as 1twip = 1/1440in. Rearranging this we get 1in = 1440twips.

You may be wondering why this is important. Looking a the initial A4 page size (rather large values) it looks like Word stores page sizes using twips values.

New page sizes

Using our new found knowledge of twips measurements we can come up with an equation to convert millimetres to twips. We know that:

  • 1 inch = 25.4 mm4682
  • 1 twip = 1/1440 inch2894

To summarise the conversion:

twip = (mm * 1440) / 25.4

The twips conversion can be applied to the full range of ISO page sizes. Standard ISO page sizes can be sourced from Wikipedia.7983

ISO page size7983Width (mm)Height (mm)
A4210297
A3297420
A2420594
A1594841
A08411189

Metric page sizes can be converted to imperial using 1 inch = 25.4 mm.4682 Values are not rounded, as rounding will affect twips value accuracy.

ISO page size7983Width (in)Height (in)
A48.26771653511.69291339
A311.6929133916.53543307
A216.5354330723.38582677
A123.3858267733.11023622
A033.1102362246.81102362

Applying 1 twip = 1/1440 inch we find:

ISO page size7983Width (twip)Height (twip)
A41190616838
A31683823811
A22381133676
A13367647679
A04767967408

The A4 twip page size matches the default values found in the xml document, confirming our hypothesis that twips values are in use.

Twips value must be rounded for use in the xml file. In some cases, the twips value must also be incremented to provide the correct page size once opened in Word (where Word converts back to mm).

Editing xml data

Using our new twips page sizes we can overwrite the width and height values in the document.xml file. After changing the values save the xml file, exit the zip, and rename back to .docx.

Opening the edited Word file will generate the custom page size (within certain limits).

Results

On the surface, the xml hack appears to work well (as of 2023). A1 & A2 documents can be created. Documents can even be exported to PDF without any difficulties. Problems do arise when using page sizes larger than A3. Modify page sizes at your own risk.

  • Page rulers do not display correctly. We are unsure how many things within Microsoft Word become broken at larger page sizes.
  • Page sizes above 65,536 twips (16 bit) do not work. This means that A0 is not achievable. Probably a case of integer overflow.

Resources

  1. Wikipedia - Paper size
  2. Wikipedia - Centimeter
  3. Wikipedia - Twip
  4. Stack Overflow - Twips, pixels, and points, oh my!
  5. YouTube - File Types That Are Secretly Just .Zip Files In Disguise

Latest Articles

Show more articles