Macro to print page numbers from a cell

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
scout_86
Posts: 7
Joined: Thu Jan 10, 2013 12:38 am

Macro to print page numbers from a cell

Post by scout_86 »

Is there a way to print page numbers from a cell? My situation is that I have a spreadsheet with multiple sheets. Each sheet has a designated print area. All of the print areas have some form info inserted (so they don't get filtered out by them being blank pages). I know how to create a true false statement to check individual cells for info and insert a page integer in a list so I know which pages are active, but I don't know how to get those page numbers into an automatic macro to print. Any ideas?
OS Windows 7
OO v3.4.1

Thank you.
Open Office 3.4
Windows 7 home
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Macro to print page numbers from a cell

Post by Villeroy »

http://forum.openoffice.org/en/forum/vi ... =21&t=2762 (Function CELL_ISHORIZONTALPAGEBREAK)
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
scout_86
Posts: 7
Joined: Thu Jan 10, 2013 12:38 am

Re: Macro to print page numbers from a cell

Post by scout_86 »

Forgive my ignorance, but would you be able to provide a bit more explanation? Maybe how the information in this link will solve the problem?
Thank you.
Open Office 3.4
Windows 7 home
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Macro to print page numbers from a cell

Post by Villeroy »

Getting the page number for a cell is close to impossible. All you can get is the info if a cell's top border includes any horizontal page break or if a cell's right border includes any vertical page break (either automatic or manual breaks).

The 2 Basic functions get these attributes for any given cell. You can apply these functions along rows and columns, calculate the amount of breaks before and behind the given cell using some algorithm which takes into account the print order (columns first or rows first) as well as the actually printable range. Things become complicated when multiple print ranges are set up explicitly.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
scout_86
Posts: 7
Joined: Thu Jan 10, 2013 12:38 am

Re: Macro to print page numbers from a cell

Post by scout_86 »

I think that I failed to explain the situation adequately. What would like to do is have the page numbers that I want to print (example I want to print p. 2,4,5). If I were to put that info into a cell in some format (either "2,4,5" or one page number for each cell in a section of a column), how would I get that info in the print page dialog automatically? I have tried to record a macro, but it does not paste the info.
Open Office 3.4
Windows 7 home
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Macro to print page numbers from a cell

Post by Villeroy »

And why do you need any Basic code when you have templates, print ranges, page styles at hand?

Anyway: http://sourceforge.net/projects/ooomacr ... er_Footer/
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
scout_86
Posts: 7
Joined: Thu Jan 10, 2013 12:38 am

Re: Macro to print page numbers from a cell

Post by scout_86 »

I want to have one click printing of any pages that contain relevant data.
Open Office 3.4
Windows 7 home
User avatar
Villeroy
Volunteer
Posts: 31345
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Macro to print page numbers from a cell

Post by Villeroy »

Then HACK for gods sake!
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
scout_86
Posts: 7
Joined: Thu Jan 10, 2013 12:38 am

Re: Macro to print page numbers from a cell

Post by scout_86 »

Yes...that is what I am trying to do.
Open Office 3.4
Windows 7 home
Post Reply