Page 1 of 1

[Solved] Automatic page numbers in a cell

Posted: Thu Jan 16, 2020 1:38 am
by Albireo
Is it possible to insert page numberrring i a specific cell?
(I want, not use the header or footer line.)

Re: Possible with automatic page numbers in a cell

Posted: Thu Jan 16, 2020 6:41 am
by RusselB
In Calc, simply, no this is not possible.
Please see this topic which is similar.

Re: Possible with automatic page numbers in a cell

Posted: Thu Jan 16, 2020 8:24 am
by Zizi64
The Cells of a spreadsheet may flow onto the next/previous page when you modify
- a row height
- the page size
- the page orientation
- the margin of the page
- the sheet scaling factor
- etc...

Therefore the cell where you want to put a "page number" maybe will often flow dinamically onto an another page. For example: the cell will flow from the bottom of the actual page to the top of the next page. Then the cell will show
- a wrong page number
- in a wrong position



You can not put any label/field into a Cell, which you can put into a Wrtiter text content, but you can put a "Sheet number" into a cell by usage the function:

Code: Select all

=Sheet()

Re: Possible with automatic page numbers in a cell

Posted: Thu Jan 16, 2020 8:38 am
by Zizi64
A workaround tip:
When you use forced page breaks, with some gaps on the phisycal pages for the for the possible modified row heigths, you can put the start value of a virtual "page number" into a cell of the the first row of a page. Then you can increase it by 1:

Code: Select all

= A1+1
on the next page, and you can copy the formula onto the next pages. It works while you manually manage the properties of the Pages/Sheet and the Row heigths appropriately.

Re: Possible with automatic page numbers in a cell

Posted: Fri Jan 17, 2020 11:06 am
by Albireo
Thanks everyone!
I understand the problem, I am working with a manual invoice layout (which should preferably have the same layout as another invoice).
(Probably this invoice will never have more than one page - and maybe it will never be a problem in this case - but..)

My wish would have been to be able to handle headers more dynamically eg. .:
  • Being able to place a logo (image) on the top left.
  • Write the heading Invoice in the middle
  • And place the page number on the far right, in the same level as the header
The limitations I experience are .:
- To place a logo at the top of the page - at the header level.
- Get the headline in the middle of the page (what I understand - the only way to adjust the headline sideways is spaces)
However, the page numbering will work perfectly :D

I understand that Calc may not be the best solution to handle layout with,
but is there any way to always be able to see where the header is in relation to the other structure of the page?
(other than clicking on preview)

Re: Possible with automatic page numbers in a cell

Posted: Fri Jan 17, 2020 2:08 pm
by Zizi64
You can try the "Rows to Repeat" option. You will found under in the "Format - Print range" menu item.

The repeated rows will be appeared on every printed page.

Re: Possible with automatic page numbers in a cell

Posted: Sat Jan 18, 2020 1:06 am
by MrProgrammer
Albireo wrote:My wish would have been to be able to handle headers more dynamically eg. .:
Being able to place a logo (image) on the top left.
Write the heading Invoice in the middle
And place the page number on the far right, in the same level as the header
We seem to have the XY problem in this topic. You should have described all this in your initial post.

I believe you can accomplish your goal by using some of the other features of OpenOffice. Put your data in a spreadsheet, one row per invoice; it's layout is not otherwise important; it's formatting is irrelevant. Create a new database with the spreadsheet as its data source, register, and save it. Create and save a template in Writer with your logo, page number, and invoice in the layout you would like. Use Mail Merge fields in the invoice area to display data from a a row of the database.

You can now use File → Print → Form letter? → Yes → Records → {Select it} → OK. You might need to uncheck "Print automatically inserted blank pages", depending on your printer dialog. You can select multiple records to print multiple invoices. You could build a query to select, say. all the invoices for a selected month or for a specified customer.

Read about Mail Merge in Help → Index or searching for topics about it in the forum.. [Solved] Create index cards from multiple spreadsheet rows is a similar topic. Learn more about creating queries in the Base documentation by by searching for topics about that.