Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I work with several ODT documents which include tables to be printed and filled in by hand. These tables contain in the header a cell with text "Sheet ____ of ____" to be filled in by hand once printed. I'd like to automate these fields, if possible.

Is possible to get the number of pages a table spans and/or to get the n-th-spanned-page for a table, in order to include it in the header?

share|improve this question

2 Answers 2

up vote 0 down vote accepted

I don’t have access to LibreOffice; this answer seems to work for Microsoft Word 2007.

First of all, I suggest that you insert section breaks between the tables and restart page numbering, so you can get “Sheet 1 of _” on the first page of each table.  (But you probably already know that, right?)

Next, insert a bookmark at the end of each table, just before the section break.  Give them meaningful names like “end_of_table_1”.  Then, in the header for each section, after the “Sheet 1 of ”, insert a PageRef field that references the bookmark at the end of that section.

share|improve this answer
    
Starting a section for each table and using the bookmark trick works very nicely, thanks. Unfortunately that breaks the overall document numbering in the footer (which is itself reset for the Appendix that contains all of the tables). I think I'll try marking the start page of the table and the end page of the table and see if it can be calculated with a macro. –  aejh Jan 16 '13 at 16:33

Quoting Libreoffice Help website:

Choose Insert - Fields - Page Number to insert a page number at the current cursor position. If you see the text "Page number" instead of the number, choose View - Field names.

However, these fields will change position when you add or remove text. So it is best to insert the page number field into a header or footer that has the same position and that is repeated on every page.

Choose Insert - Header - (name of page style) or Insert - Footer - (name of page style) to add a header or footer to all pages with the current page style.

Link with source

share|improve this answer
    
This inserts a document's or section's page number, rather than the table's page number. E.g., if the table is on page 5 and ends on page 8, the table's header should say Sheet 1 of 4 on page 5, Sheet 2 of 4 on page 6 and so on. –  aejh Jan 17 '13 at 8:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.