Word Note (No. 24)
Tables in Bills
Document release 4.1
Reissued September 2002
Updated 30 August 2010

Contents
Introduction	1
Macros to create and alter tables	2
Insert an OPC Table macro	2
Add/Remove Rows and Columns macro	2
Inserting or deleting columns	3
Inserting or deleting rows	3
Renumber Table Rows macro	3
Sorting material in tables	4
Format Table Borders macro	4
Align Table Cells macro for aligning numbers in a column	5
Format All Tables macro	5
Note about styles in tables	5

Introduction
1	This Word Note sets out information about macros to assist staff to produce tables. Rules about tables, and amending tables, are described in Word Note No. 4 (Formatting rules for OPC Bills and amendments) and in the Amending Forms Manual.
2	To assist staff to produce tables, there are macros to:
(a)	create new tables;
(b)	insert or delete rows in tables;
(c)	insert or delete columns in tables;
(d)	sort material in tables;
(e)	format borders;
(f)	number the rows in a table;
(g)	format all the tables in a document;
(h)	align numbers within a column of the table.
3	If you would like more information about how to use tables, please see one of the IT staff.
Macros to create and alter tables
Insert an OPC Table macro
4	The Insert an OPC Table macro enables you to create a table of a chosen number of columns, items (rows) and heading rows.
5	You can run this macro by clicking on the Tables button in the Bills group on the OPC tab on the Word Ribbon and choosing Insert an OPC Table. Alternatively, click on OPC Macros and choose Tables, Insert an OPC Table.
6	Depending on the type of document you have (Bill, Memo or Sundry), the macro automatically sets the columns to equal width within the page.
7	The macro formats the borders correctly, merges the cells in the first row (for the heading) and numbers all the items in the table.
8	Tables (except single column tables and commencement tables) generally have item columns. You can choose (using the “Insert additional numbered item column” checkbox) whether or not the macro will insert an item column. If you choose to have the macro insert an item column you should not count that column when specifying the number of columns in the Columns field.
9	For single column tables, the macro does not include an item column. Single column tables always have a thick line at the top and bottom, but no lines in between.
10	If you choose no headings for the table, the macro does not put a thick line at the top or bottom of the table. This feature is useful for amending tables.
11	If there is more than 1 heading row then the columns of the first heading row are merged.
Add/Remove Rows and Columns macro
12	The Add/Remove Rows and Columns macro inserts or deletes rows and columns in a table (including a commencement table in a Bill document).
13	You can run this macro by clicking on the Tables button in the Bills group on the OPC tab on the Word Ribbon and choosing Add/Remove Rows and Columns. Alternatively, click on OPC Macros and choose Tables, Add/Remove Rows and Columns.
14	From the dialogue box, click the relevant radio button to show whether you want to alter the number of rows or columns in the table.
15	In the Quantity box, use the up or down arrow to indicate the number of rows or columns you want to insert or delete.
16	Click either the Insert or Delete button depending on what you want to do.
Inserting or deleting columns
17	The macro inserts a column to the right of the column containing the cursor or deletes the column containing the cursor (and, if you have chosen to delete 2 or more columns, columns to the right of the column containing the cursor).
18	The total width of the table is not altered, just the width of the columns. After inserting or deleting columns, you can manually alter the width of the columns as required, by clicking on and dragging the line marking the left or right side of a column.
Inserting or deleting rows
19	The macro inserts one or more rows (depending on the number you chose) above the row containing the cursor.
20	If your cursor is in a row and you choose to delete 2 or more rows, the macro deletes the row containing the cursor and row(s) below. Alternatively if you have selected one or more rows of the table before running the macro to delete that number of rows, it deletes the selected rows.
21	If the first or last row of the table is affected, then the Format Borders macro is run automatically to apply the correct borders to that row.
Renumber Table Rows macro
22	If you have added, deleted or rearranged the rows in a table you may want to number them.
23	The Renumber Table Rows macro numbers all the rows that are not headings from 1. It replaces all the text in the left‑most row of the table with the new number (so do not run the macro on a table, such as a commencement table, whose left‑most column contains anything other than item numbers).
24	You can run this macro by clicking on the Tables button in the Bills group on the OPC tab on the Word Ribbon and choosing (R) Renumber Table Rows. Alternatively, click on OPC Macros and choose Tables, (R) Renumber Table Rows.
Sorting material in tables
25	The Table Sorting macro helps you sort material in a table.
26	You can run this macro (with the cursor in the table you want to sort) by clicking on the Tables button in the Bills group on the OPC tab on the Word Ribbon and choosing Table Sorting. Alternatively, click on OPC Macros and choose Tables, Table Sorting.
27	This brings up a dialogue box that tells you how many columns and rows are in the table, and lets you choose which columns to sort by and how the information in each column chosen should be sorted. If you want to sort numbers, you should sort by numeric field (and not alphanumeric field, which sorts digit by digit and so orders 12 before 2 for example).
28	You can ensure that the sorting ignores the header rows by putting a tick in the Exclude Header box.
29	You can make sorting case‑sensitive by putting a tick in the Case Sensitive box. Doing this will make the sorting order a lower case letter before the same letter in upper case if sorting in ascending order.
30	Once you have made all your choices for sorting by a particular column, click on the Add button. (You can remove your choices for sorting by a particular column by highlighting the column and clicking on the Remove button.)
31	If you wish to sort by more than one column, the macro sorts first by information in the column you have listed first, then by the column you have listed second, and so on.
32	Once you have made all your choices for all the columns you want to sort by, click on the OK button to carry out the sorting.
33	After sorting, you may need to reformat the table (to ensure appropriate borders for the table) and/or renumber the rows (so they are consecutively numbered). You can choose to have this happen “automatically” by answering Yes when asked by the Table Sorting macro. Alternatively you can “manually” run the Format Table Borders macro and the Renumber Table Rows macro (by clicking on the Tables button in the Bills group on the OPC tab on the Word Ribbon and choosing the relevant macro) after you have run the Table Sorting macro.
Format Table Borders macro
34	If you have added, deleted or rearranged the rows in a table you may want to format the borders in the table.
35	The Format Table Borders macro applies standard table formatting to the currently selected table.
36	You can run this macro (with the cursor in the table whose borders you want to format) by clicking on the Tables button in the Bills group on the OPC tab on the Word Ribbon and choosing Format Table Borders. Alternatively, click on OPC Macros and choose Tables, Format Table Borders.
Align Table Cells macro for aligning numbers in a column
37	To set up the alignment of numbers in a table, select the cells in which numbers are to be aligned and the heading cell that will contain centred text, and run the macro by clicking on the Tables button in the Bills group on the OPC tab on the Word Ribbon and choosing Align Table Cells.
38	Type the maximum number of decimal places you expect in the column. For example, if there will be up to 4 decimals (e.g. 0.1234) then type in 4.
39	Type the maximum number of whole numbers you expect in the column. For example, if there are up to 7 whole numbers (e.g. 1,456,234) then type in 7.
40	This will determine where the decimal tab stop is placed, based on the centre of the column and the total width of the numbers.
41	To reset the alignment to text, select the cells and run the Align Table Cells macro again. Select the text option to remove all tab stops and align the cells to the left.
Format All Tables macro
42	The Format All Tables macro checks each table in a document is formatted correctly and changes some formatting.
43	The macro does the following for each table in the document:
(a)	checks the width of the table does not exceed the page margins—if it does, the macro will warn you, but you will need to manually adjust the table to fit inside the margins;
(b)	formats the table heading rows in bold font;
(c)	replaces any old table,t styles with Tabletext,tt styles;
(d)	formats the borders of the table (unless it is in a Bill_Plan document).
44	You can run this macro (with the cursor anywhere in the document) by clicking on the Tables button in the Bills group on the OPC tab on the Word Ribbon and choosing Format All Tables. Alternatively, click on OPC Macros and choose Tables, Format All Tables.
Note about styles in tables
45	The default style for use in tables is the Tabletext,tt style. Each cell should use this style with the exception of the following styles:
(a)	Table(a),ta style—used for paragraphs within a table cell;
(b)	Table(i),taa style—used for subparagraphs with a table cell.
46	See Word Note 3—Bill templates, styles and examples for more information on how to use the table paragraph styles.
47	The old OPC table style was Table,t. Some OPC Sundry documents that contain tables still contain the old style Table,t. After editing a table with this style, Word consistently causes lines to print through all the line numbered pages of Bills. You then need to quit Word to be able to print the document.
48	To prevent the problem recurring, run the FixDocument macro on any Sundry documents that you have which contain the Table,t style. The macro replaces all Table,t styles with Tabletext,tt style.

Andrew Newbery
Information Technology Director

Document History	
Release number	Release date	Document number	
1.0	20 April 2006	s05pu378.v01.doc	
2.0	02 August 2006	s05pu378.v02.doc	
3.0	04 August 2006	s05pu378.v03.doc	
4.0	21 August 2006	s05pu378.v04.doc	
4.1	30 August 2010	s05pu378.v08.docx